gemseo / algos / opt / core

pseven_problem_adapter module

An adapter from .OptimizationProblem to a pSeven ProblemGeneric.

class gemseo.algos.opt.core.pseven_problem_adapter.PSevenProblem(*args, **kwargs)[source]

Bases: da.p7core.gtopt.ProblemGeneric

Adapter of OptimizationProblem to da.p7core.gtopt.ProblemGeneric.

The methods prepare_problem() and evaluate() are defined according to pSeven’s requirements. Refer to the API documentation of pSeven Core for more information.

Parameters
  • problem (OptimizationProblem) – The optimization problem to be adapted to pSeven.

  • evaluation_cost_type (str | Mapping[str, str] | None) –

    The evaluation cost type of each function of the problem: “Cheap” or “Expensive”. If a string, then the same cost type is set for all the functions. If None, the evaluation cost types are set by pSeven.

    By default it is set to None.

  • expensive_evaluations (Mapping[str, int] | None) –

    The maximal number of expensive evaluations for each function of the problem. If None, this number is set automatically by pSeven.

    By default it is set to None.

  • lower_bounds (ndarray | None) –

    The lower bounds on the design variables. If None, the lower bounds are read from the design space.

    By default it is set to None.

  • upper_bounds (ndarray | None) –

    The upper bounds on the design variables. If None, the upper bounds are read from the design space.

    By default it is set to None.

  • initial_point (ndarray | None) –

    The initial values of the design variables. If None, the initial values are read from the design space.

    By default it is set to None.

  • use_gradient (bool) –

    Whether to use the derivatives of the functions. If the functions have no derivative then this value has no effect.

    By default it is set to True.

Return type

None

evaluate(queryx, querymask)[source]

Compute the values of the objectives and the constraints for pSeven.

Parameters
  • queryx (numpy.ndarray) – The points to evaluate. (2D-array where each row is a point.)

  • querymask (numpy.ndarray) – The evaluation request mask.

Returns

The evaluation result. (2D-array-like with one row per point.), The evaluation masks. (Idem.)

Return type

tuple[list[list[float]], list[numpy.ndarray]]

prepare_problem()[source]

Initialize the problem for pSeven.

Return type

None