gemseo / core / derivatives

chain_rule module¶

The chain rule.

gemseo.core.derivatives.chain_rule.apply_diff_ios(diff_ios)[source]

Apply the differentiated inputs and outputs.

From the diff_ios specfication, add the differentiated inputs and outputs to the disciplines.

Parameters:

diff_ios (DisciplineIOMapping) – The differentiated inputs and outputs.

Return type:

None

gemseo.core.derivatives.chain_rule.traverse_add_diff_io(graph, inputs, outputs, add_differentiated_ios=True)[source]

Set the required differentiated IOs for the disciplines in a chain.

Add the differentiated inputs and outputs to the disciplines in a chain of executions, given the list of inputs with respect to which the derivation is made and the list of outputs to be derived. The inputs and outputs are a subset of all the inputs and outputs of the chain. This allows to minimize the number of linearizations to perform in the disciplines.

Uses a two ways (from inputs to outputs and then from outputs to inputs)

breadth first search graph traversal algorithm.

The graph is constructed by DependencyGraph, which represents the data connexions (edges) between the disciplines (nodes).

Parameters:
• graph (Graph) – The data graph of the process, built from DependencyGraph.

• inputs (Iterable[str]) – The inputs with respect to which the chain chain is differentiated.

• outputs (Iterable[str]) – The chain outputs to be differentiated.

• add_differentiated_ios (bool) –

Whether to add the differentiated inputs and outputs to the discipline by calling ~.MDODiscipline.add_differentiated_inputs and ~.MDODiscipline.add_differentiated_outputs

By default it is set to True.

Returns:

The merged differentiated inputs and outputs.

Return type:

None | dict[MDODiscipline, list[set, set]]