pseven_problem_adapter module¶
An adapter from .OptimizationProblem to a pSeven ProblemGeneric.
Classes:
|
The evaluation cost type of pSeven functions. |
|
Adapter of OptimizationProblem to da.p7core.gtopt.ProblemGeneric. |
- class gemseo.algos.opt.core.pseven_problem_adapter.CostType(value)[source]¶
Bases:
enum.Enum
The evaluation cost type of pSeven functions.
Attributes:
- CHEAP = 'Cheap'¶
- EXPENSIVE = 'Expensive'¶
- class gemseo.algos.opt.core.pseven_problem_adapter.PSevenProblem(problem, evaluation_cost_type=None, expensive_evaluations=None, lower_bounds=None, upper_bounds=None, initial_point=None)[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 (Optional[Mapping[str, CostType]]) –
The evaluation cost type of each function of the problem. If None, the evaluation cost types default to “Cheap”.
By default it is set to None.
expensive_evaluations (Optional[Mapping[str, int]]) –
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 (Optional[ndarray]) –
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 (Optional[ndarray]) –
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 (Optional[ndarray]) –
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.
- Return type
None
Methods:
evaluate
(queryx, querymask)Compute the values of the objectives and the constraints for pSeven.
Initialize the problem for pSeven.
- 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.)
- Raises
p7core.UserTerminated – If a termination criterion is reached.
- Return type
Tuple[List[List[float]], List[numpy.ndarray]]