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





a5mine.mos

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

   file a5mine.mos
   ```````````````
   Opencast mining
  
   An opencast uranium mine is being prospected. 6 of 
   the 18 blocks contain uranium. To extract a block, 3
   blocks of the level above it need to be extracted. 
   Blocks have varied extraction costs and each block 
   of uranium has a different market value. The objective
   is to determine which blocks to extract to maximize 
   total benefit.
   
   This model uses binary variables to indicate which 
   blocks will be extracted. There is also a two-dimensional 
   array to enforce the extraction order between layers.
   A relaxed formulation of this constraint is commented out 
   for reference.

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

model "A-5 Opencast mining"
 uses "mmxprs"

 declarations
  BLOCKS = 1..18                       ! Set of blocks
  LEVEL23: set of integer              ! Blocks in levels 2 and 3
  COST: array(BLOCKS) of real          ! Exploitation cost of blocks
  VALUE: array(BLOCKS) of real         ! Value of blocks
  ARC: array(LEVEL23,1..3) of integer  ! Arcs indicating order of extraction

  extract: array(BLOCKS) of mpvar      ! 1 if block b is extracted
 end-declarations

 initializations from 'a5mine.dat'
  COST VALUE ARC
 end-initializations

! Objective: maximize total profit
 Profit:= sum(b in BLOCKS) (VALUE(b)-COST(b))* extract(b)  

! Extraction order
! forall(b in LEVEL23) 3*extract(b) <= sum(i in 1..3) extract(ARC(b,i))
 forall(b in LEVEL23)
  forall(i in 1..3) extract(b) <= extract(ARC(b,i))

 forall(b in BLOCKS) extract(b) is_binary
  
! Solve the problem
 maximize(Profit)

! Solving LP relaxation only
! maximize(XPRS_LIN, Profit)

! Solution printing
 declarations
  WEIGHT: integer                      ! Weight of blocks
 end-declarations

 initializations from 'a5mine.dat'
  WEIGHT
 end-initializations

 writeln("Total profit:", getobjval*WEIGHT)
 write("Extract blocks")
 forall(b in BLOCKS | getsol(extract(b))>0) write(" ", b)
 writeln 

end-model

Back to examples browserPrevious exampleNext example