[Scip] Using knapsack constraint in standalone solver

Daniel Jensen jensend at iname.com
Thu Sep 1 21:33:47 MEST 2011


I'm having a hard time finding much documentation for using SCIP as a 
standalone solver. I have a problem where I want to find the maximal 
product from a set of 42 integers which does not exceed a given number; 
the obvious thing to try was to take logarithms and turn it into a 
subset sum/0-1 knapsack type problem, and I put together simplistic 
versions of this in AMPL and LP formats and tried using SCIP to solve.

Apparently ("display constraint") SCIP is using its linear constraint- 
it doesn't recognize that the inequality in my file is a knapsack 
constraint. I imagine that if I could tell it this was a knapsack 
constraint and use the exact knapsack solver I'd be in a much better 
position. How can I use the knapsack solver without writing my own C 
program?

(long-winded detail below)

If I simply run SCIP on my LP file, it spends only 13 seconds arriving 
at a solution which is rather suboptimal. Displaying the solution shows 
that though all variables were specified to be binary it's assigning one 
of the variables a value of 1.00000099175524, bringing the objective 
value exactly up to the bound. So I need to decrease the tolerances esp. 
for integrality. But after I reduce tolerances, it chews through all my 
memory in ten minutes and starts swapping. (After about half an hour I 
interrupted it and found that though it had found a better solution it's 
still suboptimal.) Well, this is a large problem and my machine only has 
a couple GB of memory, but I can't help wondering whether there's a 
better way to do this with SCIP. (The naive brute-force approach of 
splitting the collection in two, finding the sums for all 2*2^21 subsets 
of each, and matching each in one group with the largest member of the 
other group to which it can be added without going over the limit should 
be much faster than that and take much less memory.)


More information about the Scip mailing list