Optimizing a Round Down (or floor) Function; or How to tell Gurobi to always round down

499 views
Skip to first unread message

Danny

unread,
Oct 20, 2014, 8:12:54 PM10/20/14
to gur...@googlegroups.com
Hello fellow Gurobi Optimizers,


I have the following Max problem:

----------------------------------------------------------------------------------------
Max f = sum_i( a_i * y_i) problem           ''' a_i all Positive is the parameter and y_i is variable'''
s.t 

constraints on x

constraints on x and z

and the problem making constraints:

y <= (d - t(x,z)) / 4d) + 1     ''' d is a parameter,  and t(x,z) at most can be = 4d '''
----------------------------------------------------------------------------------------

y is NOT a decision variable, z is the decison variable, and x is a function of z, and y is a function of x; y is an indicator variable, I want y to indicate: if t(x,z) > d then set y = 0 else if t(x,z) <= d set y = 1,  

and what y <= (d - t(x,z)) / 4d) + 1 does is :  

(1)  when  t(x,z) <= d  --->   0 < d - t(x,z)) / 4d  < 1  --->  1 <= (d - t(x,z)) / 4d) + 1  < 2

(2) when  t(x,z) > d  --->   d - t(x,z)) / 4d  < 0          --->  0 <  (d - t(x,z)) / 4d) + 1  < 1

The LP relaxation gives the optimal solutions with  y either >= 1  or   y < 1. The point is every feasible solution of the LP relaxation has ONLY ONE corresponding feasible integer solution and that is to always ROUND DOWN on y_values, so that in case (1) y = 1 and in case (2)  y = 0. I could actually represent this in the objective function as:

Max f = sum_i( a_i * ROUNDDOWN(y_i) ) 

So I figured I can get rid of y > 1 ( e.g. y = 1.46) by setting ub = 1 for y. But I don't know how to get rid of y < 1 (e.g. y = 0.35), what if I could tell Gurobi to always Rounddown when branching on a variable? How can I do that? Or should I reformulate or revise my model? Do you think this is the right for what I aim for? 

Thank you very much in advance



Stuart Mitchell

unread,
Oct 21, 2014, 6:12:39 PM10/21/14
to gur...@googlegroups.com
How bout making y a binary variable?

Stu

--

---
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/d/optout.



--
Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

Danny

unread,
Oct 23, 2014, 11:20:21 AM10/23/14
to gur...@googlegroups.com
Thanks Stuart,

y is a binary variable, it is an indicator (0 or 1), but the solver is oddly very slow in solving the problem, even for small problems. 
I am trying to see if I can relax it.
Reply all
Reply to author
Forward
0 new messages