weights on SOS variables

1,410 views
Skip to first unread message

Nick Rizzolo

unread,
Dec 8, 2010, 2:53:13 PM12/8/10
to Gurobi Optimization
Hi,

I'm a new Gurobi user, and I was glad to see that it supports SOS
variables. My understanding of both types of SOS is that they allow
you to group variables into a sort of mutual exclusion relationship.
So why does Gurobi want weights for these variables, as in
GRBModel.addSOS()? These aren't objective function coefficients, are
they?

Thanks,
- Nick

Ed Rothberg

unread,
Dec 10, 2010, 8:56:41 PM12/10/10
to Gurobi Optimization

An SOS constraint is usually used to represent a piecewise linear
function, y=f(x). The weights are generally used to capture the 'x'
values for the different SOS members. That way, when you do
dichotomous branching on an SOS set in the MIP search (setting all
variables whose weights are either above or below a chosen split point
equal to zero), it corresponds to choosing a sub-range of the
function.

Note that while SOS sets are intuitively quite appealing, our
experience is that an equivalent formulation that uses purely linear
constraints is usually more effective.

Ed

Nicholas Rizzolo

unread,
Dec 11, 2010, 3:03:25 AM12/11/10
to gur...@googlegroups.com
Thanks, Ed. It sounds like I should just use regular linear
constraints as you suggested. But for my own edification, what
happens if I give the same weight to several variables in a set? SOS
type 1 is supposed to mean that at most one variable gets a non-zero
setting. So how are ties broken?

Thanks again,
- Nick

Greg Glockner

unread,
Dec 11, 2010, 9:42:49 AM12/11/10
to gur...@googlegroups.com
The ties are broken in the MIP search. No big deal if you give the same weights to the variables.

Jeff Whittle

unread,
Dec 11, 2010, 8:21:17 PM12/11/10
to Gurobi Optimization
How do you replace an SOS representation of a function equality
constraint with purely linear constraints? I'm not an OR expert, but I
didn't think that was possible.

Ed Rothberg

unread,
Dec 22, 2010, 2:14:53 PM12/22/10
to Gurobi Optimization

If you have an SOS1 on non-negative continuous variables (x1, x2, ...,
xn), with upper bounds (u1, u2, ..., un), the linearized form is:

xi <= ui * bi (bi binary)
sum bi <= 1

If you can derive reasonably small upper bounds for the continuous
variables, this form will typically solve faster than the SOS version.

Ed


Kunal Ghosh

unread,
Dec 24, 2010, 12:07:58 AM12/24/10
to gur...@googlegroups.com
Hi,

Is it possible to call multiple simultaneous gurobi(s) within a single EC2 instance. Will there be any issue of any kind due to shared memory or e.t.c ?

Regards,

Kunal

Greg Glockner

unread,
Dec 24, 2010, 9:41:33 AM12/24/10
to gur...@googlegroups.com
There is no limit on the number of models you can solve within a single EC2 virtual machine (AKA Gurobi Cloud). However, for better performance, you should set the threads parameter for each model so that the total number of concurrent threads is no more than the number of cores on the EC2 virtual machine. (This is also true for traditional computers, provided that you have a license that allows you to solve multiple models simultaneously).

For example, the High-Memory Double Extra Large Instance has four cores, so for best performance the total number of Gurobi threads should be no more than 4 (ex: one model with 2 threads + 2 models with 1 thread).

dips

unread,
Dec 2, 2013, 1:51:10 AM12/2/13
to gur...@googlegroups.com
Dear Ed..
Would you please suggest me how to write equivalent linear formulation for SOS2?

On Friday, June 15, 2012 7:14:42 PM UTC+5:30, dips wrote:

Dear Ed..
I am a new user to gurobi. I will use gurobi only to solve my piecewise linear approximation problem of non linear function.Now as gurobi supports it with SOS2,i will explore it though MATLAB. as you have said SOS sets are intuitively quite appealing, your
experience is that an equivalent formulation that uses purely linear so would you please suggest me some way for equivalent formulation as an alternate of SOS2 constraints.
thanks
constraints is usually more effective. W

Greg Glockner

unread,
Dec 2, 2013, 3:33:20 PM12/2/13
to gur...@googlegroups.com
> Would you please suggest me how to write equivalent linear formulation for SOS2?

This can be automated in version 5.6 and later by setting the parameter PreSOS2BigM.

Dipesh Makwana

unread,
Dec 3, 2013, 12:36:02 AM12/3/13
to gur...@googlegroups.com
Thank you Greg....


On Tue, Dec 3, 2013 at 2:03 AM, Greg Glockner <gloc...@gurobi.com> wrote:
> Would you please suggest me how to write equivalent linear formulation for SOS2?

This can be automated in version 5.6 and later by setting the parameter PreSOS2BigM.

--

---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks and regards,

Dipesh Makwana,
Associate Professor,
G.E.S Class - I,
Vishwakarma Government Engineering College,
Chankheda,
Ahmedabad,
Gujarat, India

Alternately :
Research Scholar (PhD),
Systems and Control Engineering Department,
Indian Institute of Technology-Bombay,
Powai, Mumbai,
Maharashtra, India








Reply all
Reply to author
Forward
0 new messages