[Cbc] Correct solving of problem with SOS only

Kish Shen kisshen at cisco.com
Tue Oct 23 13:17:25 EDT 2012


Hi Stefan,

Thanks for your reply.


I have moved the addObjects() call to before CbcMain0() as you 
suggested, but I still get the same incorrect solution, for the same 
cases, i.e. with or without declaring the variables to be integers.

It seems that the 'No Integer variables' warning message comes from the 
call to addObjects(), and not CbcMain0() as I thought. I also get this 
warning with a redundant constraint (X1+X2+X3 >= 0.1), but in this case 
I do get a correct solution (i.e. only one variable is set to non-zero).

Thanks and cheers,

Kish

On 23/10/2012 10:52, Stefan Vigerske wrote:
> Hi,
>
> On 10/22/2012 09:51 PM, Kish Shen wrote:
>> 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
>
> What a MIP...
>
>> 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(...);
>
> This does not add the SOS to the problem.
>
>> and then
>>
>> CbcMain0(*model);
>> ...
>> model->addObjects(nsos, mipobjects);
>
> This one should add it.
> I do this one before CbcMain0().
>
> What if you swap these lines?
>
>
>> ...
>> 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?
>
> I think you can (and should).
>
> Stefan
>
>>
>> Thanks in advance for any information/help!
>>
>> Cheers,
>>
>> Kish Shen
>> _______________________________________________
>> Cbc mailing list
>> Cbc at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/cbc
>>
>



More information about the Cbc mailing list