Objective function lower and upper bounds

676 views
Skip to first unread message

Romain Montagné

unread,
Dec 8, 2014, 6:37:54 PM12/8/14
to pulp-or...@googlegroups.com
Hello,

I would like to know if it is possible to do the following things with PuLp:

1. Give a lower/upper bound to the objective function, but not as an additional constraint (kind of like the fact that we can give lower and upper bounds to the variables beforehand).

2. If we decide to stop the solver before it reaches optimality with the "timeLimit" or "epgap" options, the output is the best integer found. Is it possible to get the best upper bound (if we are maximizing) or best lower bound (if we are minimizing) easily (by get I mean store it in a python variable)?

Thank you very much for your help,

Romain

Stuart Mitchell

unread,
Dec 8, 2014, 6:45:15 PM12/8/14
to pulp-or...@googlegroups.com
Hi if you are using the gurobi or cplex solvers the actual solver model object should be available at

LpProblem.solverModel

Note this object is only created after a call to solve()

Stu

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To post to this group, send email to pulp-or...@googlegroups.com.
Visit this group at http://groups.google.com/group/pulp-or-discuss.
For more options, visit https://groups.google.com/d/optout.



--
Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

Romain Montagné

unread,
Dec 8, 2014, 7:12:00 PM12/8/14
to pulp-or...@googlegroups.com
Thank you. Are there different methods/attributes to this object?
If I do
>>>   print.prob.solverModel
I get <cplex.Cplex object at 0x2de3a10>. How can I work with that?

Thanks

Stuart Mitchell

unread,
Dec 8, 2014, 7:27:52 PM12/8/14
to pulp-or...@googlegroups.com

Refer to the cplex python manual. As this is the native cplex representation of your model.

Romain Montagné

unread,
Dec 9, 2014, 10:39:09 AM12/9/14
to pulp-or...@googlegroups.com
Ok thanks.

prob.solution.MIP.get_best_objective() does the trick if any one else wonders.
Reply all
Reply to author
Forward
0 new messages