laziness, impatience, and hubris | |
PerlMonks |
Re: optimization problem (Knapsack)by LanX (Saint) |
on Jun 10, 2018 at 20:21 UTC ( [id://1216339]=note: print w/replies, xml ) | Need Help?? |
> I am not even sure where to look for suggestions Sounds like Knapsack problem and family ... but I'm not sure about your side conditions.
editah sounds good: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. So pick a negative value of -1 or negative number representing the precision. You'll find plenty of implementations
update... though be aware that it's NP hard, runtime will depend on how good your result has to be and if you need a guarantied optimal solution.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|