Using expression constraints

In addition to the existing constraints that enable you to define bounds on flow, inventory and production values, you can combine two or more of these constraints to achieve more complex constraints. For example, you may want to create constraints to enforce conditions such as the following:

  • The total flow quantity out of DC_A should be less than 20% of the total inventory quantity at DC_B during Period_003.
  • The total flow volume value from DC_A to CZ_B should equal the total flow volume from DC_A.

The Expression Constraints table provides support for these cases. You can define Expression 1 or Expression 2 or both, as needed. These expression values can be one of the following:

  • The Name from a Flow Constraint, Flow Count Constraint, Inventory Constraint, Inventory Count Constraint, Production Constraint, Production Count Constraint, Site Constraint or Work Center Constraint,
  • The Name from an Expression Constraint (enabling you to nest constraints),
  • The Name from an Expression Based Cost.

As part of the support for expression constraints, the Constraint Type column in each of the constraints tables includes a type called “Define” for use with Expression Constraints and Expression Based Costs. When “Define” is set as the Constraint Type, the Constraint Value is not used to satisfy the constraint. Instead, the Constraint Value is specified in the Expression Constraint.

When defining Expression Constraints based on constraint records, such as Flow Constraints, the basis for the constraint records must be the same or the Expression Constraint is not included in the problem formulation. For example, if you have two Flow Constraints, the Constraint Basis must be the same for both records (i.e. both set to quantity). You cannot create an Expression Constraint that uses a Flow Constraint and a Flow Count Constraint, since the Flow Constraint uses quantity as a basis and the Flow Count Constraint uses count.

You can still define standard constraints, such as the maximum flow from a DC to a particular customer in a specified period. In this case, the Flow Constraint record looks like the following:

Expression Name

Period Name

Source Site

Destination Site

Product Name

Constraint Value

Constraint Type

 

Period_001

DC1

CZ5

Product1

100

Max

The Expression Name is not required to create standard constraints.

Current limitations of expression constraints

The following is a current limitation in the use of Expression Constraints:

  • The constraints that are referenced in an Expression Constraint must use the same unit of measure (Quantity, Weight, or Volume). For example, if you have an Expression Constraint that uses one Flow Constraint and one Inventory Constraint, if the Flow Constraint Constraint Value is set to a weight unit of measure, then the Inventory Constraint Constraint Value must also be a weight unit of measure. This is also true if both constraints are of the same type (i.e. both Flow Constraints).

Handling invalid expressions

  • If Expression 1 is invalid, it will cause Expression 2 defined in the Expression Constraint to be invalid.

  • Similarly if Expression 2 is invalid, it will cause Expression 1 defined in the Expression Constraint to be invalid.

Once an expression is deemed to be invalid, it is invalid in all Expression Constraint records. For example, assume the following records where Expression 1 (No_Prod) in the Test 3 record is invalid:

Name Coefficient 1 Expression 1 Coefficient 2 Expression 2 Constraint Type Constraint Value Status
Test1 1 All_Flow -1 All_Prod Min 1 Include
Test2 2 All_Prod -2 All_Process Min 2 Include
Test3 3 No_Prod -3 All_Inv Min 3 Include
Test4 4 All_Flow -4 All_Inv Min 4 Include

In this case, the invalid Expression 1 results in Expression 2 (All_Inv) being invalid in Test3. Since All_Inv is now invalid, the Test4 Expression Constraint is also considered invalid. Neither Test3 nor Test4 will be written when the model is run.

Last modified: Friday May 12, 2023

Is this useful?