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: 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.

  • 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.

  • lower_bounds (ndarray | None) – The lower bounds on the design variables. If None, the lower bounds are read from the design space.

  • upper_bounds (ndarray | None) – The upper bounds on the design variables. If None, the upper bounds are read from the design space.

  • initial_point (ndarray | None) – The initial values of the design variables. If None, the initial values are read from the design space.

  • 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.

evaluate(queryx, querymask)[source]

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

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

  • querymask (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