[Cbc] Correct solving of problem with SOS only
Kish Shen
kisshen at cisco.com
Mon Oct 22 15:51:38 EDT 2012
Hi,
I have had a report of an incorrect solution with using SOS (SOS1) with
CBC, in that the SOS constraint is not respected (i.e. all the variables
specified in the SOS have non-zero solution values).
It turns out that this happens when no 'normal' constraints are
specified for the problem. Here is a problem that produces the incorrect
solution:
Objective: -2*X1*X2*X3
SOS1 for X1,X2,X3
Bounds for X1,X2,X3 are 0.0..1.0
The solution sets X1,X2,X3 to 1.0, violating the SOS.
Also, for the above problem, I get the message
Cbc3007W No integer variables - nothing to do
(I only get this on some platforms I tried the problem on, this might be
due to running with different versions of CBC)
If I then add the specification that X1,X2,X3 are integers, I still get
the same incorrect solution, but not the 'No integer variables' warning.
If a redundant constraint is added to the problem, e.g.
X1+X2+X3 >= 0.1
then it is solved correctly.
It looks like CBC decided that the MIP search does not have to be done
as there are no constraints. I have checked the running of the code,
and the SOS is added to the problem:
mipobjects = new CbcSOS(...);
and then
CbcMain0(*model);
...
model->addObjects(nsos, mipobjects);
...
CbcMain1(...);
From what I can tell, the 'No integer variables' warning comes before
addObjects is called, so I assume it is during the call to CbcMain0 (I
can't be sure as I have gdb stopping at the addObjects call, but the
message only appear later over some trivial code, before CbcMain1 is
called, I assume the message was delayed because the buffer was not
flushed).
The version of Cbc I am using is 2.7, downloaded about a year ago.
I can provide the full code I used to generate this problem, if required.
Is this a problem with CbcSlover, or is it a problem with the way I am
calling the routines? I don't think I can call model->addObjects()
before CbcMain0(*model). Is this correct?
Thanks in advance for any information/help!
Cheers,
Kish Shen
More information about the Cbc
mailing list