gemseo / problems / scalable / parametric / core

problem module

Scalable problem - Problem

class gemseo.problems.scalable.parametric.core.problem.TMProblem(n_shared=1, n_local=None, n_coupling=None, full_coupling=True, noised_coupling=False, seed=1)[source]

Bases: object

The scalable problem from Tedford and Martins, 2010, builds a list of strongly coupled models (TMSubModel) completed by a main model (TMMainModel) computing the objective function and the constraints.

These disciplines are defined on an unit design space whose parameters comprised in [0, 1] (TMDesignSpace). This problem is defined by the number of shared design parameters, the number of local design parameters per discipline and the number of output coupling variables per discipline. The strongly coupled disciplines can be either fully coupled (one discipline depends on all the others) or circularly coupled (one discipline depends only on the previous one and the first discipline depends only on the last one).

Constructor.

Parameters
  • n_shared (int) –

    size of the shared design parameters. Default: 1.

    By default it is set to 1.

  • n_local (list(int)) –

    sizes of the local design parameters for the different disciplines. Same length as n_coupling. If None, use [1, 1]. Default: None.

    By default it is set to None.

  • n_coupling (list(int)) –

    sizes of the coupling parameters for the different disciplines. Same length as n_local. If None, use [1, 1]. Default: None.

    By default it is set to None.

  • full_coupling (bool) –

    if True, fully couple the disciplines. Otherwise, use circular coupling. Default: True.

    By default it is set to True.

  • noised_coupling (bool) –

    if True, add a noise component u_local_i on the i-th discipline output.

    By default it is set to False.

  • seed (int) –

    seed for replicability.

    By default it is set to 1.

get_default_inputs(names=None)[source]

Get default input values.

Parameters

names (list(str)) –

names of the inputs.

By default it is set to None.

Returns

name and values of the inputs.

Return type

dict

get_design_space()[source]

Get the TM design space.

Returns

instance of the design space

Return type

TMDesignSpace

reset_design_space()[source]

Reset the TM design space.

gemseo.problems.scalable.parametric.core.problem.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.parametric.core.problem.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 non-negative. If no argument is given a single Python float is returned.

  • d1 (int, optional) – The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.

  • ... (int, optional) – The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.

  • dn (int, optional) – The dimensions of the returned array, must be non-negative. 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