gemseo / problems / scalable / linear

Hide inherited members

disciplines_generator module

Dummy linear discipline generator.

A utility that generates dummy disciplines from a specification. The inputs and output names are specified by the user. A linear random dependency between the inputs and outputs is created. The size of the inputs and outputs can be parametrized by the user. The MDA of the generated disciplines will always converge because all the outputs are in [0, 1] if the inputs are in [0, 1]. The analytic Jacobian is provided.

gemseo.problems.scalable.linear.disciplines_generator.create_disciplines_from_desc(disc_descriptions, inputs_size=1, outputs_size=1, grammar_type=GrammarType.JSON, matrix_format=MatrixFormat.DENSE, matrix_density=0.1)[source]

Generate LinearDiscipline classes according to a specification.

The specification is as follows:

[
    ("Disc_name1", ["in1"], ["out1", "out2"]),
    ("Disc_name2", ["in2", "out1"], ["out3", "out2"]),
]
This will generate two disciplines:
  • One named “Disc_name1” with the inputs [“in1”] and the outputs [“out1”, “out2”].

  • Another named “Disc_name2” with the inputs [“in2”, “out1”] and the outputs [“out3”, “out2”].

Parameters:
  • disc_descriptions – The specification of the disciplines, each item is (name, input_names, output_names), disciplines names may be non-unique.

  • inputs_size (int) –

    The size of the input vectors, each input data is of shape (inputs_size,).

    By default it is set to 1.

  • outputs_size (int) –

    The size of the output vectors, each output data is of shape (outputs_size,).

    By default it is set to 1.

  • grammar_type (GrammarType) –

    The type of grammars used by the disciplines.

    By default it is set to “JSONGrammar”.

  • matrix_format (MatrixFormat) –

    The format of the Jacobian matrix.

    By default it is set to “dense”.

  • matrix_density (float) –

    The percentage of non-zero elements when the matrix is sparse.

    By default it is set to 0.1.

Returns:

The LinearDiscipline.

Return type:

list[LinearDiscipline]

gemseo.problems.scalable.linear.disciplines_generator.create_disciplines_from_sizes(nb_of_disc, nb_of_total_disc_io, nb_of_disc_inputs=1, nb_of_disc_outputs=1, inputs_size=1, outputs_size=1, grammar_type=GrammarType.JSON, unique_disc_per_output=False, no_self_coupled=False, no_strong_couplings=False, matrix_format=MatrixFormat.DENSE, matrix_density=0.1)[source]

Generate a LinearDiscipline according to a specification.

The names of the disciplines will be automatic combinations of capital letters. The names of the inputs and outputs are generated from string representations of integers.

Parameters:
  • nb_of_disc (int) – The total number of disciplines.

  • nb_of_total_disc_io (int) – The total number of input and output data names in the overall process.

  • nb_of_disc_inputs (int) –

    The number of disciplines inputs, same for all disciplines.

    By default it is set to 1.

  • nb_of_disc_outputs (int) –

    The number of disciplines outputs, same for all disciplines.

    By default it is set to 1.

  • inputs_size (int) –

    The size of the input vectors, each input data is of shape (inputs_size,).

    By default it is set to 1.

  • outputs_size (int) –

    The size of the output vectors, each output data is of shape (outputs_size,).

    By default it is set to 1.

  • grammar_type (GrammarType) –

    The type of grammars used by the discipline.

    By default it is set to “JSONGrammar”.

  • unique_disc_per_output (bool) –

    Whether to ensure that the outputs are computed by at most one discipline.

    By default it is set to False.

  • no_self_coupled (bool) –

    Whether to ensure that no discipline has an output that is also an input.

    By default it is set to False.

  • no_strong_couplings (bool) –

    Whether to ensure that there is no strong couplings in the problem.

    By default it is set to False.

  • matrix_format (MatrixFormat) –

    The format of the Jacobian matrix.

    By default it is set to “dense”.

  • matrix_density (float) –

    The percentage of non-zero elements when the matrix is sparse.

    By default it is set to 0.1.

Returns:

The LinearDiscipline.

Raises:

ValueError – If the number of disciplines is inconsistent with the total number of inputs or outputs.

Return type:

list[LinearDiscipline]