SVD Toolbox

Contents

SVD Toolbox#

The IDAES SVD Toolbox is an advanced diagnostics tool for helping to identify scaling and degeneracy issues in models using Singular Value Decomposition and is accessible through the DiagnosticsToolbox. Further discussion of how to use and interpret SVD results can be found here.

class idaes.core.util.model_diagnostics.SVDToolbox(model, **kwargs)[source]#

Toolbox for performing Singular Value Decomposition on the model Jacobian.

Used help() for more information on available methods.

Original code by Doug Allan

Parameters:

model (_BlockData) – model to be diagnosed. The SVDToolbox does not support indexed Blocks.

Keyword Arguments:
  • number_of_smallest_singular_values (PositiveInt, optional) – Number of smallest singular values to compute

  • svd_callback (svd_callback_validator, default=<function svd_dense at 0x7fa217de6980>) – Callback to SVD method of choice (default = svd_dense). Callbacks should take the Jacobian and number of singular values to compute as options, plus any method specific arguments, and should return the u, s and v matrices as numpy arrays.

  • svd_callback_arguments (dict, optional) – Optional arguments to pass to SVD callback (default = None)

  • singular_value_tolerance (float, default=1e-06) – Tolerance for defining a small singular value

  • size_cutoff_in_singular_vector (float, default=0.1) – Size below which to ignore constraints and variables in the singular vector

display_constraints_including_variable(variable, stream=None)[source]#

Display all constraints that include the specified variable and the associated Jacobian coefficient.

Parameters:
  • variable – variable object to get associated constraints for

  • stream – I/O object to write report to (default = stdout)

Returns:

None

display_rank_of_equality_constraints(stream=None)[source]#

Method to display the number of singular values that fall below tolerance specified in config block.

Parameters:

stream – I/O object to write report to (default = stdout)

Returns:

None

display_underdetermined_variables_and_constraints(singular_values=None, stream=None)[source]#

Determines constraints and variables associated with the smallest singular values by having large components in the left and right singular vectors, respectively, associated with those singular values.

Parameters:
  • singular_values – List of ints representing singular values to display, as ordered from least to greatest starting from 1 (default show all)

  • stream – I/O object to write report to (default = stdout)

Returns:

None

display_variables_in_constraint(constraint, stream=None)[source]#

Display all variables that appear in the specified constraint and the associated Jacobian coefficient.

Parameters:
  • constraint – constraint object to get associated variables for

  • stream – I/O object to write report to (default = stdout)

Returns:

None

run_svd_analysis()[source]#

Perform SVD analysis of the constraint Jacobian

Parameters:

None

Returns:

None

Actions:

Stores SVD results in object

SVD Callbacks#

The SVD Toolbox supports callbacks to select the SVD analysis tool to use. Two callbacks are provided to make use of methods available in Scipy.

This module contains a collection of tools for diagnosing modeling issues.

idaes.core.util.model_diagnostics.svd_dense(jacobian, number_singular_values)[source]

Callback for performing SVD analysis using scipy.linalg.svd

Parameters:
  • jacobian – Jacobian to be analysed

  • number_singular_values – number of singular values to compute

Returns:

u, s and v numpy arrays

idaes.core.util.model_diagnostics.svd_sparse(jacobian, number_singular_values)[source]

Callback for performing SVD analysis using scipy.sparse.linalg.svds

Parameters:
  • jacobian – Jacobian to be analysed

  • number_singular_values – number of singular values to compute

Returns:

u, s and v numpy arrays