FICO Xpress Optimization Examples Repository
 FICO Optimization Community FICO Xpress Optimization Home

Planning problems

Description
C‑1 C‑2 C‑3 Problem name and type, features Difficulty Planning the production of bicycles: Production planning (single product) *** modeling inventory balance; inline if, forall-do Production of drinking glasses: Multi-item production planning ** modeling stock balance constraints; inline if, index value 0 Material requirement planning: Material requirement planning (MRP) ** working with index (sub)sets, dynamic initialization, finalize, create, as Planning the production of electronic components: Multi-item production planning ** modeling stock balance constraints; inline if 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 Assignment of production batches to machines: Generalized assignment problem *

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

Source Files

Data Files

c1bike.mos

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

file c1bike.mos
```````````````
Planning the production of bicycles

(c) 2008 Fair Isaac Corporation
author: S. Heipcke, Mar. 2002
*******************************************************!)

model "C-1 Bicycle production"
uses "mmxprs"

declarations
TIMES = 1..12                  ! Range of time periods

DEM: array(TIMES) of integer   ! Demand per months
CNORM,COVER: integer           ! Prod. cost in normal / overtime hours
CSTOCK: integer                ! Storage cost per bicycle
CAP: integer                   ! Monthly capacity in normal working hours
ISTOCK: integer                ! Initial stock

pnorm:array(TIMES) of mpvar    ! No. of bicycles produced in normal hours
pover:array(TIMES) of mpvar    ! No. of bicycles produced in overtime hours
store:array(TIMES) of mpvar    ! No. of bicycles stored per month
end-declarations

initializations from 'c1bike.dat'
DEM CNORM COVER CSTOCK CAP ISTOCK
end-initializations

! Objective: minimize production cost
Cost:= sum(t in TIMES) (CNORM*pnorm(t) + COVER*pover(t) + CSTOCK*store(t))

! Satisfy the demand for every period
forall(t in TIMES)
pnorm(t) + pover(t) + if(t>1, store(t-1), ISTOCK) = DEM(t) + store(t)

! Capacity limits on normal and overtime working hours per month
forall(t in TIMES) do
pnorm(t) <= CAP
pover(t) <= 0.5*CAP
end-do

! Solve the problem
minimize(Cost)

! Solution printing
declarations
MONTHS: array(TIMES) of string  ! Names of months
end-declarations

initializations from 'c1bike.dat'
MONTHS
end-initializations

writeln("Total cost: ", getobjval)
write("       ")
forall(t in TIMES) write(strfmt(MONTHS(t),4))
write("\nDemand ")
forall(t in TIMES) write(strfmt(DEM(t)/1000,4))
write("\nNormal ")
forall(t in TIMES) write(strfmt(getsol(pnorm(t))/1000,4))