Unit Constraints

Unit constraints allow the user to define arbitrary linear constraints involving most of the problem variables. This section describes this function and how to use it.

Key Unit Constraint Concepts

  1. The basic principle: The basic steps involved in forming a unit constraint are:
  • Creating a user constraint object: One creates a new unit_constraint object which will be used as a unique handle for the specific constraint and on which constraint-level parameters will be defined.
  • Specify which variables are involved in the constraint: this generally involves creating a relationship involving the unit_constraint object. For example, specifying the relationship unit__from_node__unit_constraint specifies that the corresponding unit_flow variable is involved in the constraint. The table below contains a complete list of variables and the corresponding relationships to set.
  • Specify the variable coefficients: this will generally involve specifying a parameter named *_coefficient on the relationship defined above to specify the coefficient on that particular variable in the constraint. For example, to define the coefficient on the unit_flow variable, one specifies the unit_flow_coefficient parameter on the approrpriate unit__from_node__unit_constraint relationship. The table below contains a complete list of variables and the corresponding coefficient parameters to set.
  • Specify the right-hand-side constant term: The constraint should be formed in conventional form with all constant terms moved to the right-hand side. The right-hand-side constant term is specified by setting the right_hand_side unit_constraint parameter.
    • Specify the constraint sense: this is done by setting the constraint_sense unit_constraint parameter. The allowed values are ==, >= and <=.
    • Coefficients can be defined on some parameters themselves. For example, one may specify a coefficient on a node's demand parameter. This is done by specifying the relationship node__unit_constraint and specifying the demand_coefficient parameter on that relationship
  1. Piecewise unit_flow coefficients: As described in operating_points, specifying this parameter decomposes the unit_flow variable into a number of sub operating segment variables named unit_flow_op in the model and with an additional index, i for the operating segment. The intention of this functionality is to allow unit_flow coefficients to be defined individually per segment to define a piecewise linear function. To accomplish this, the steps are as described above with the exception that one must define operating_points on the appropriate unit__from_node or unit__to_node as an array type with the dimension corresponding to the number of operating points and then set the unit_flow_coefficient for the appropriate unit__from_node__unit_constraint relationship, also as an array type with the same number of elements. Note that if operating points is defined as an array type with more than one elements, unit_flow_coefficient may be defined as either an array or non-array type. However, if operating_points is of non-array type, corresponding unit_flow_coefficients must also be of non-array types.
  2. Variables, relationships and coefficient guide for unit constraints The table below provides guidance regarding what relationships and coefficients to set for various problem variables and parameters.
Problem variable / Parameter NameRelationshipParameter
unit_flow (direction=from_node)unit__from_node__unit_constraintunit_flow_coefficient (non-array type)
unit_flow (direction=to_node)unit__to_node__unit_constraintunit_flow_coefficient (non-array type)
unit_flow_op (direction=from_node)unit__from_node__unit_constraintunit_flow_coefficient (array type)
unit_flow_op (direction=to_node)unit__to_node__unit_constraintunit_flow_coefficient (array type)
connection_flow (direction=from_node)connection__from_node__unit_constraintconnection_flow_coefficient
connection_flow (direction=to_node)connection__to_node__unit_constraintconnection_flow_coefficient