[Cbc] SOS constraints

Miles Lubin miles.lubin at gmail.com
Fri May 9 14:56:36 EDT 2014


Hi John,

Thanks for the clarification. When I change the problem sense to
maximize, however, the solution returned is all ones, so the SOS
constraint doesn't seem to be enforced in the way that you described.
It's possible that it's not being added correctly in the C interface,
though.

Best,
Miles

On Fri, May 9, 2014 at 2:54 AM, John Forrest
<john.forrest at fastercoin.com> wrote:
> Miles,
>
> Definition of SOS type 1 that is used is that at most one in set nonzero.
> If more than one then you create two branches around a point in set and one
> branch sets all one side to zero and the other branch sets the other side to
> zero.
>
> So in this case you do need the equality constraint.
>
> John Forrest
>
> On 08/05/14 18:50, Miles Lubin wrote:
>>
>> Hi all,
>>
>> I just tried to clean up and test SOS constraints in the new C
>> interface. My test problem is:
>>
>> Minimize  5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5]
>>       s.t.       x[1] +  x[2] +  x[3] +  x[4] +  x[5] == 1
>>                 All x binary
>>
>> I have not added the equality constraint explicitly to the model, but
>> instead added an SOS 1 constraint. When I solve, the solution is zero,
>> so the SOS 1 constraint doesn't seem to be enforced. Is adding the SOS
>> object to the model sufficient to enforce the constraint, or is it
>> purely for branching?
>>
>> Test code:
>> https://projects.coin-or.org/Cbc/browser/trunk/Cbc/test/CInterfaceTest.c?rev=2033#L113
>> Implementation of Cbc_addSOS in the C interface:
>>
>> https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/Cbc_C_Interface.cpp#L827
>>
>> Thanks,
>> Miles


More information about the Cbc mailing list