spy_dulmage_mendelsohn

(function from pyomo.contrib.incidence_analysis.visualize)

pyomo.contrib.incidence_analysis.visualize.spy_dulmage_mendelsohn(model, *, incidence_kwds=None, order=IncidenceOrder.dulmage_mendelsohn_upper, highlight_coarse=True, highlight_fine=True, skip_wellconstrained=False, ax=None, linewidth=2, spy_kwds=None)[source]

Plot sparsity structure in Dulmage-Mendelsohn order on Matplotlib axes

This is a wrapper around the Matplotlib Axes.spy method for plotting an incidence matrix in Dulmage-Mendelsohn order, with coarse and/or fine partitions highlighted. The coarse partition refers to the under-constrained, over-constrained, and well-constrained subsystems, while the fine partition refers to block diagonal or block triangular partitions of the former subsystems.

Parameters:
  • model (ConcreteModel) – Input model to plot sparsity structure of

  • incidence_kwds (dict, optional) – Config options for IncidenceGraphInterface

  • order (IncidenceOrder, optional) – Order in which to plot sparsity structure. Default is IncidenceOrder.dulmage_mendelsohn_upper for a block-upper triangular matrix. Set to IncidenceOrder.dulmage_mendelsohn_lower for a block-lower triangular matrix.

  • highlight_coarse (bool, optional) – Whether to draw a rectangle around the coarse partition. Default True

  • highlight_fine (bool, optional) – Whether to draw a rectangle around the fine partition. Default True

  • skip_wellconstrained (bool, optional) – Whether to skip highlighting the well-constrained subsystem of the coarse partition. Default False

  • ax (matplotlib.pyplot.Axes, optional) – Axes object on which to plot. If not provided, new figure and axes are created.

  • linewidth (int, optional) – Line width of for rectangle used to highlight. Default 2

  • spy_kwds (dict, optional) – Keyword arguments for Axes.spy

Returns:

  • fig (matplotlib.pyplot.Figure or None) – Figure on which the sparsity structure is plotted. None if axes are provided

  • ax (matplotlib.pyplot.Axes) – Axes on which the sparsity structure is plotted