FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Planning problems

Description
Problem name and type, featuresDifficulty
C‑1 Planning the production of bicycles: Production planning (single product) ***
modeling inventory balance; inline if, forall-do
C‑2 Production of drinking glasses: Multi-item production planning **
modeling stock balance constraints; inline if, index value 0
C‑3 Material requirement planning: Material requirement planning (MRP) **
working with index (sub)sets, dynamic initialization, finalize, create, as
C‑4 Planning the production of electronic components: Multi-item production planning **
modeling stock balance constraints; inline if
C‑5 Planning the production of fiberglass: Production planning with time-dependent production cost ***
representation of multi-period production as flow; encoding of arcs, exists, create, isodd, getlast, inline if
C‑6 Assignment of production batches to machines: Generalized assignment problem *


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 8: Production planning

mosel_app_3.zip[download all files]

Source Files

Data Files





c3toy.mos

(!******************************************************
   Mosel Example Problems
   ======================

   file c3toy.mos
   ``````````````
   Planning the production of toy lorrys
   
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Mar. 2002
*******************************************************!)

model "C-3 Toy production"
 uses "mmxprs"

 declarations   
  ITEMS: set of string                 ! Set of all products
  FINAL: set of string                 ! Set of final products
  ASMBL: set of string                 ! Set of assembled products
  PREPROD: set of string               ! Set of preproducts

  CAP: array(ASMBL) of integer         ! Capacity of assembly lines
  DEM: array(FINAL) of integer         ! Demand of lorrys
  CPROD: array(ASMBL) of real          ! Assembly costs
  CBUY: array(ITEMS) of real           ! Purchase costs
  REQ: array(ASMBL,PREPROD) of integer ! Items req. for assembling a product
 end-declarations

 initializations from 'c3toy.dat'
  DEM CBUY REQ
  [CPROD, CAP] as 'ASSEMBLY'
 end-initializations

 finalize(ASMBL); finalize(PREPROD); finalize(FINAL); finalize(ITEMS)

 declarations   
  produce: array(ASMBL) of mpvar       ! Quantity of items produced
  buy: array(PREPROD) of mpvar         ! Quantity of items bought
 end-declarations

! Objective: total costs
 Cost:= sum(p in PREPROD) CBUY(p)*buy(p) + 
         sum(p in ASMBL) CPROD(p)*produce(p)

! Satisfy demands
 forall(p in FINAL) produce(p) >= DEM(p)

! Assembly balance
 forall(p in PREPROD) buy(p) + if(p in ASMBL, produce(p), 0) >= 
                       sum(q in ASMBL) REQ(q,p)*produce(q)

! Limits on assembly capacity
 forall(p in ASMBL) produce(p) <= CAP(p)

 forall(p in PREPROD) buy(p) is_integer
 forall(p in ASMBL) produce(p) is_integer

! Solve the problem
 minimize(Cost)
 
! Solution printing
 writeln("Total cost: ",getobjval)
 writeln("Buy:")
 forall(p in PREPROD)
  writeln("  ", strfmt(p,-18), ": ", strfmt(getsol(buy(p)),5)) 
 writeln("Produce:")
 forall(p in ASMBL)
  writeln("  ", strfmt(p,-18), ": ", strfmt(getsol(produce(p)),5)) 

end-model

Back to examples browserPrevious exampleNext example