Alamo Six Hump Camel¶
In [1]:
from idaes.surrogate import alamopy
import examples
import pyomo.environ as pyo
from pyomo.common.errors import ApplicationError
from pyomo.opt import SolverStatus, TerminationCondition
import camel6
In [2]:
alamo_ran = camel6.main()
Updating number of training points from 10 to 10
Model: {'z1': ' z1 = 0.74627703323360772280637 * x1^2 + 0.86211045169458799808382 * x1*x2'}
In [3]:
hasBaron = False
try:
solver_opt = pyo.SolverFactory('baron')
hasBaron = solver_opt.available()
except ApplicationError as err:
print("Partial test completed. %s"%err)
if alamo_ran and hasBaron:
model = pyo.ConcreteModel()
opt = pyo.SolverFactory('baron')
model.x1 = pyo.Var()
model.x2 = pyo.Var()
def pyomo_model(model):
import z1
return z1.f(model.x1,model.x2)
model.obj = pyo.Objective(rule = pyomo_model)
results = opt.solve(model)
if ((results.solver.status == SolverStatus.ok) and
(results.solver.termination_condition == TerminationCondition.optimal)):
model.solutions.store_to(results)
print(results)
Problem: - Name: problem Lower bound: -1.10075442002e+51 Upper bound: -1.10075442002e+51 Number of objectives: 1 Number of constraints: 1 Number of variables: 3 Sense: unknown Solver: - Status: ok Termination condition: unbounded Error rc: 0 Time: 0.09022021293640137 Solution: - number of solutions: 0 number of solutions displayed: 0
In [ ]: