relevance.py

Relevance object for systems. Manages the data connectivity graph.

class openmdao.core.relevance.Relevance(group, params_dict, unknowns_dict, connections, inputs, outputs, mode)[source]

Bases: object

Object that manages the data connectivity graph for systems.

is_relevant(var_of_interest, varname)[source]

Returns True if a variable is relevant to a particular variable of interest.

Args:

var_of_interest : str

Name of a variable of interest (either a parameter or a constraint or objective output, depending on mode.)

varname : str

Name of some other variable in the model.

Returns:

bool: True if varname is in the relevant path of var_of_interest

is_relevant_system(var_of_interest, system)[source]
Args:

var_of_interest : str

Name of a variable of interest (either a parameter or a constraint or objective output, depending on mode.)

system : System

The system being checked for relevant w.r.t. the variable of interest.

Returns:

bool

True if the given system is relevant for the given variable of interest.

json_dependencies()[source]

Returns a json representation of a model’s data dependency graph.

Returns:

A json string with a dependency matrix and a list of variable

name labels.

vars_of_interest(mode=None)[source]

Determines our list of var_of_interest depending on mode.

Args:

mode : str

Derivative mode, can be ‘fwd’ or ‘rev’.

Returns:

list : Our inputs, or output, or both, depending on mode.