1

I have following code using pyomo in python:

from pyomo.environ import *

mymodel=ConcreteModel()    
var_x = Var([1,2], [0,1,2,3], domain=Reals)
var_y = Var([1,2], [0,1,2,3], domain=Reals)
var_z = Var([0,1,2,3], domain=Reals)
mymodel.q = var_x
mymodel.p = var_y
mymodel.u = var_z

express=(var_z[0] ** 2) + (var_y[1,0] * var_x[2,0]) + (var_y[2,0] * var_x[1,0])

cost_fn = Objective(expr=express)

mymodel.objective=cost_fn
sf = SolverFactory('couenne')
mymodel_results = sf.solve(mymodel)
print mymodel_results

The problem above should be fairly trivial - obvious to get optimal value just set all variables = 0.

But, the couenne solver chokes on it, and prints the same value over and over when solving. When I print mymodel_results this is what I see inside of the Solver log:

ERROR: "[base]/site-packages/pyomo/opt/base/solvers.py", 583, solve
    Solver log:
    Couenne 0.5.6 -- an Open-Source solver for Mixed Integer Nonlinear Optimization
    Mailing list: couenne@list.coin-or.org
    Instructions: http://www.coin-or.org/Couenne

    Couenne: new cutoff value 0.0000000000e+00 (0.005058 seconds)
    NLP0012I 
                  Num      Status      Obj             It       time                 Location
    NLP0014I             1         OPT 0        0 0.000188
    Loaded instance "/var/folders/4f/z25gj3_d29b45_2nx87p8rvr0000gn/T/tmpsL5BN4.pyomo.nl"
    Constraints:            0
    Variables:              5 (0 integer)
    Auxiliaries:            4 (0 integer)

    Coin0506I Presolve 0 (-5) rows, 0 (-9) columns and 0 (-12) elements
    Clp0000I Optimal - objective value -9.99e+12
    Clp0032I Optimal objective -9.99e+12 - 0 iterations time 0.002, Presolve 0.00
    Clp0000I Optimal - objective value -9.99e+12
    NLP Heuristic: NLP0014I             2         OPT 0        0 0.000229
    no solution.
    Clp0000I Optimal - objective value -9.99e+12
    Optimality Based BT: 0 improved bounds
    Probing: 7 improved bounds
    NLP Heuristic: no solution.
    Cbc0013I At root node, 0 cuts changed objective from -9.99e+12 to -9.99e+12 in 1 passes
    Cbc0014I Cut generator 0 (Couenne convexifier cuts) - 0 row cuts average 0.0 elements, 2 column cuts (2 active)
    Cbc0010I After 0 nodes, 1 on tree, 1e+50 best solution, best possible -1.7976931e+308 (0.00 seconds)
    Optimality Based BT: 1 improved bounds
    Cbc0010I After 100 nodes, 50 on tree, 1e+50 best solution, best possible -9.99e+12 (4.52 seconds)
    Cbc0010I After 200 nodes, 100 on tree, 1e+50 best solution, best possible -9.99e+12 (4.53 seconds)

....same thing forever....

    Cbc0010I After 16600 nodes, 105 on tree, 1e+50 best solution, best possible -9.99e+12 (8.51 seconds)

Why is it choking on easy problem?

I know there is a timeout feature How to set Pyomo solver timeout?, but this problem is simple and should not need it. also, problem is easily solved by ipopt, but couenne should handle it as well.

makansij
  • 9,303
  • 37
  • 105
  • 183
  • 1
    You should try to set the timeout using a solver specific option. I assume Couenne has a solver option for this, but you will have to refer to the Couenne documentation for this. Also, Ipopt is designed to provide only locally optimal solutions, so it takes a much different approach to solving a problem than Couenne. – Gabe Hackebeil May 28 '17 at 23:19
  • Thanks what do you mena by "solver specific option"? – makansij May 29 '17 at 02:03
  • 1
    I mean that the option name (if it exists) might change depending on the solver. For instance, Ipopt has an option named "max_cpu_time" that enforces this. You would set it by adding it to the `.options` dictionary on the solver returned from `SolverFactory` (e.g., `sf.options['max_cpu_time'] = 10`). Couenne might use the same option name, if it has one, or something similar. I believe you can pass timelimit as a keyword to the `solve()` method, but it will just do something similar to hitting ctrl-c, which in most cases will just abruptly kill the solver. – Gabe Hackebeil May 29 '17 at 02:10
  • 1
    Using a solver-specific option, like 'max_cpu_time', _might_ allow the solver to return the best feasible solution it has found so far. – Gabe Hackebeil May 29 '17 at 02:12
  • What is the difference between `sf.options['max_cpu_time'] = 10` as you suggest, and your answer [here](https://groups.google.com/forum/#!topic/pyomo-forum/WzP1YwGyunw) to use `opt.options[‘timelimit’] = 1` ? – makansij May 29 '17 at 20:19
  • 1
    The first one is a real option for Ipopt. The second one is a fake option name that I used to show how to set a command-line option using the options dictionary on a solver. – Gabe Hackebeil May 29 '17 at 20:58
  • 1
    @makansij, did you ever find a solution? I'm running into the same issue. – joshwa Nov 22 '20 at 17:20
  • No, I didn't! At least not a satisfactory one. I ended up using ipopt instead. Let me know if you solve it please! – makansij Dec 01 '20 at 18:47

0 Answers0