Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (36 sloc) 1.67 KB
/*********************************************
* OPL 12.9.0.0 Model
* Author: Achyuthuni
* Creation Date: 31-Aug-2019 at 6:01:55 PM
*********************************************/
int NbPeriods = ...; // Number of future days
range Periods = 1..NbPeriods; // List having future days
int NbItems = ...; // Number of items
range items = 1..NbItems; // List having items
int Demand[items][Periods] = ...; // Demand on every day
float PoOrderCost[items] = ...; // Cost to place a purchase order
float DC_Capacity = ...; // Max DC capacity on any day
float ExternalInput[items][Periods] = ...; // Initial inventory + predicted PO arrival days
float InventoryCost[items] = ...; // Inventory holding cost
float SafetyStock[items] = ...;
dvar float+ PoOrders[items][Periods];
dvar float+ Inv[items][0..NbPeriods];
// Minimising the Po-Order cost and Inventory handling cost for every item
minimize
(sum(i in items) (
(PoOrderCost[i])*( sum( t in Periods ) PoOrders[i][t] ) +
(InventoryCost[i])*( sum(t in Periods ) Inv[i][t] )
));
subject to {
forall( i in items) //Initialising for later use
ctInitialInventory: Inv[i][0] == 0;
forall( i in items)
forall( t in Periods ) // Inventory carry over from previous day
ctInventory: PoOrders[i][t] + ExternalInput[i][t] + Inv[i][t-1] == Inv[i][t] + Demand[i][t];
forall( t in Periods )
forall( i in items) //On any day t, the maximum inventory should not exceed that of the DC capasity
ctCapacity: PoOrders[i][t] + ExternalInput[i][t] <= DC_Capacity;
forall( i in items)
forall( t in Periods ) // All items on all days should have greater than safety stock number of items
ctSafetyStock: Inv[i][t] >= SafetyStock[i];
}
You can’t perform that action at this time.