We consider a supply chain delivering diesel oil and vitroil from Kuwait to Saudi Arabia with:
 Distribution center located in Kuwait
 Transshipment base in Ras Tanura
 Customer in Yanbu
There are two ways to deliver the products:
 Directly to Yanbu
 Through the transshipment base in Ras Tanura
The goods from Kuwait are transported by:
 Highway transport to the Yanbu base throughout the entire year (except for the two periods of path inaccessibility).
 River barges to the Ras Tanura base during navigation period (JuneSeptember).
 Highway transport (DecemberMarch only) from Ras Tanura to the Yanbu base.
 Procurement strategy optimization of different products in case of the current warehouse and transport infrastructure.
 Estimate the required number of oil and acid tank trucks and barges to transfer diesel and acid on all routes.
A product flow can be divided into parts, which represent actions that are performed with the products of this flow. There are 5 such actions for the Diesel fuel, and only 3 actions for the Sulfuric acid, since it can be delivered directly from Kuwait only.
Below you can see the max throughput set for each action.
Action  Max throughput, ton/h 

Diesel fuel  
Loading a vehicle  25 
Sending from Kuwait  25 
Transshipment in Ras Tanura  50 
Sending from Ras Tanura  40 
Unloading in Yanbu  33 
Sulfuric Acid  
Loading into vehicle  40 
Sending to the Yanbu  28,6 
Unloading in Yanbu  28,6 
For each such action we define special constraints. Such Custom Constraints are used to model throughput restrictions for every time period. In our case we will use them to define that the time spent on performing one of the actions cannot exceed the available time in each period.
But first, we define a unique label for every Product Flow, except the first one. The first product flow represents the process of transferring the products from the storage to the demanding site. Since there is only one path, and the transferred amount of product equals the demand, no constraint is required for this path as special label.
Each label contains data on the: product, ordinal period number, source, destination of that exact flow.
For example, the DF_#1 1 DMStation Kuwait label says that this flow is defined for the DF_#1 product, which is transported from the delivery measuring station to Kuwait during the period #1 (20220101  20220125).
Let us analyze the first constraint, which is defined for the Sulfuric Acid product:
The lefthand side of the constraint holds the expression, estimating the time required to perform the action, for which this constraint is created (transfer the product from the delivery measuring station to Kuwait). This value is calculated as the product flow divided by the throughput of this action, where:
 Product flow  the actual product flow
 The throughput value  1 / 40 = 0.025, which allows us to use multiplication in the expression.
The maximum throughput values are not defined in the scenario. These are the values that we are aware of (see the table above), and we use them to estimate the time value.
In the same way we estimate the time for each action, to later create constraints with the received data.
The righthand side of the constraint holds the the length of the period in hours (defined in the Periods table) this action refers to. For example, the length of the first period is 25 days, or 600 hours. There are two options of defining constraints. We may do either of the following:
 Define the whole restriction in one constraint.

Introduce new variables, and define an expression for these variables in one constraint.
Then use these variables (or the defined expression) to set a restriction in another constraint.
Below you can see an example of defining a constraint via the latter option.
The result offers a procurement plan with a detailed report on the fleet size and its utilization considering the given restrictions.

How can we improve this article?
