# Introducing constraints in FrobeniusSolve

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?

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