DecomposedImplicitFunctionBase
(class from pyomo.contrib.pynumero.algorithms.solvers.implicit_functions
)
- class pyomo.contrib.pynumero.algorithms.solvers.implicit_functions.DecomposedImplicitFunctionBase(variables, constraints, parameters, solver_class=None, solver_options=None, timer=None, use_calc_var=True)[source]
Bases:
PyomoImplicitFunctionBase
A base class for an implicit function that applies a partition to its variables and constraints and converges the system by solving subsets sequentially
Subclasses should implement the partition_system method, which determines how variables and constraints are partitioned into subsets.
- __init__(variables, constraints, parameters, solver_class=None, solver_options=None, timer=None, use_calc_var=True)[source]
- Parameters:
variables (List of VarData) – Variables to be treated as outputs of the implicit function
constraints (List of ConstraintData) – Constraints that are converged to evaluate the implicit function
parameters (List of VarData) – Variables to be treated as inputs to the implicit function
Methods
__init__
(variables, constraints, parameters)Returns the values of the variables that are treated as outputs of the implicit function
get_block
()get_constraints
()get_parameters
()get_variables
()Returns the number of subsystems in the partition of variables and equations used to converge the system defining the implicit function
partition_system
(variables, constraints)Partitions the systems of equations defined by the provided variables and constraints
set_parameters
(values)Sets the parameters of the system that defines the implicit function.
Sets values of "parameter variables" and "output variables" to the most recent values set or computed in this implicit function
Member Documentation
- evaluate_outputs()[source]
Returns the values of the variables that are treated as outputs of the implicit function
The returned values do not necessarily need to be the values stored in the Pyomo variables, as long as they are consistent with the latest parameters that have been set.
- Returns:
Array with values corresponding to the “output variables” in the order they were specified in the constructor
- Return type:
NumPy array
- n_subsystems()[source]
Returns the number of subsystems in the partition of variables and equations used to converge the system defining the implicit function
- partition_system(variables, constraints)[source]
Partitions the systems of equations defined by the provided variables and constraints
Each subset of the partition should have an equal number of variables and equations. These subsets, or “subsystems”, will be solved sequentially in the order provided by this method instead of solving the entire system simultaneously. Subclasses should implement this method to define the partition that their implicit function solver will use. Partitions are defined as a list of tuples of lists. Each tuple has two entries, the first a list of variables, and the second a list of constraints. These inner lists should have the same number of entries.
- Parameters:
- Returns:
List of tuples describing the ordered partition. Each tuple contains equal-length subsets of variables and constraints.
- Return type:
List of tuples
- set_parameters(values)[source]
Sets the parameters of the system that defines the implicit function.
This method does not necessarily need to update values of the Pyomo variables, as long as the next evaluation of this implicit function is consistent with these inputs.
- Parameters:
values (NumPy array) – Array of values to set for the “parameter variables” in the order they were specified in the constructor