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

Loading and cutting problems

Description
Problem name and type, featuresDifficultyRelated examples
D‑1 Wagon load balancing: Nonpreemptive scheduling on parallel machines ****
heuristic solution requiring sorting algorithm, formulation of maximin objective; nested subroutines: function returning heuristic solution value and sorting procedure, ceil, getsize, if-then, break, exit, all loop types (forall-do, repeat-until, while-do), setparam, qsort, cutoff value, loading a MIP start solution
D‑2 Barge loading: Knapsack problem ** burglar1.mos, knapsack_graph.mos
incremental problem definition with 3 different objectives, procedure for solution printing
D‑3 Tank loading: Loading problem ***
2 objectives; data preprocessing, as, dynamic creation of variables, procedure for solution printing, if-then-else
D‑4 Backing up files: Bin-packing problem ** binpacking_graph.mos
2 versions of mathematical model, symmetry breaking; data preprocessing, ceil, range
D‑5 Cutting sheet metal: Covering problem * g6transmit.mos, j2bigbro.mos
D‑6 Cutting steel bars for desk legs: Cutting-stock problem ** cutstock_graph.mos
set operation(s) on range sets, set of integer (data as set contents)


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 9: Loading and cutting stock problems

mosel_app_4.zip[download all files]

Source Files

Data Files





d5cutsh.mos

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

   file d5cutsh.mos
   ````````````````
   Cutting of sheet metal 
   (2-dimensional cutting patterns)
   
   A sheet metal shop cuts large pieces of sheet metal into
   4 smaller sizes. There are 16 possible patterns that a 
   large sheet can be cut into. How can the incoming order
   be met while using the smallest number of large sheets?
   
   This mathematical model (formulated as a covering problem)
   is very compact since the patterns have already been 
   pre-computed.

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

model "D-5 Sheet metal cutting"
 uses "mmxprs"

 declarations
  PATTERNS = 1..16                       ! Set of cutting patterns
  SIZES = 1..4                           ! Set of sheet sizes

  DEM: array(SIZES) of integer           ! Demands for the different sizes
  CUT: array(SIZES,PATTERNS) of integer  ! Cutting patterns
  
  use: array(PATTERNS) of mpvar          ! Use of cutting patterns
 end-declarations
 
 initializations from 'd5cutsh.dat'
  DEM CUT
 end-initializations

! Objective: total number of sheets used
 Sheets:= sum(p in PATTERNS) use(p)

! Satisfy demands
 forall(s in SIZES) sum(p in PATTERNS) CUT(s,p)*use(p) >= DEM(s)

 forall(p in PATTERNS) use(p) is_integer

! Solve the problem
 minimize(Sheets)
 
! Solution printing
  writeln("Total number of large sheets: ", getobjval)
  write("Cutting patterns used: ")
  forall(p in PATTERNS)
   write( if(getsol(use(p)) > 0 , " " + p + ":" + getsol(use(p)), "") )
  write("\nExemplaries of sheets sizes cut: ")
  forall(s in SIZES)
   write(s, ":", getsol(sum(p in PATTERNS) CUT(s,p)*use(p)), " ")
  writeln
      
end-model

Back to examples browserPrevious exampleNext example