constraints_history module¶
A matrix of constraint history plots.
- class gemseo.post.constraints_history.ConstraintsHistory(opt_problem)[source]¶
Bases:
OptPostProcessor
A matrix of constraint history plots.
A blue line represents the values of a constraint w.r.t. the iterations.
A background color indicates whether the constraint is satisfied (green), active (white) or violated (red).
An horizontal black line indicates the value for which an inequality constraint is active or an equality constraint is satisfied, namely \(0\). An horizontal black dashed line indicates the value below which an inequality constraint is satisfied with a tolerance level, namely \(\varepsilon\).
For an equality constraint, the horizontal dashed black lines indicate the values between which the constraint is satisfied with a tolerance level, namely \(-\varepsilon\) and \(\varepsilon\).
A vertical black line indicates the last iteration (or pseudo-iteration) where the constraint is (or should be) active.
- Parameters:
opt_problem (OptimizationProblem) – The optimization problem to be post-processed.
- Raises:
ValueError – If the JSON grammar file for the options of the post-processor does not exist.
- check_options(**options)¶
Check the options of the post-processor.
- execute(save=True, show=False, file_path=None, directory_path=None, file_name=None, file_extension=None, fig_size=None, **options)¶
Post-process the optimization problem.
- Parameters:
save (bool) –
If
True
, save the figure.By default it is set to True.
show (bool) –
If
True
, display the figure.By default it is set to False.
file_path (str | Path | None) – The path of the file to save the figures. If the extension is missing, use
file_extension
. IfNone
, create a file path fromdirectory_path
,file_name
andfile_extension
.directory_path (str | Path | None) – The path of the directory to save the figures. If
None
, use the current working directory.file_name (str | None) – The name of the file to save the figures. If
None
, use a default one generated by the post-processing.file_extension (str | None) – A file extension, e.g. ‘png’, ‘pdf’, ‘svg’, … If
None
, use a default file extension.fig_size (FigSizeType | None) – The width and height of the figure in inches, e.g.
(w, h)
. IfNone
, use theOptPostProcessor.DEFAULT_FIG_SIZE
of the post-processor.**options (OptPostProcessorOptionType) – The options of the post-processor.
- Returns:
The figures, to be customized if not closed.
- Raises:
ValueError – If the
opt_problem.database
is empty.
- DEFAULT_FIG_SIZE = (11.0, 11.0)¶
The default width and height of the figure, in inches.
- property figures: dict[str, Figure]¶
The Matplotlib figures indexed by a name, or the nameless figure counter.
- materials_for_plotting: dict[Any, Any]¶
The materials to eventually rebuild the plot in another framework.
- opt_problem: OptimizationProblem¶
The optimization problem.