core module¶
Scalable module from Tedford and Martins (2010)¶
The modules located in the scalable_tm directory offer a set of classes relative to the scalable problem introduced in the paper:
Tedford NP, Martins JRRA (2010), Benchmarking multidisciplinary design optimization algorithms, Optimization and Engineering, 11(1):159183.
Overview¶
This scalable problem aims to minimize an objective function quadratically depending on shared design parameters and coupling variables, under inequality constraints linearly depending on these coupling variables.
System discipline¶
A system discipline computes the constraints and the objective in function of the shared design parameters and coupling variables.
Strongly coupled disciplines¶
The coupling variables are the outputs of strongly coupled disciplines.
Each strongly coupled discipline computes a set of coupling variables linearly depending on local design parameters, shared design parameters, coupling variables from other strongly coupled disciplines, and belonging to the unit hypercube.
Scalability¶
This problem is said “scalable” because several sizing features can be chosen by the user:
the number of local design parameters for each discipline,
the number of shared design parameters,
the number of coupling variables for each discipline,
the number of disciplines.
A given sizing configuration is called “scaling strategy” and this scalable module is particularly useful to compare different MDO formulations with respect to the scaling strategy.
Implementation¶
The scalable problem¶
The TMScalableProblem
class instantiates the disciplines of the
problem, that are TMSystem
and several TMDiscipline
,
as well as the TMDesignSpace
.
These instantiated objects can be used in a Scenario
,
e.g. MDOScenario
or DOEScenario
.
The scalable study¶
The TMScalableStudy
class instantiates a TMScalableProblem
for a particular scaling strategy
where the number of local design parameters is the same for all disciplines
as well as the number of coupling variables.
It provides a method to run MDO formulations and graphical capabilities
to analyze the results.
The parametric scalable study¶
The TMParamSS
class instantiates several TMScalableStudy
associated with different scaling strategies, e.g. different numbers of local
design parameters or different numbers of coupling variables.
It provides a method to run MDO formulations and save results on the disk.
The TMParamSSPost
provides graphical capabilities to postprocess
these saved results.

class
gemseo.problems.scalable.scalable_tm.core.
TMParamSS
(n_disciplines, n_shared, n_local, n_coupling, fully_coupled=True, active_probability=0.1, feasibility_level=0.8, seed=1, directory='results')[source]¶ Bases:
object
This scalable parametric study realizes scalable studies with different scaling strategies. E.g. comparison of MDF and IDF formulations in terms of execution time for different number of coupling variables.
The TMParamSS constructor depends on:
the number of disciplines,
the number of shared design parameters,
the number of local design parameters for each discipline,
the number of coupling variables for each each discipline.
One of the three latter should be a list of integers whose components define scaling strategies.
The constructor instantiates as many TMScalableStudy as scaling strategies.
 Parameters
n_disciplines (int) – number of disciplines.
n_shared – (list of) number(s) of shared design parameters.
n_local – (list of) number(s) of local design parameters for each discipline.
n_coupling – (list of) number(s) of coupling parameters for each discipline.
fully_coupled (bool) – fully couple the disciplines, ie each TMDiscipline depends on each other. Default: True.
active_probability (float) – active probability
feasibility_level (float) – level of feasibility
seed (int) – seed for replicability.
directory (str) – directory to store results
See also
TMScalableStudy
standard scalable study launched with different configurations in the case of parametric scalable study.

run_formulation
(formulation, max_iter=100, post_coupling=True, post_optim=True, post_coeff=True, algo='NLOPT_SLSQP', algo_options={'eq_tolerance': 0.001, 'ftol_abs': 0.0001, 'ftol_rel': 0.0001, 'ineq_tolerance': 0.001, 'xtol_abs': 0.0001, 'xtol_rel': 0.0001})[source]¶  This method solves the scalable problems with a particular
MDO formulation.
 Parameters
formulation (str) – MDO formulation name
max_iter (int) – maximum number of iterations
post_coupling (bool) – store coupling plots
post_optim (bool) – store optimization plots
post_coeff (bool) – store coefficients plots
algo – algorithm name to solve the problem
algo_options – inequality and equality tolerance, xtol etc..

class
gemseo.problems.scalable.scalable_tm.core.
TMParamSSPost
(file_path)[source]¶ Bases:
object
This class is dedicated to the posttreatment of TMParamSS results.
The constructor reads data stored in a pickle file.
 Parameters
file_path (str) – file path where data are stored.

plot
(title='A scalable comparison of MDO formulations', save=False, show=True, file_path='comparison.pdf')[source]¶ Plot one line per MDO formulation where the yaxis represents the execution time and the xaxis the scaling strategies.
 Parameters
title (str) – title of the figure. Default: ‘A scalable comparison of MDO formulations’.
save (bool) – save the plot. Default: False.
show (bool) – show the plot. Default: True.
file_path (str) – file path to store the figure. Default: ‘comparison.pdf’.

class
gemseo.problems.scalable.scalable_tm.core.
TMScalableProblem
(n_shared=1, n_local=None, n_coupling=None, fully_coupled=True, seed=1)[source]¶ Bases:
object
The scalable problem from Tedford and Martins, 2010, builds a list of strongly coupled scalable disciplines completed by a system discipline computing the objective function and the constraints. These disciplines are defined on an unit design space (parameters comprised in [0, 1]).
The TMScalableProblem constructor depends on:
the number of shared design parameters,
the number of local design parameters for each discipline,
the number of coupling variables for each each discipline.
The two latter variables must be list of integers with the same length which corresponds to the number of strongly coupled disciplines.
 Parameters
n_shared (int) – size of the shared design parameters. Default: 1.
n_local (list(int)) – sizes of the local design parameters. If None, use [1, 1]. Default: None.
n_coupling (list(int)) – sizes of the coupling parameters. If None, use [1, 1]. Default: None.
fully_coupled (bool) – fully couple the disciplines, ie each TMDiscipline depends on each other. Default: True.
seed (int) – seed for replicability.
See also
TMDesignSpace
Full unit design space.
TMSystem
System discipline computing objective and constraints.
TMDiscipline
Strongly coupled discipline computing coupling variables.

get_default_inputs
(names=None)[source]¶ Get default input values.
 Parameters
names (str) – names of the inputs.
 Returns
name and values of the inputs.
 Return type
dict

class
gemseo.problems.scalable.scalable_tm.core.
TMScalableStudy
(n_disciplines, n_shared, n_local, n_coupling, fully_coupled=True, active_probability=0.1, feasibility_level=0.8, seed=1, directory='results')[source]¶ Bases:
object
This scalable study creates a scalable MDO problem from Tedford and Martins, 2010 and compares its resolution according to different MDO formulations.
The TMScalableStudy constructor depends on:
the number of disciplines,
the number of shared design parameters,
the number of local design parameters for each discipline,
the number of coupling variables for each each discipline.
 Parameters
n_disciplines (int) – number of disciplines.
n_shared (int) – number of shared design parameters.
n_local (int) – number of local design parameters for each discipline.
n_coupling (int) – number of coupling parameters for each discipline.
fully_coupled (bool) – fully couple the disciplines, ie each TMDiscipline depends on each other. Default: True.
active_probability (float) – active probability
feasibility_level (float) – level of feasibility
directory (str) – directory to store results
seed (int) – seed for replicability.
See also
TMScalableProblem
Scalable problem managed by the scalable study and providing both disciplines and design space.

property
formulations
¶ Names of the MDO formulations.
 Returns
list of MDO formulations names
 Return type
list(str)

plot_exec_time
(show=True, save=False, file_path='exec_time.pdf')[source]¶ Barplot of the execution time of the different disciplines for the different formulations. When the formulation is based on a MDA, the MDO scenario is detailed in terms of MDA, MDO chain and subMDA.

run_formulation
(formulation, max_iter=100, post_coupling=True, post_optim=True, post_coeff=True, algo='NLOPT_SLSQP', algo_options={'eq_tolerance': 0.001, 'ftol_abs': 0.0001, 'ftol_rel': 0.0001, 'ineq_tolerance': 0.001, 'xtol_abs': 0.0001, 'xtol_rel': 0.0001})[source]¶  This method solves the scalable problem with a particular
MDO formulation.
 Parameters
formulation (str) – MDO formulation name
max_iter (int) – maximum number of iterations
post_coupling (bool) – store coupling plots
post_optim (bool) – store optimization plots
post_coeff (bool) – store coefficients plots
algo – algorithm name to solve the problem
algo_options – inequality and equality tolerance, xtol etc..

gemseo.problems.scalable.scalable_tm.core.
get_constraint_name
(index)[source]¶ Returns the name of the constraint associated with an index.
 Parameters
index (int) – index.

gemseo.problems.scalable.scalable_tm.core.
get_coupling_name
(index)[source]¶ Returns the name of the coupling variable associated with an index.
 Parameters
index (int) – index.

gemseo.problems.scalable.scalable_tm.core.
get_x_local_name
(index)[source]¶ Returns the name of the local design parameter associated with an index.
 Parameters
index (int) – index.

gemseo.problems.scalable.scalable_tm.core.
mkdir
(dirname, subdirname=None)[source]¶ Create a directory if not exists.
 Parameters
dirname (str) – name of the directory.
subdirname (str) – name of the subdirectory. If None, only considers the directory. Default: None.

gemseo.problems.scalable.scalable_tm.core.
npseed
()¶ seed(self, seed=None)
Reseed a legacy MT19937 BitGenerator
Notes
This is a convenience, legacy function.
The best practice is to not reseed a BitGenerator, rather to recreate a new one. This method is here for legacy reasons. This example demonstrates best practice.
>>> from numpy.random import MT19937 >>> from numpy.random import RandomState, SeedSequence >>> rs = RandomState(MT19937(SeedSequence(123456789))) # Later, you want to restart the stream >>> rs = RandomState(MT19937(SeedSequence(987654321)))

gemseo.problems.scalable.scalable_tm.core.
rand
(d0, d1, ..., dn)¶ Random values in a given shape.
Note
This is a convenience function for users porting code from Matlab, and wraps random_sample. That function takes a tuple to specify the size of the output, which is consistent with other NumPy functions like numpy.zeros and numpy.ones.
Create an array of the given shape and populate it with random samples from a uniform distribution over
[0, 1)
. Parameters
d0 (int, optional) – The dimensions of the returned array, must be nonnegative. If no argument is given a single Python float is returned.
d1 (int, optional) – The dimensions of the returned array, must be nonnegative. If no argument is given a single Python float is returned.
.. (int, optional) – The dimensions of the returned array, must be nonnegative. If no argument is given a single Python float is returned.
dn (int, optional) – The dimensions of the returned array, must be nonnegative. If no argument is given a single Python float is returned.
 Returns
out – Random values.
 Return type
ndarray, shape
(d0, d1, ..., dn)
See also
random
Examples
>>> np.random.rand(3,2) array([[ 0.14022471, 0.96360618], #random [ 0.37601032, 0.25528411], #random [ 0.49313049, 0.94909878]]) #random

gemseo.problems.scalable.scalable_tm.core.
save_matrix_plot
(matrix, disc, name, directory='.')[source]¶ Save the graphical representation of a matrix.
 Parameters
matrix (ndarray) – matrix.
disc (str) – discipline name.
name (str) – name of the matrix.
directory (str) – name of the directory to write the file. Default: ‘.’.