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, featuresDifficultyRelated examples
A‑1 Production of alloys: Blending problem

formulation of blending constraints; data with numerical indices, solution printout, if-then, getsol
* blending_graph.mos
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
* a1alloy.mos
A‑3 Refinery : Blending problem

formulation of blending constraints; sparse data with string indices, dynamic initialization, union of sets
** a2food.mos
A‑4 Cane sugar production : Minimum cost flow (in a bipartite graph)

mo ceil, is_binary, formattext
* e2minflow.mos, mincostflow_graph.mos
A‑5 Opencast mining: Minimum cost flow

encoding of arcs, solving LP-relaxation only, array of set
** a4sugar.mos
A‑6 Production of electricity: Dispatch problem

inline if, is_integer, looping over optimization problem solving
**


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

   Sugar cane harvesting is highly mechanized, however, once
   harvested the sugar content decreases rapidly through 
   fermentation. The sugar content of each wagon depends 
   on maturity of the sugar cane and where it was grown. A 
   production schedule for the current lot must be determined 
   so that it minimizes the total loss of sugar.

   The problem formulation uses binary variables to assign wagons 
   to time slots and 'ceil' in the calculation of an upper bound 
   on the number of time slots needed.

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

model "A-4 Cane sugar production"
 uses "mmxprs", "mmsystem"
 
 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 | getsol(process(w,s))>0) 
    write(formattext("wagon %2d (%3g)  ", w, s*DUR*LOSS(w)))
  writeln
 end-do
 
end-model

Back to examples browserPrevious exampleNext example