gemseo.algos.optimization_history module#

Optimization history.

class OptimizationHistory(constraints, database, design_space)[source]#

Bases: object

An optimization history.

Parameters:
  • constraints (Constraints) -- The constraints of the optimization problem.

  • database (Database) -- The database of the optimization problem.

  • design_space (DesignSpace) -- The design space.

class Solution(objective, design, is_feasible, constraints, constraint_jacobian)[source]#

Bases: NamedTuple

A solution of the problem.

Create new instance of Solution(objective, design, is_feasible, constraints, constraint_jacobian)

Parameters:
constraint_jacobian: dict[str, ndarray[Any, dtype[floating[Any]]]]#

The Jacobian matrices of the constraints.

constraints: dict[str, ndarray[Any, dtype[floating[Any]]]]#

The values of the constraints.

design: ndarray[Any, dtype[floating[Any]]]#

The value of the design vector.

is_feasible: bool#

Whether the solution is feasible.

objective: float | ndarray[Any, dtype[floating[Any]]]#

The value of the objective.

check_design_point_is_feasible(x_vect)[source]#

Check if a design point is feasible and measure its constraint violation.

The constraint violation measure at a design point \(x\) is

\[\lVert\max(g(x)-\varepsilon_{\text{ineq}},0)\rVert_2^2 +\lVert|\max(|h(x)|-\varepsilon_{\text{eq}},0)\rVert_2^2\]

where \(\|.\|_2\) is the Euclidean norm, \(g(x)\) is the inequality constraint vector, \(h(x)\) is the equality constraint vector, \(\varepsilon_{\text{ineq}}\) is the tolerance for the inequality constraints and \(\varepsilon_{\text{eq}}\) is the tolerance for the equality constraints.

If the design point is feasible, the constraint violation measure is 0.

Parameters:

x_vect (ndarray[Any, dtype[floating[Any]]]) -- The design point \(x\).

Returns:

Whether the design point is feasible, and its constraint violation measure.

Raises:

ValueError -- When the database is empty.

Return type:

tuple[bool, float]

get_data_by_names(names, as_dict=True, filter_non_feasible=False)[source]#

Return the data for specific names of variables.

Parameters:
  • names (str | Iterable[str]) -- The names of the variables.

  • as_dict (bool) --

    If True, return values as dictionary.

    By default it is set to True.

  • filter_non_feasible (bool) --

    If True, remove the non-feasible points from the data.

    By default it is set to False.

Returns:

The data related to the variables.

Raises:

ValueError -- When the database is empty.

Return type:

RealArray | dict[str, RealArray]

property feasible_points: tuple[list[ndarray[Any, dtype[inexact[Any]]]], list[dict[str, float | list[int]]]]#

The feasible points within a given tolerance.

This tolerance is defined by OptimizationProblem.tolerances.equality for equality constraints and OptimizationProblem.tolerances.inequality for inequality ones.

Raises:

ValueError -- When the database is empty.

property last_point: Solution#

The last point.

The last point is defined by:

  • the value of the objective function,

  • the value of the design variables,

  • the indicator of feasibility of the last point,

  • the value of the constraints,

  • the value of the gradients of the constraints.

Raises:

ValueError -- When the database is empty.

objective_name: str#

The name of the objective.

property optimum: Solution#

The optimum solution within a given feasibility tolerance.

This solution is defined by:

  • the value of the objective function,

  • the value of the design variables,

  • the indicator of feasibility of the optimal solution,

  • the value of the constraints,

  • the value of the gradients of the constraints.

Raises:

ValueError -- When the database is empty.