Gurobi for quadratcally constraints programming

394 views
Skip to first unread message

Enquiring Mind

unread,
Sep 29, 2017, 6:09:47 PM9/29/17
to Pyomo Forum
Hello,

I have a quadratically constrained program that I am trying to solve with gurobi
My quadratic constraint looks like this:

def loss_rule(model, t, b):
return model.losses[t, b] == b.pcu * ((model.power[t, b] / b.rating) ** 2)

model.loss_calc = pyomo.Constraint(model.IDX_time,
model.IDX_buses,
rule=loss_rule,
doc='Loss calculation')

However, I am getting an error:

pyutilib.common._exceptions.ApplicationError: Solver (gurobi) did not exit normally
ERROR: "[base]\site-packages\pyomo\opt\base\solvers.py", 599, solve
Solver (gurobi) returned non-zero return code (1)
ERROR: "[base]\site-packages\pyomo\opt\base\solvers.py", 602, solve
See the solver log above for diagnostic information.
Process finished with exit code 1


and when I check the log, there is no useful info:


Gurobi 7.5.1 (win64, Python) logging started 09/29/17 22:51:06

Academic license - for non-commercial use only
Read LP format model from file c:\users\ik\appdata\local\temp\tmpsbvhgp.pyomo.lp
Reading time = 0.00 seconds
x121: 145 rows, 121 columns, 193 nonzeros
Optimize a model with 145 rows, 121 columns and 193 nonzeros
Model has 48 quadratic constraints
Coefficient statistics:
  Matrix range     [1e+00, 1e+00]
  QMatrix range    [1e-05, 1e-05]
  QLMatrix range   [1e+00, 1e+00]
  Objective range  [1e+01, 1e+01]
  Bounds range     [0e+00, 0e+00]
  RHS range        [1e+00, 1e+03]
Presolve removed 97 rows and 25 columns

Gurobi 7.5.1 (win64, Python) logging started 09/29/17 23:02:28

Academic license - for non-commercial use only
Read LP format model from file c:\users\ik\appdata\local\temp\tmpnidjxg.pyomo.lp
Reading time = 0.00 seconds
x121: 145 rows, 121 columns, 193 nonzeros
Optimize a model with 145 rows, 121 columns and 193 nonzeros
Model has 48 quadratic constraints
Coefficient statistics:
  Matrix range     [1e+00, 1e+00]
  QMatrix range    [1e-05, 1e-05]
  QLMatrix range   [1e+00, 1e+00]
  Objective range  [1e+01, 1e+01]
  Bounds range     [0e+00, 0e+00]
  RHS range        [1e+00, 1e+03]
Presolve removed 97 rows and 25 columns

Note that if I replace the remove the " ** 2 " the  model works perfectly fine. Please help me troubleshoot this problem. I thought that Gurobi should be capable of solving QCPs.
Thanks

David Woodruff

unread,
Sep 29, 2017, 6:14:51 PM9/29/17
to pyomo...@googlegroups.com
Gurobi does not support quadratic constraints.

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Laird, Carl Damon

unread,
Sep 30, 2017, 7:52:56 AM9/30/17
to pyomo...@googlegroups.com

Gurobi does support some forms of quadratic constraints (we have used it to solve MISOCP problems). I would look at their documentation.

 

 

On a separate note, in the code below, it looks like “b” is an index (from IDX_buses), but it also has data (b.pcu, b.rating). Are the indices actually hashable objects containing this data, or is something else going on?

--

To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

 

--

You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.

Enquiring Mind

unread,
Sep 30, 2017, 8:04:36 AM9/30/17
to Pyomo Forum
I also thought that Gurobi supports quadratic constraints as mentioned in their website (http://www.gurobi.com/products/gurobi-optimizer) but I have not been able to make it work. 
Maybe I have failed to initialize something? any pointers would be very useful.

IDX_buses is defined as a set containing a list of Bus objects (see code below). 
As such, b refers to a Bus object which has fileds like b.pcu, b.rating etc. 
This setup is working for me quite well at the moment; is this a practice to avoid?

model.IDX_buses = pyomo.Set(initialize=[bus for bus in caseStudy.network.buses])

Michael Bynum

unread,
Sep 30, 2017, 11:41:10 AM9/30/17
to pyomo...@googlegroups.com
Gurobi supports convex quadratic constraints. Quadratic equality constraints are not convex.

Michael

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.

Maria Marcos Nuñez

unread,
Sep 13, 2018, 7:09:57 AM9/13/18
to Pyomo Forum
Hi,

I got the same problem. Did you find a solution?

Bynum, Michael Lee

unread,
Sep 13, 2018, 7:47:36 AM9/13/18
to pyomo...@googlegroups.com
Gurobi solves convex QCPs. Quadratic equality constraints are not convex.

Michael

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages