optimization_history module

Provide functions to study optimization history.

load(folder, flag_constraints=False)[source]

Load the three optimization history files in folder.

Parameters:
  • folder (Path)

  • flag_constraints (bool, default: False)

Return type:

tuple[DataFrame, DataFrame, DataFrame]

get_optimization_objective_names(objectives)[source]

Separate data from Objective and from SimulationOutput.

We expect that objectives have a | in their name, simulation outputs do not.

Parameters:

objectives (DataFrame)

Return type:

tuple[list[str], list[str]]

add_objective_norm(objectives, opti_cols, norm_name='Objectives norm')[source]

Compute norm of objectives and add it to the df.

Parameters:
Return type:

tuple[DataFrame, list[str]]

plot_optimization_objectives(objectives, opti_cols, subplots=False, logy=None, **kwargs)[source]

Plot evolution of optimization objectives.

Parameters:
Return type:

Axis | ndarray

_extract_qty_nature(column_name)[source]

Get the quantity that is stored in the column column_name.

It is expected that the header of the column is qty @ position.

Parameters:

column_name (str)

Return type:

str

_extract_qty_pos(column_name)[source]

Get where was evaluated what is stored in the column column_name.

It is expected that the header of the column is qty @ position.

Parameters:

column_name (str)

Return type:

str

_post_treat(df, post_treat=None, make_absolute=False)[source]

Post-treat the SimulationOutput data.

Parameters:
  • df (DataFrame)

  • post_treat (Literal['relative difference', 'difference'] | None, default: None)

  • make_absolute (bool, default: False)

Return type:

tuple[DataFrame, str]

plot_simulation_outputs(objectives, simulation_output_cols, subplots=False, logy=None, post_treat=None, **kwargs)[source]

Plot evolution of additional objectives.

Parameters:
Return type:

Axis | ndarray | list

identify_pareto(df, objectives)[source]

Get the Pareto front.

Parameters:
Return type:

DataFrame

plot_solutions_3d(df, objective_names, pareto)[source]

Represent the solutions in 3d.

Parameters:
Return type:

None

main(folder, plot_objectives=True, plot_objective_norm=True, plot_so=False, plot_objectives_3d=True)[source]

Provide an example of complete study.

Parameters:
  • folder (Path)

  • plot_objectives (bool, default: True)

  • plot_objective_norm (bool, default: True)

  • plot_so (bool, default: False)

  • plot_objectives_3d (bool, default: True)

Return type:

DataFrame