CoinMP
CoinMP copied to clipboard
Issues using Special Ordered Sets
Issue created by migration from Trac.
Original creator: kurtzb
Original creation time: 2016-04-07 15:53:50
Assignee: somebody
Version:
Keywords: SOS
I seem to be having an issue with Special Ordered Sets of Type 1 and Type 2. When you set up an SOS of Type 1 or Type 2 and one of the variables in the set has a cost in the objective of 0, CoinMP fails to find an optimal solution.
Below are examples model in LP Solve format. (I had to use LP Solve since it appears the output to MPS in CoinMP also does not print the SOS constraint types).
It is possible that the code I am using is doing something incorrect when constructing the model, but it does work when there are all non-zero costs in the objective row.
/*SOS Type 1 Working Model+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Objective function */
min: +C1 +5 C2 +5 C3 +10 C4;
/* Constraints */
R1: +C1 <= 10;
R2: +C2 <= 25;
R3: +C3 <= 25;
R4: +C4 <= 35;
+C1 +C2 +C3 +C4 >= 35;
/* SOS definitions */
SOS
5: C1:0,C2,C3,C4 <= 1:4;
/*SOS Type 1 Non-working Model+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Objective function */
min: +5 C2 +5 C3 +10 C4;
/* Constraints */
R1: +C1 <= 10;
R2: +C2 <= 25;
R3: +C3 <= 25;
R4: +C4 <= 35;
+C1 +C2 +C3 +C4 >= 35;
/* SOS definitions */
SOS
5: C1:0,C2,C3,C4 <= 1:4;
/*SOS Type 2 Working Model+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Objective function */
min: +C1 +C2 +30 C3 +30 C4 +C5 +C6;
/* Constraints */
R1: +C1 <= 30;
R2: +C2 <= 4;
R3: +C3 <= 25;
R4: +C4 <= 10;
R5: +C5 <= 14;
R6: +C6 <= 20;
+C1 +C2 +C3 +C4 +C5 +C6 >= 35;
/* SOS definitions */
SOS
7: C1:0,C2,C3,C4,C5,C6 <= 2:6;
/*SOS Type 2 Non-working Model+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Objective function */
min: +C2 +30 C3 +30 C4 +C5 +C6;
/* Constraints */
R1: +C1 <= 30;
R2: +C2 <= 4;
R3: +C3 <= 25;
R4: +C4 <= 10;
R5: +C5 <= 14;
R6: +C6 <= 20;
+C1 +C2 +C3 +C4 +C5 +C6 >= 35;
/* SOS definitions */
SOS
7: C1:0,C2,C3,C4,C5,C6 <= 2:6;
Thanks!