validate_dimensions

(function from pyomo.contrib.pyros.uncertainty_sets)

pyomo.contrib.pyros.uncertainty_sets.validate_dimensions(arr_name, arr, dim, display_value=False)[source]

Validate dimension of an array-like object.

Parameters:
  • arr_name (str) – Name of the array to validate.

  • arr (array_like) – Array to validate.

  • dim (int) – Required dimension of the array.

  • display_value (bool, optional) – True to include the array string representation in exception messages, False otherwise.

Raises:

ValueError – If arr is ragged or not of the required dimension dim.