gemseo_pymoo / post

Hide inherited members

compromise module

Compromise points for multi-criteria decision-making.

class gemseo_pymoo.post.compromise.Compromise(opt_problem)[source]

Bases: ScatterPareto

Scatter plot with pareto front and compromise points.

See Compromise Programming.

Note

This post-processor assumes the optimization has converged to a well-defined pareto front.

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.

Parameters:

**options (int | float | str | bool | Sequence[str] | Tuple[float, float]) – The options of the post-processor.

Raises:

InvalidDataError – If an option is invalid according to the grammar.

Return type:

None

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. If None, create a file path from directory_path, file_name and file_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). If None, use the OptPostProcessor.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.

SCALARIZATION_FUNCTIONS: dict[str, str] = {'aasf': 'Augmented Achievement Scalarization Function', 'asf': 'Achievement Scalarization Function', 'pbi': 'PBI', 'perp_dist': 'Perpendicular Distance', 'tchebi': 'Tchebysheff', 'weighted-sum': 'Weighted Sum'}

The alias and the corresponding name of the scalarization functions.

database: Database

The database generated by the optimization problem.

fig_name_prefix: str = 'compromise'

The figure’s name prefix.

fig_title: str = 'Compromise Points'

The figure’s title.

property figures: dict[str, matplotlib.figure.Figure]

The Matplotlib figures indexed by a name, or the nameless figure counter.

font_size: int = 9

The font size for the plot texts.

materials_for_plotting: dict[Any, Any]

The materials to eventually rebuild the plot in another framework.

opt_problem: OptimizationProblem

The optimization problem.

property output_files: list[str]

The paths to the output files.

prop_annotation: PlotPropertiesType = {'fontsize': 7, 'ha': 'center', 'rotation_mode': 'anchor', 'transform_rotates_text': True, 'va': 'bottom'}

The properties for the annotations.

prop_arrow: PlotPropertiesType = {'alpha': 0.5, 'arrowstyle': '-|>', 'color': 'black', 'mutation_scale': 12}

The properties for the arrows.

prop_extra: PlotPropertiesType = {'alpha': 0.8, 's': 30, 'zorder': 2}

The properties for the extra points.

prop_front: PlotPropertiesType = {'alpha': 0.2, 'color': 'blue', 's': 10, 'zorder': 1}

The properties for the pareto points.

prop_interest: PlotPropertiesType = {'alpha': 1.0, 's': 30, 'zorder': 3}

The properties for the points of interest.