 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

c5fiber.mos

```(!******************************************************
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"

declarations
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
end-declarations

initializations from 'c5fiber.dat'
ARC WEIGHT
end-initializations

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
minimize(Cost)

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

end-model

```   