gemseo / problems / scalable / data_driven / study

Hide inherited members

post module

Post-processing for scalability study.

The PostScalabilityStudy class implements the way as the set of ScalabilityResult-based result files contained in the study directory are graphically post-processed. This class provides several methods to easily change graphical properties, notably the plot labels. It also makes it possible to define a cost function per MDO formulation, converting the numbers of executions and linearizations of the different disciplines required by an MDO process in an estimation of the computational cost associated with what would be a scaled version of the true problem.

Warning

Comparing MDO formulations in terms of estimated true computational time rather than CPU time of the ScalabilityStudy is highly recommended. Indeed, time is often an obviousness criterion to distinguish between MDO formulations having the same performance in terms of distance to the optimum: look at our calculation budget and choose the best formulation that satisfies this budget, or even saves us time. Thus, it is important to carefully define these cost functions.

class gemseo.problems.scalable.data_driven.study.post.PostScalabilityStudy(study_directory)[source]

Bases: object

Post-processing of scalability results.

Parameters:

study_directory (str) – The directory of the scalability study.

get_optimization_strategies(unique=False)[source]

Return the names of the optimization strategies.

Parameters:

unique (bool) –

Whether to return unique values. Otherwise, one value per scalability result.

By default it is set to False.

Returns:

The names of the optimization strategies.

Return type:

list[str]

get_replicates(unique=False)[source]

Return the replicate identifiers.

Parameters:

unique (bool) –

Whether to return unique values. Otherwise, one value per scalability result.

By default it is set to False.

Returns:

The names of the replicate identifiers.

Return type:

list[int]

get_scaling_strategies(unique=False)[source]

Return the identifiers of the scaling strategies.

Parameters:

unique (bool) –

Whether to return unique values. Otherwise, one value per scalability result.

By default it is set to False.

Returns:

The names of the scaling strategies.

Return type:

list[int]

labelize_exec_time(description)[source]

Change the description of execution time.

Parameters:

description (str) – The description.

Return type:

None

labelize_is_feasible(description)[source]

Change the description of feasibility.

Parameters:

description (str) – The description.

Return type:

None

labelize_n_calls(description)[source]

Change the description of number of calls.

Parameters:

description (str) – The description.

Return type:

None

labelize_n_calls_linearize(description)[source]

Change the description of number of calls for linearization.

Parameters:

description (str) – The description.

Return type:

None

labelize_original_exec_time(description)[source]

Change the description of original execution time.

Parameters:

description (str) – The description.

Return type:

None

labelize_scaling_strategy(description)[source]

Change the description of scaling strategy.

Parameters:

description (str) – The description.

Return type:

None

labelize_status(description)[source]

Change the description of status.

Parameters:

description (str) – The description.

Return type:

None

plot(legend_loc='upper left', xticks=None, xticks_labels=None, xmargin=0.0, **options)[source]

Plot the results using different methods according to the presence or absence of replicate values.

Parameters:
  • legend_loc (str) –

    The location of the legend.

    By default it is set to “upper left”.

  • xticks (Sequence[float] | None) – The x-ticks.

  • xticks_labels (Sequence[str] | None) – The labels for the x-ticks.

  • xmargin (float) –

    The margin on the left and right sides of the x-axis.

    By default it is set to 0.0.

  • **options (Any) – The options for the specialized plot methods

Return type:

None

set_cost_function(formulation, cost)[source]

Set cost function for each formulation.

Parameters:
  • formulation (str) – The name of the formulation.

  • cost (Callable[[Mapping[str, int], int, int, int, int], float]) – The cost function.

Return type:

None

set_cost_unit(cost_unit)[source]

Set the measurement unit for cost evaluation.

Parameters:

cost_unit (str) – The cost unit, e.g. ‘h’ or ‘min’.

Return type:

None

NOMENCLATURE: ClassVar[dict[str, str]] = {'exec_time': 'Execution time (s)', 'is_feasible': 'Feasibility of the solution (0 or 1)', 'n_calls': 'Number of discipline evaluations', 'n_calls_linearize': 'Number of gradient evaluations', 'original_exec_time': 'Pseudo-original execution time', 'scaling_strategy': 'Scaling strategy index', 'status': 'Optimizatin status', 'total_calls': 'Total number of evaluations'}
property n_samples: int

The number of samples.

property names: list[str]

The names of the scalability results.

property optimization_strategies: list[str]

The names of the optimization strategies.