opt_result module¶
Optimization result.
- class gemseo.algos.opt_result.OptimizationResult(x_0=None, x_opt=None, f_opt=None, status=None, optimizer_name=None, message=None, n_obj_call=None, n_grad_call=None, n_constr_call=None, is_feasible=False, optimum_index=None, constraints_values=None, constraints_grad=None)[source]¶
Bases:
object
The result of an optimization.
- Parameters
x_0 (ndarray | None) –
By default it is set to None.
x_opt (ndarray | None) –
By default it is set to None.
f_opt (ndarray | None) –
By default it is set to None.
status (int | None) –
By default it is set to None.
optimizer_name (str | None) –
By default it is set to None.
message (str | None) –
By default it is set to None.
n_obj_call (int | None) –
By default it is set to None.
n_grad_call (int | None) –
By default it is set to None.
n_constr_call (int | None) –
By default it is set to None.
is_feasible (bool) –
By default it is set to False.
optimum_index (int | None) –
By default it is set to None.
constraints_values (Mapping[str, ndarray] | None) –
By default it is set to None.
constraints_grad (Mapping[str, ndarray] | None) –
By default it is set to None.
- Return type
None
- classmethod from_dict(dict_)[source]¶
Create an optimization result from a dictionary.
- Parameters
dict – The dictionary representation of the optimization result. The keys are the names of the optimization result fields, except for the constraint values and gradients. The value associated with the key
"constr:y"
will be stored inresult.constraints_values["y"]
while the value associated with the key"constr_grad:y"
will be stored inresult.constraints_grad["y"]
.dict_ (Mapping[str, Union[str, int, bool, numpy.ndarray]]) –
- Returns
An optimization result.
- Return type
- to_dict()[source]¶
Convert the optimization result to a dictionary.
The keys are the names of the optimization result fields, except for the constraint values and gradients. The key
"constr:y"
maps toresult.constraints_values["y"]
while"constr_grad:y"
maps toresult.constraints_grad["y"]
.
- constraints_grad: Mapping[str, ndarray] | None = None¶
The values of the gradients of the constraints at the optimum.
- constraints_values: Mapping[str, ndarray] | None = None¶
The values of the constraints at the optimum.