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





c6assign.mos

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

   file c6assign.mos
   `````````````````
   Machine assignment for production batches
   
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Mar. 2002
*******************************************************!)

model "C-6 Machine assignment"
 uses "mmxprs"

 declarations   
  MACH = 1..5                        ! Set of machines
  PRODS = 1..10                      ! Set of production batches

  CAP: array(MACH) of integer        ! Machine capacities
  DUR: array(MACH,PRODS) of integer  ! Production durations
  COST: array(MACH,PRODS) of integer ! Production costs

  use: array(MACH,PRODS) of mpvar    ! 1 if machine assigned to batch,
                                     ! 0 otherwise
 end-declarations

 initializations from 'c6assign.dat'
  DUR CAP COST
 end-initializations

! Objective: total production cost
 Cost:= sum(m in MACH, p in PRODS) COST(m,p)*use(m,p)

! Assign a single machine to every batch
 forall(p in PRODS) sum(m in MACH) use(m,p) = 1

! Limits on machine capacities
 forall(m in MACH) sum(p in PRODS) DUR(m,p)*use(m,p) <= CAP(m)

 forall(m in MACH, p in PRODS) use(m,p) is_binary

! Solve the problem
 minimize(Cost)
 
! Solution printing
 writeln("Total cost: ",getobjval)
 forall(m in MACH) do
  write("Machine ", m, ": ")
  forall(p in PRODS) 
   if (getsol(use(m,p))=1) then
    write(p, " ")
   end-if
  writeln(" (total duration: ", getsol(sum(p in PRODS) DUR(m,p)*use(m,p)), ")")
 end-do

end-model

Back to examples browserPrevious exampleNext example