Sample MPL Model File

 

On this page is a small sample model of a planning problem. You can also see how MPL model files are structured. We also have a page where we go through the sample model and give you the full explanation for each statement.

The Planning problem

The aggregate production planning problem is a question of how to distribute production capacity between products, and to determine production and inventory levels, given the demand for the products each month. In this example, we have three products and the planning is done for a whole year, or twelve months. Prices, demand, production capacity and cost are fixed, while production, sales and inventory are the decision variables. We will optimize this problem with respect to profit.

Here is the actual model file planning.mpl we will be using:

   {   Planning.mpl   }

   {   Aggregate production planning for 12 months   }


   TITLE
      Production_Planning;

   INDEX
      product = 1..3;
      month   = (January,February,March,April,May,June,July,
                 August,September,October,November,December);

   DATA
      price[product]              := (105.09, 234.00, 800.00);
      Demand[month,product]       := 1000 DATAFILE(demand.dat);
      ProductionCapacity[product] := 1000 (10, 42, 14);
      ProductionCost[product]     := (64.30, 188.10, 653.20);
      InventoryCost               := 8.8 ;

   DECISION VARIABLES
      Inventory[product,month]     ->  Invt
      Production[product,month]    ->  Prod
      Sales[product,month]         ->  Sale

   MACRO
      Revenues  := SUM(product,month: price * Sales);
      TotalCost := SUM(product,month: InventoryCost * Inventory
                                    + ProductionCost * Production);
   MODEL

      MAX   Profit  =  Revenues - TotalCost ;

   SUBJECT TO
      InventoryBalance[product,month]  ->  IBal :
      Inventory  =  Inventory[month-1] + Production - Sales ;

   BOUNDS
      Sales  < ProductionCapacity ; Inventory[month="January..November]" < 90000 ;
      Inventory[month="December]" ; END