2

I am currently working on a MIP problem, where I can take advantage of the special ordered sets of type 2 (SOS2).

My problem is, that I have not fully understood such sets. The reason for this, is because of the weightings I have to assign to the variables in my SOS2.

I am not sure what exactly I should I assign. There is a quite clear ordering in my set, but I am not sure what the weightings should be and just assigning 1,2,3 ... n is not correct I think?

So my question is, can somebody explain to me what the weights of the variables in the special ordered sets are and what values they should be assigned?

M.frank
  • 145
  • 2
  • 14

1 Answers1

1

First of all they define an ordering. Especially for SOS2 sets there is the concept of a neighbor: in a SOS2 set only two neighboring variables can be non-negative. Some solvers also use the weights in their branching decision. This can be useful if you have x values like (1,2,3,10000). So consult your solver documentation. In general sos weights should be unique. Using (1,2,3,...) is often a good default, otherwise use something like the x-values (assuming you don't have a segment parallel to the y-axis).

Note that in many cases a formulation with binary variables will outperform a SOS formulation (this is especially the case with high-end solvers that can apply smart cuts on formulations with binary variables). Some solvers will even try automatically to reformulate some SOS sets into a form using binary variables.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Thanks for the answer. The reason for using SOS2 in my case, is that i need the neighboring property. As far as I can read on the net, if you have a natural ordering in your set, then generally SOS will outperform a binary formulation. – M.frank Aug 20 '16 at 07:41
  • I think I don't agree with that statement. For a counter example see [http://yetanothermathprogrammingconsultant.blogspot.com/2015/10/piecewise-linear-functions-in-mip-models.html](http://yetanothermathprogrammingconsultant.blogspot.com/2015/10/piecewise-linear-functions-in-mip-models.html). This is more in line with what we can expect, – Erwin Kalvelagen Aug 20 '16 at 09:02
  • I am using CPLEX as a solver and I agree, different solvers, use different strategies and what happens behind the scenes I do not know. However, according to CPLEX´s website, then my statement should hold: http://www.ibm.com/support/knowledgecenter/SSSA5P_12.2.0/ilog.odms.cplex.help/Content/Optimization/Documentation/CPLEX/_pubskel/CPLEX636.html Even so, I am using the SOS2, more for the neighboring property rather than the (dis)advantages of them. – M.frank Aug 20 '16 at 10:07
  • So weights define an ordering of precedence? But which way around. If the variables have weights 1,2,3; which one does the solver pick to be 1 first? – Ant6n Sep 15 '18 at 19:33
  • No, not in general. In SOS2 we need to know an ordering (SOS2 has the concept of neighbors). Some solvers may use weights for branching. – Erwin Kalvelagen Sep 16 '18 at 07:39