Objective function contains square roots_how to set up objective?

922 views
Skip to first unread message

Claire

unread,
Jul 1, 2016, 9:33:34 AM7/1/16
to Gurobi Optimization
Hi there,


I am programming using Python API with Gurobi.  My objective function contains square root as below.... how should I set up the objective function?  I tried to use square root in python but it always shows errors "unsupported operand type(s) for ** or pow(): 'gurobipy.LinExpr' and 'float'".

x(i) and y(i) are variables, while C(i) and T(i) are given.


Thanks a lot
GSM_trail 2.py
Auto Generated Inline Image 1

Tobias Achterberg

unread,
Jul 11, 2016, 9:43:11 AM7/11/16
to gur...@googlegroups.com
For n=1 you could just minimize or maximize the square of your objective
function, which yields a linear function that is supported by Gurobi. For n >=
2, it is no longer possible to eliminate the square root functions that easily.

Since Gurobi can only handle linear, (convex) quadratic, and piece-wise linear
objective functions, you need to cast your model into such form. One possibility
would be to create a piece-wise linear approximation of your objective function
that is sufficiently close to your true objective function within the
interesting regions of the variables' domains.

Regards,

Tobias

Claire

unread,
Jul 20, 2016, 8:38:57 AM7/20/16
to Gurobi Optimization
Hi Tobias,

Thanks a lot for your helps...I will try piece-wise linear approximation..

Regards,
Claire
Reply all
Reply to author
Forward
0 new messages