Logging#
[1]:
import numpy as np
from matplotlib import pyplot as plt
from smt_optim.benchmarks.registry import get_problem
from smt_optim.core import Driver, ObjectiveConfig, ConstraintConfig, DriverConfig, Problem
from smt_optim.surrogate_models.smt import SmtAutoModel
from smt_optim.acquisition_strategies import MFSEGO
[2]:
problem = get_problem("Branin1")
obj_config = ObjectiveConfig(
objective=[problem.objective[-1]],
type="minimize",
surrogate=SmtAutoModel, # set which GP to model the objective
)
prob_definition = Problem(
obj_configs=[obj_config],
design_space=problem.bounds
)
Verbose#
[3]:
driver_config = DriverConfig(
max_iter = 10, # stopping criterion
nt_init = 5, # number of sample in the initial DoE
scaling = True, # standardize every QoI
seed=42,
verbose = True,
)
# configure the optimizer
driver = Driver(prob_definition, driver_config, MFSEGO)
# start optimization
state = driver.optimize()
iter budget fmin fidelity gp_time acq_time
1 6 7.30174e+00 1 0.204 0.296
2 7 7.30174e+00 1 0.315 0.253
3 8 7.30174e+00 1 0.301 0.207
4 9 6.62931e+00 1 0.317 0.348
5 10 4.83559e+00 1 0.332 0.318
6 11 4.83559e+00 1 0.301 0.335
7 12 1.73269e+00 1 0.303 0.453
8 13 1.34048e+00 1 0.326 0.428
9 14 1.07063e+00 1 0.314 0.389
10 15 1.07063e+00 1 0.331 0.411
Logging the DoE#
[4]:
driver_config = DriverConfig(
max_iter = 5, # stopping criterion
nt_init = 5, # number of sample in the initial DoE
scaling = True, # standardize every QoI
seed=42,
verbose = True,
log_doe = True,
)
# configure the optimizer
driver = Driver(prob_definition, driver_config, MFSEGO)
# start optimization
state = driver.optimize()
iter budget fmin fidelity gp_time acq_time
1 6 7.30174e+00 1 0.207 0.327
2 7 7.30174e+00 1 0.355 0.257
3 8 7.30174e+00 1 0.323 0.229
4 9 6.62931e+00 1 0.322 0.390
5 10 4.83559e+00 1 0.348 0.304
Logging statistics#
[5]:
driver_config = DriverConfig(
max_iter = 5, # stopping criterion
nt_init = 5, # number of sample in the initial DoE
scaling = True, # standardize every QoI
seed=42,
verbose = True,
log_doe = True,
log_stats = True,
)
# configure the optimizer
driver = Driver(prob_definition, driver_config, MFSEGO)
# start optimization
state = driver.optimize()
iter budget fmin fidelity gp_time acq_time
1 6 7.30174e+00 1 0.207 0.293
2 7 7.30174e+00 1 0.319 0.260
3 8 7.30174e+00 1 0.308 0.208
4 9 6.62931e+00 1 0.316 0.282
5 10 4.83559e+00 1 0.321 0.353