2
$\begingroup$

I have a knapsack problem. Say I have N possible items $x_i$. I would like to know:

$ \sum_{i=0}^{2} c_i x_i = W$

With the following constraint:

$c_i=3 \lor 4$

As an example suppose the set $x_i=1,\ldots,6000$ and $W=24000$. How can I use FrobeniusSolve and apply this constraint to $c_i$ efficiently?

$\endgroup$
  • $\begingroup$ Have you tried reformulating as an LP problem? $\endgroup$ – J. M. is away Apr 5 '17 at 10:00
  • $\begingroup$ Not really. Would you please elaborate? $\endgroup$ – Mirko Aveta Apr 5 '17 at 10:02
  • $\begingroup$ Would KnapsackSolve help, it is new in ver. 11? $\endgroup$ – bobbym Apr 5 '17 at 10:21
  • $\begingroup$ Nice! I haven't noticed this function! @bobbym $\endgroup$ – Mirko Aveta Apr 5 '17 at 12:13
  • $\begingroup$ @bobbym the problem with KnapsackSolve is that it solves inequalities, not equations. $\endgroup$ – Mirko Aveta Apr 5 '17 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.