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

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

```