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

Planning problems

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[download all files]

Source Files

Data Files


   Mosel Example Problems

   file c5fiber.mos
   Planning the production of fiberglass
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Mar. 2002, rev. Nov. 2017

model "C-5 Fiberglass"
 uses "mmxprs"

  NODES: range                           ! Production and demand nodes
                                         ! odd numbers: production capacities
                                         ! even numbers: demands

  ARC: dynamic array(NODES,NODES) of real   ! Cost of flow on arcs
  WEIGHT: array(NODES) of integer           ! Node weights (capacities/demand)

  flow: dynamic array(NODES,NODES) of mpvar ! Flow on arcs

 initializations from 'c5fiber.dat'

 forall(m,n in NODES | exists(ARC(m,n))) create(flow(m,n))

! Objective: total cost of production and storage
 Cost:= sum(m,n in NODES | exists(ARC(m,n))) ARC(m,n)*flow(m,n)

! Satisfy demands (flow balance constraints)
 forall(n in NODES | isodd(n)=FALSE)
  if(n>2, flow(n-2,n), 0) + flow(n-1,n) = 
   if(n<getlast(NODES), flow(n,n+2), 0) + WEIGHT(n)

! Production capacities
 forall(n in NODES | isodd(n)) flow(n,n+1) <= WEIGHT(n)

! Solve the problem
! Solution printing
 writeln("Total cost: ",getobjval)
 forall(t in 1..integer(getlast(NODES)/2)) write(strfmt(t,5))
 forall(n in NODES | isodd(n)) 
  write(strfmt(getsol(sum(m in NODES) flow(n,m)),5))
 forall(n in NODES | not(isodd(n))) 
  write(strfmt(getsol(sum(m in NODES) flow(n,m)),5))


Back to examples browserPrevious exampleNext example