<div dir="ltr">Hi John,<div><br></div><div>Just to follow up on this, for</div><div><div>Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5]</div><div> s.t. SOS1(x[1],x[2],x[3],x[4],x[5])</div><div> All x binary</div>
</div><div>Cbc is returning an optimal objective 21. If SOS1 imposes that at most one is nonzero, then I would've expected all x[i] = 0, except for x[4] =1 as the optimal solution. Am I doing something wrong?</div><div>
<br></div><div>You can see the test code here: <a href="https://projects.coin-or.org/Cbc/browser/trunk/Cbc/test/CInterfaceTest.c?rev=2039#L195">https://projects.coin-or.org/Cbc/browser/trunk/Cbc/test/CInterfaceTest.c?rev=2039#L195</a></div>
<div>and the SOS C wrapper here: <a href="https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/Cbc_C_Interface.cpp?rev=2039#L773">https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/Cbc_C_Interface.cpp?rev=2039#L773</a></div>
<div><br></div><div>Thanks,</div><div>Miles</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 9, 2014 at 12:56 PM, Miles Lubin <span dir="ltr"><<a href="mailto:miles.lubin@gmail.com" target="_blank">miles.lubin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<br>
<br>
Thanks for the clarification. When I change the problem sense to<br>
maximize, however, the solution returned is all ones, so the SOS<br>
constraint doesn't seem to be enforced in the way that you described.<br>
It's possible that it's not being added correctly in the C interface,<br>
though.<br>
<br>
Best,<br>
Miles<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, May 9, 2014 at 2:54 AM, John Forrest<br>
<<a href="mailto:john.forrest@fastercoin.com">john.forrest@fastercoin.com</a>> wrote:<br>
> Miles,<br>
><br>
> Definition of SOS type 1 that is used is that at most one in set nonzero.<br>
> If more than one then you create two branches around a point in set and one<br>
> branch sets all one side to zero and the other branch sets the other side to<br>
> zero.<br>
><br>
> So in this case you do need the equality constraint.<br>
><br>
> John Forrest<br>
><br>
> On 08/05/14 18:50, Miles Lubin wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> I just tried to clean up and test SOS constraints in the new C<br>
>> interface. My test problem is:<br>
>><br>
>> Minimize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5]<br>
>> s.t. x[1] + x[2] + x[3] + x[4] + x[5] == 1<br>
>> All x binary<br>
>><br>
>> I have not added the equality constraint explicitly to the model, but<br>
>> instead added an SOS 1 constraint. When I solve, the solution is zero,<br>
>> so the SOS 1 constraint doesn't seem to be enforced. Is adding the SOS<br>
>> object to the model sufficient to enforce the constraint, or is it<br>
>> purely for branching?<br>
>><br>
>> Test code:<br>
>> <a href="https://projects.coin-or.org/Cbc/browser/trunk/Cbc/test/CInterfaceTest.c?rev=2033#L113" target="_blank">https://projects.coin-or.org/Cbc/browser/trunk/Cbc/test/CInterfaceTest.c?rev=2033#L113</a><br>
>> Implementation of Cbc_addSOS in the C interface:<br>
>><br>
>> <a href="https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/Cbc_C_Interface.cpp#L827" target="_blank">https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/Cbc_C_Interface.cpp#L827</a><br>
>><br>
>> Thanks,<br>
>> Miles<br>
</div></div></blockquote></div><br></div>