paroto.viz.hierarchy#

Hierarchy extraction from OpenMDAO problems.

This module extracts parameter hierarchy by analyzing the data flow through an OpenMDAO Problem. It assigns hierarchy levels automatically based on dependencies.

Functions#

extract_hierarchy(prob, primary_params[, constraint_names])

Extract parameter hierarchy from an OpenMDAO Problem.

simplify_hierarchy(graph[, include_constraints, max_level])

Simplify hierarchy by removing intermediate variables and grouping by subsystems.

Module Contents#

paroto.viz.hierarchy.extract_hierarchy(prob, primary_params, constraint_names=None)#

Extract parameter hierarchy from an OpenMDAO Problem.

Analyzes the connection structure of an OpenMDAO problem to determine which parameters are primary (design variables), secondary (outputs of models consuming primary parameters), and so on.

Parameters:
  • prob (openmdao.api.Problem) – Configured OpenMDAO problem (should call setup() called)

  • primary_params (list of str) – List of primary parameter names (design variables) These can be partial names that will be matched

  • constraint_names (list of str, optional) – List of constraint output names. If None, attempts to detect constraints

Returns:

Graph abstraction with nodes, edges, and hierarchy levels

Return type:

ProblemGraph

Notes

Hierarchy levels: - Level 0: Primary parameters (user-specified design variables) - Level N: Parameters/outputs that depend only on levels 0 through N-1 - Constraints are assigned their own level based on dependencies

paroto.viz.hierarchy.simplify_hierarchy(graph, include_constraints=True, max_level=None)#

Simplify hierarchy by removing intermediate variables and grouping by subsystems.

Parameters:
  • graph (ProblemGraph) – Hierarchy graph from extract_hierarchy()

  • include_constraints (bool, optional) – Whether to include constraint nodes (default: True)

  • max_level (int, optional) – Maximum hierarchy level to include. If None, includes all levels

Returns:

Simplified hierarchy with: - ‘parameters’: list of primary parameter names - ‘models’: list of model/subsystem names - ‘constraints’: list of constraint names - ‘connections’: list of (source, target) tuples

Return type:

dict