smt_optim.utils package#

Submodules#

smt_optim.utils.constraints module#

compute_rscv(cstr_values: ndarray, cstr_configs: list) ndarray[source]#
compute_rscv_sp(x: ndarray, cstr_list: list[dict]) float[source]#

SciPy wrapper to compute the Root Squared Constraint Violation (RSCV).

Parameters:
  • x

  • cstr_list

Returns:

smt_optim.utils.get_fmin module#

get_fmin(f: ndarray, c: ndarray | None = None, c_type: list[str] | None = None, rscv_tol: float = 0.0) float[source]#

smt_optim.utils.initial_design module#

generate_initial_design(state: State, evaluator, config) None[source]#

smt_optim.utils.json module#

json_safe(obj)[source]#

smt_optim.utils.logger module#

class ConsoleLogger(config)[source]#

Bases: object

on_iter_end(state) None[source]#
print_header()[source]#
update_header_format()[source]#
class JsonLogger(config)[source]#

Bases: object

on_iter_end(state) None[source]#
format_value(v, fmt)[source]#

smt_optim.utils.multi_obj module#

class PymooStateWrapper(state, scaled: bool = False, train: bool = True)[source]#

Bases: Problem

bounds()#
do(X, return_values_of, *args, **kwargs)#
evaluate(X, *args, return_values_of=None, return_as_dictionary=False, **kwargs)#
has_bounds()#
has_constraints()#
ideal_point(*args, use_cache=True, set_cache=True, **kwargs)#
property n_constr#
nadir_point(*args, use_cache=True, set_cache=True, **kwargs)#
name()#
pareto_front(*args, use_cache=True, set_cache=True, **kwargs)#
pareto_set(*args, use_cache=True, set_cache=True, **kwargs)#
get_pareto_front(Y: ndarray) ndarray[source]#

Return the non-dominated objective vectors from Y.

Parameters:

Y (np.ndarray) – Array of shape (n_samples, n_objectives) containing objective values for each sample.

Returns:

Array of shape (n_pareto, n_objectives) containing the non-dominated objective vectors (the Pareto front).

Return type:

np.ndarray

Notes

Assumes a minimization problem for all objectives and no constraints.

get_pareto_mask(Y: ndarray) ndarray[source]#
get_pf_from_dataset(dataset, ctol: float = 0.0001, fid: int = -1, return_dict: bool = False) ndarray | dict[source]#
hypervolume(pf: ndarray, ref: ndarray) float[source]#

Compute the hypervolume indicator of the Pareto front.

Uses the moocore implementation: https://multi-objective.github.io/moocore/python/reference/generated/moocore.hypervolume.html

Parameters:
  • pf (np.ndarray of shape (num_points, 2)) – Pareto front.

  • ref (np.ndarray of shape (2, )) – Reference objective values.

Returns:

  • float – Hypervolume indicator value.

  • Notes – Assume both objective are minimized.

hypervolume_2d(pf: ndarray, ref: ndarray) float[source]#

Compute the 2D hypervolume indicator he hypervolume of the Pareto front.

Parameters:
  • pf (np.ndarray of shape (num_points, 2)) – Pareto front.

  • ref (np.ndarray of shape (2, )) – Reference objective values.

Returns:

  • float – Hypervolume indicator value.

  • Notes – Assume both objective are minimized.

spacing(pf: ndarray) float[source]#

Compute the spacing indicator of the Pareto front (Schott, 1995). A lower value is better.

Parameters:

pf (np.ndarray of shape (num_points, num_objectives)) – Pareto front.

Returns:

  • float – Spacing indicator value.

  • Notes – Assume both objective are minimized.

smt_optim.utils.plot_2d module#

get_plot2d_data(func: Callable, bounds: ndarray, num_points: int = 101) tuple[source]#

smt_optim.utils.stop_criteria module#

check_stop_criteria(state, config) bool[source]#
compute_budget(state) float[source]#

Module contents#