Unless you have some very special situation, the best way to take advantage
of SOS2 is to use AMPL's piecewise-linear notation, which is automatically
converted to employ the SOS2 mechanism where appropriate.
Bob Fourer
4...@ampl.com
var Buy {f in FOODS} in {0,10,30,45,55};
If you are using CPLEX then the appropriate SOS1 representation will be
automatically generated from this declaration and you won't have to send any
specific SOS1 information yourself. I believe it works the same with
Gurobi.
It is possible to specify SOS1 variables and corresponding "reference rows"
explicitly using AMPL suffixes, as described in the solver documentation.
However this requires some study to understand whether SOS1 is appropriate
and how to apply it, and I don't recommend going to that trouble unless you
are having serious problems getting the solver to return a solution.
When a SOS of type 1 is used to model a variable that must take a value from
some arbitrary finite set, the reference values are the values in that set.
When a SOS of type 2 is used to model a piecewise-linear function of a
variable, the reference values are the breakpoints of the piecewise-linear
function.
If you look back at the original paper on the subject, which you can find at
www.thetomlins.org/sos.pdf, you will see that these are the modeling
situations that SOS1 and SOS2 were primarily intended for. Thus AMPL was
designed to express these situations naturally in terms of the original
variables, with the auxiliary SOS variables, reference values, etc. being
set up automatically behind the scenes. If you want to use SOS1 or SOS2 for
other situations, by setting them up explicitly using .sosno and .ref
suffixes, then you need to determine on your own what reference values to
specify in order to get the best performance for your problems.
Bob Fourer
4...@ampl.com
> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com]
> On Behalf Of Paul
> Sent: Tuesday, October 12, 2010 3:02 PM
> To: AMPL Modeling Language
> --
> You received this message because you are subscribed to the Google
> Groups "AMPL Modeling Language" group.
> To post to this group, send email to am...@googlegroups.com.
> To unsubscribe from this group, send email to
> ampl+uns...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en.