Alamo Six Hump Camel¶
In [1]:
from idaes.surrogate import alamopy
import examples
import pyomo.environ as pyo
from pyutilib.common import ApplicationError
import camel6
In [2]:
alamo_ran = camel6.main()
Updating number of training points from 10 to 10
Model: {'z1': ' z1 = - 0.14498340626190308193906E-014 * x1 + 0.28519578140053886891354E-014 * x2 + 3.9999999999999955591079 * x1^2 - 3.9999999999999964472863 * x2^2 - 2.0999999999999987565502 * x1^4 + 4.0000000000000044408921 * x2^4 + 0.33333333333333325931847 * x1^6 + 1.0000000000000015543122 * 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)
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.21648550033569336
Solution:
- number of solutions: 1
number of solutions displayed: 1
- Gap: 1e+51
Status: feasible
Message: None
Objective:
obj:
Value: -1.0316284534898725
Variable:
x1:
Value: -0.08984201361113409
x2:
Value: 0.7126564070725505
Constraint: No values
In [ ]: