Below is very simple knapsack model with N items, weights W and values V.
I made it to learn choco better, mainly to learn how I can squeeze more performance out of it. As a first step, I would like to influence how the occurences are set.
Can somebody point me to the documentation, or give a very small example, on how I could order the items taken in the knapsack (in my case occurrence is 0 or 1).
For instance, I would like to see if the performance gets better when I order my items by ratio of value over weight.
Solver solver = new Solver("Knapsack");
IntVar occurrences = VariableFactory.enumeratedArray("occ_", N, 0, 1, solver);
IntVar objective = VariableFactory.bounded("objective",
VariableFactory.bounded("capacity", 0, capacity, solver),
Please use github if you need some support about Choco3.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.