Alamo Six Hump Camel¶

In [1]:
from idaes.surrogate import alamopy
import examples
import pyomo.environ as pyo
from pyutilib.common 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.45394981695178083670497E-016 * x2 + 3.9999999999999982236432 * x1^2 - 3.9999999999999964472863 * x2^2 - 2.0999999999999983124610 * x1^4 + 3.9999999999999960031971 * x2^4 + 0.33333333333333292625156 * x1^6 + 1.0000000000000017763568 * 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: -1e+51 Upper bound: -1.03162845349 Number of objectives: 1 Number of constraints: 1 Number of variables: 3 Sense: unknown Solver: - Status: ok Termination condition: unknown Error rc: 0 Time: 0.26517200469970703 Solution: - number of solutions: 0 number of solutions displayed: 0
In [ ]: