How to solve the optimization problem using pyomo.opt

458 views
Skip to first unread message

xiwang...@gmail.com

unread,
Apr 6, 2015, 3:55:26 PM4/6/15
to pyomo...@googlegroups.com
Dear all,
 
I am trying to repeat the pyomo.opt example in section 18.1 of PyomoOnlineDocs, I used the pyomo.opt created the model: RealProblem1:
 
from pyomo.environ import *
import sys
from pyomo.opt.blackbox import RealOptProblem
 
class RealProblem1(RealOptProblem):
 def __init__(self):
  RealOptProblem.__init__(self)
  self.lower=[0.0, -1.0, 1.0, None]
  self.upper=[None, 0.0, 2.0, -1.0]
  self.nvars=4
  
 def function_value(self, point):
  self.validate(point)
  return point.vars[0] - point.vars[1] + (point.vars[2]-1.5)**2 + (point.vars[3]+2)**4
 
But I can I use the solver to solve this problem. Since I did not declare the "model", "objective", when I ran "pyomo solve RealProblem1.py --solver=glpk, there will ba an error: name 'model' is not defined.
 
So I am wandering how can I declare the model, objective and solve the problem using Pyomo.opt.
 
Thanks very much,
 
Xiwang

Patricio Reyes

unread,
Mar 8, 2017, 9:39:14 AM3/8/17
to Pyomo Forum
Hello,

I have the same question...
I can't find a full example using `pyomo.opt.blackbox`. (I already read the [documentation](https://software.sandia.gov/downloads/pub/pyomo/PyomoOnlineDocs.html#_defining_and_optimizing_simple_black_box_applications) but I don't know what are the next steps...)

Do you have more info?

Thanks

Siirola, John D

unread,
Mar 8, 2017, 10:33:49 AM3/8/17
to pyomo...@googlegroups.com

The long and the short of it is that the blackbox functionality is orthogonal to the Pyomo modeling language (it is a holdover from the early days of Coopr).  It was an attempt to make setting up models for use with a specific solver suite (coliny – part of the Acro project) easier by allowing the models to be defined in Python.  pyomo.opt.blackbox is not compatible with the pyomo script, nor with the general solvers that are interfaced through Pyomo.

 

There is some movement in the developer team to extend the current external function interface in Pyomo to support more general blackbox models, however that is in its early stages and will not likely make it into a release until late 2017 at the earliest.

 

john

--
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.

Reply all
Reply to author
Forward
0 new messages