How to change the objective function

156 views
Skip to first unread message

mehdi

unread,
Mar 30, 2015, 4:02:25 PM3/30/15
to gur...@googlegroups.com
Hello All

I am new in Gurobi and I have two questions.

1) Assume that we have two variables x and y. I was able to define "xy" using GRBQuadExpr. I was wondering how I can modify this to "(c-xy)^2" and add it to my model. In fact, assume that my objective function is:

 minimize (c-xy)^2

where c is a constant and x and y are variables. I want to implement this in JAVA.

2) How I can define the frobenius norm in Gurobi in java.

Can anybody help me?

Thanks
Best
Mehdi


Sascha S.

unread,
Mar 31, 2015, 1:02:06 PM3/31/15
to gur...@googlegroups.com
The Product Z of two continuous variables X and Y (Z=X*Y) is non-convex in general!
Even if gurobi is accepting this QuadExpr, you might run into the problem of non-convexity ("Q Matrix is not PSD") and gurobi will not solve you problem!
It's sometimes hard to tell, when your model is convex and when it is not. If may depend on the interaction of constraints!
But remember: Z=X*Y is non-convex in general and maybe needs to be linearized.

Frobenius norm:
This might be described by second-order cone constraints but i can't give you some example.

A general advice:
- Read some stuff about Convex Optimization and maybe check out the work on "Disciplined Convex Programming".
- There are even some libraries, supporting Disciplined Convex Programming, which will generate the Frobenius-Norm on some matrix M for you! (but Z=X*Y is still not allowed in DCP!) -> CVX (Matlab), CVXPY (Python), Convex.jl (Julia)

Sascha
Reply all
Reply to author
Forward
0 new messages