Function ADS::knapsackGreedy

Function Documentation

inline std::pair<long, Nodes> ADS::knapsackGreedy(const std::vector<long> &p, const std::vector<long> &v, long C)

the greedy heuristic of ZAINO: the objects by decreasing profit per volume, each taken if it still fits; not optimal in general

Pre:

p and v of the same size, p not negative, v positive, C >= 0

Post:

objects within C and their profit