Page 1 of 1

### Using SOS type_1 constraint

Posted: Fri Apr 26, 2019 9:23 pm
Dear support team,

I was trying to solve a scheduling model using GAMS/Gurobi. The snippet code is:

Code: Select all

``````Binary variable x(i,k);
Equations c1,c2;
c1(k)..   sum(i, x(i,k)) =e= 1;
c2(i)..   sum(k, x(i,k)) =e= 1;``````
Using the binary variables, the model has solved optimally.
I have used SOS type_1 variables instead of binary variables and run the model.

Code: Select all

``````SOS1 variable x(i,k);
Equations c1,c2;
c1(k)..   sum(i, x(i,k)) =e= 1;
c2(i)..   sum(k, x(i,k)) =e= 1;``````
The model has solved optimally and the results are the same as previous.
AKAIK, the SOS type_1 constraint says that at most one of the variables must be non-zero. the equation is:

Code: Select all

``x1 + x2 + ... + xn <= 1   for n=1...N ``
I'm working on the coding my model in the GUROBI software using Java API. While I have defined the SOS type_1 constraint in the model and run it, I get the zero solution for all assignment variables. I negotiated to GUROBI support team and they mentioned that:
the all-zero solution is feasible.
Would you say that do I have a mistake to implement GAMS code, please?

Regards
Omidi. A

### Re: Using SOS type_1 constraint

Posted: Mon Apr 29, 2019 1:06 pm
Hi,

As explained in the documentation, the right-most index defines the SOS set.
In your case that means x(i,k) defines i special ordered sets with k elements each.
https://www.gams.com/latest/docs/UG_Lan ... eVariables

I hope this helps!

Fred

### Re: Using SOS type_1 constraint

Posted: Tue Apr 30, 2019 10:41 am
Dear Fred,