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

c3toy.mos

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

file c3toy.mos
``````````````
Planning the production of toy lorrys

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

model "C-3 Toy production"
uses "mmxprs"

declarations
FINAL: set of string                 ! Set of final products
ASMBL: set of string                 ! Set of assembled products
PREPROD: set of string               ! Set of preproducts

CAP: array(ASMBL) of integer         ! Capacity of assembly lines
DEM: array(FINAL) of integer         ! Demand of lorrys
CPROD: array(ASMBL) of real          ! Assembly costs
CBUY: array(ITEMS) of real           ! Purchase costs
REQ: array(ASMBL,PREPROD) of integer ! Items req. for assembling a product
end-declarations

initializations from 'c3toy.dat'
[CPROD, CAP] as 'ASSEMBLY'
end-initializations

finalize(ASMBL); finalize(PREPROD); finalize(FINAL); finalize(ITEMS)

declarations
produce: array(ASMBL) of mpvar       ! Quantity of items produced
buy: array(PREPROD) of mpvar         ! Quantity of items bought
end-declarations

! Objective: total costs
sum(p in ASMBL) CPROD(p)*produce(p)

! Satisfy demands
forall(p in FINAL) produce(p) >= DEM(p)

! Assembly balance
forall(p in PREPROD) buy(p) + if(p in ASMBL, produce(p), 0) >=
sum(q in ASMBL) REQ(q,p)*produce(q)

! Limits on assembly capacity
forall(p in ASMBL) produce(p) <= CAP(p)

forall(p in ASMBL) produce(p) is_integer

! Solve the problem
minimize(Cost)

! Solution printing
writeln("Total cost: ",getobjval)