Pyomo + Couenne: Infeasibility produces noisy warnings!

106 views
Skip to first unread message

sascha...@gmail.com

unread,
Dec 3, 2015, 2:26:20 PM12/3/15
to Pyomo Forum
Hi,

when using pyomo and couenne, infeasibility of the instance results in a warning, which is printed to the console.
This is a bit noisy and wasn't what i expected.

My usage looks to be conform to the documentation: create solver, create model, add vars, add constraints and run solver.opt(instance). The warning is printed before one could check the status.

A small code example:

from pyomo.environ import *

opt = SolverFactory('couenne')
m = ConcreteModel()

m.A = Var(range(10), domain=Boolean)
m.B = Var(range(10), domain=Boolean)


def c0_rule(m):
    return m.A[0] + m.B[0] >= 3
m.c0 = Constraint(rule=c0_rule)

results = opt.solve(m)

print('...printed after warning')

 
1. The usage is ok, right?
2. Is this intended?
3. If it is intended, is there any (non-ugly; e.g. filtering of stdout) workaround? It looks, that pyomo is to blame, so that there is nothing to do about setting couenne-parameters.

Thanks,
Sascha

Gabriel Hackebeil

unread,
Dec 3, 2015, 2:32:59 PM12/3/15
to pyomo...@googlegroups.com
If you pass “load_solutions=False” to the solve() method then the solution part of the results object will not be loaded into the model. You can do something like:

from pyomo.opt import TerminationCondition
...
results = opt.solve(model, load_solutions=False)
if results.solver.termination_condition == TerminationCondition.optimal:
model.solutions.load_from(results)
else:

Gabe

--
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.
For more options, visit https://groups.google.com/d/optout.

sascha...@gmail.com

unread,
Dec 7, 2015, 9:08:03 AM12/7/15
to Pyomo Forum
Thanks! That's exactly what i needed.

I searched the docs, but i think this method of calling is not mentioned at all. Maybe this should be added.

-
Sascha
Reply all
Reply to author
Forward
0 new messages