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

Mining and process industries

Description
Problem name and type, featuresDifficulty
A‑1 Production of alloys: Blending problem *
formulation of blending constraints; data with numerical indices, solution printout, if-then, getsol
A‑2 Animal food production: Blending problem *
formulation of blending constraints; data with string indices, as, formatted solution printout, use of getsol with linear expressions, strfmt
A‑3 Refinery : Blending problem **
formulation of blending constraints; sparse data with string indices, dynamic initialization, dynamic arrays, finalize, create, union of sets
A‑4 Cane sugar production : Minimum cost flow (in a bipartite graph) *
ceil, is_binary
A‑5 Opencast mining: Minimum cost flow **
encoding of arcs, solving LP-relaxation only
A‑6 Production of electricity: Dispatch problem **
inline if, is_integer


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 6: Mining and process industries (blending problems)

mosel_app_1.zip[download all files]

Source Files

Data Files





a4sugar.mos

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

   file a4sugar.mos
   ````````````````
   Production of cane sugar
   
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Feb. 2002
*******************************************************!)

model "A-4 Cane sugar production"
 uses "mmxprs"
 
 declarations
  NW = 11                          ! Number of wagon loads of sugar
  NL = 3                           ! Number of production lines
  WAGONS = 1..NW
  SLOTS = 1..ceil(NW/NL)           ! Time slots for production
  
  LOSS: array(WAGONS) of real      ! Loss in kg/hour
  LIFE: array(WAGONS) of real      ! Remaining time per lot
  DUR: integer                     ! Duration of the production

  process: array(WAGONS,SLOTS) of mpvar  ! 1 if wagon processed in slot,
                                         ! 0 otherwise
 end-declarations
 
 initializations from 'a4sugar.dat'
  LOSS LIFE DUR
 end-initializations

! Objective function
 TotalLoss:= sum(w in WAGONS, s in SLOTS) s*DUR*LOSS(w)*process(w,s)

! Assignment
 forall(w in WAGONS) sum(s in SLOTS) process(w,s) = 1

! Wagon loads per time slot
 forall(s in SLOTS) sum(w in WAGONS) process(w,s) <= NL
 
! Limit on raw product life
 forall(w in WAGONS) sum(s in SLOTS) s*process(w,s) <= LIFE(w)/DUR

 forall(w in WAGONS, s in SLOTS) process(w,s) is_binary

! Solve the problem
 minimize(TotalLoss)

! Solution printing
 writeln("Total loss: ", getobjval)
 forall(s in SLOTS) do
  write("Slot ", s, ": ")
  forall(w in WAGONS) 
   if(getsol(process(w,s))>0) then
    write("wagon ", strfmt(w,2), strfmt(" (" + s*DUR*LOSS(w) + ")  ", 8))
   end-if 
  writeln
 end-do
 
end-model

Back to examples browserPrevious exampleNext example