gemseo / problems / scalable / data_driven / study

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 a 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.

Classes:

PostScalabilityStudy(study_directory)

The PostScalabilityStudy class aims to post-process a list of scalability results stored in a directory.

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

Bases: object

The PostScalabilityStudy class aims to post-process a list of scalability results stored in a directory.

Constructor.

Parameters

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

Attributes:

NOMENCLATURE

n_samples

Number of samples.

names

Get the names of the scalability results.

optimization_strategies

Methods:

get_optimization_strategies([unique])

Get the names of the optimization strategies.

get_replicates([unique])

Get the replicate identifiants.

get_scaling_strategies([unique])

Get the identificants of the scaling strategies.

labelize_exec_time(description)

Change the description of execution time, used in plotting methods notably.

labelize_is_feasible(description)

Change the description of feasibility, used in plotting methods notably.

labelize_n_calls(description)

Change the description of number of calls, used in plotting methods notably.

labelize_n_calls_linearize(description)

Change the description of number of calls for linearization, used in plotting methods notably.

labelize_original_exec_time(description)

Change the description of original execution time, used in plotting methods notably.

labelize_scaling_strategy(description)

Change the description of scaling strategy, used in plotting methods notably.

labelize_status(description)

Change the description of status, used in plotting methods notably.

plot([legend_loc, xticks, xticks_labels, ...])

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

set_cost_function(formulation, cost)

Set cost function for each formulation.

set_cost_unit(cost_unit)

Set the measurement unit for cost evaluation.

NOMENCLATURE = {'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'}
get_optimization_strategies(unique=False)[source]

Get the names of the optimization strategies.

Parameters

unique (bool) –

return either unique values if True or one value per scalability result if False (default: False).

By default it is set to False.

Returns

names of the optimization stategies.

Return type

list(str)

get_replicates(unique=False)[source]

Get the replicate identifiants.

Parameters

unique (bool) –

return either unique values if True or one value per scalability result if False (default: False).

By default it is set to False.

Returns

identifiants of replicates.

Return type

list(int)

get_scaling_strategies(unique=False)[source]

Get the identificants of the scaling strategies.

Parameters

unique (bool) –

return either unique values if True or one value per scalability result if False (default: False).

By default it is set to False.

Returns

identifiants of scaling strategies

Return type

list(int)

labelize_exec_time(description)[source]

Change the description of execution time, used in plotting methods notably.

Parameters

description (str) – description.

labelize_is_feasible(description)[source]

Change the description of feasibility, used in plotting methods notably.

Parameters

description (str) – description.

labelize_n_calls(description)[source]

Change the description of number of calls, used in plotting methods notably.

Parameters

description (str) – description.

labelize_n_calls_linearize(description)[source]

Change the description of number of calls for linearization, used in plotting methods notably.

Parameters

description (str) – description.

labelize_original_exec_time(description)[source]

Change the description of original execution time, used in plotting methods notably.

Parameters

description (str) – description.

labelize_scaling_strategy(description)[source]

Change the description of scaling strategy, used in plotting methods notably.

Parameters

description (str) – description.

labelize_status(description)[source]

Change the description of status, used in plotting methods notably.

Parameters

description (str) – description.

property n_samples

Number of samples.

property names

Get the names of the scalability results.

property optimization_strategies
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) –

    legend localization

    By default it is set to upper left.

  • xticks (list(float)) –

    list of xticks (default: None)

    By default it is set to None.

  • xticks_labels (list(str)) –

    list of xticks labels (default: None)

    By default it is set to None.

  • xmargin (float) –

    margin on left and right sides of the x-axis

    By default it is set to 0.0.

  • options – options for the specialized plot methods

set_cost_function(formulation, cost)[source]

Set cost function for each formulation.

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

  • cost (function) – cost function

set_cost_unit(cost_unit)[source]

Set the measurement unit for cost evaluation.

Parameters

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