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

Checking memory usage

Description
Model efficiency may be measured in terms of model execution time and memory usage. The latter can be obtained with the help of the lsmods and info commands of the Mosel command line editor as shown by the example flow.mos that demonstrates the use of sparse arrays (flow.mos: dynamic arrays, flowh.mos: hashmap array) to reduce the size of tables.

Further explanation of this example: 'Mosel User Guide', Chapter 'Debugger and Profiler'


Source Files

Data Files





flowh.mos

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

   File flowh.mos
   ``````````````
   Use of sparse arrays to reduce size of tables
   - hashmap version -

   (c) 2008 Fair Isaac Corporation 
       author: S. Heipcke, 2005, rev. Sep. 2018
*******************************************************!)

model "Hashmap arrays"
 declarations
  Suppliers = 1..150
  Customers = 1..10000
  COST: hashmap array(Suppliers,Customers) of real
  flow: hashmap array(Suppliers,Customers) of mpvar
 end-declarations
 
 initializations from "flow.dat"
  COST
 end-initializations
  
 forall(s in Suppliers, c in Customers | COST(s,c)>0 ) create(flow(s,c))

end-model

(!

Check memory usage
==================
Use the following command sequence at the command line:

mosel debug -g flow.mos
lsmods
info COST
quit

Remove the keyword 'hashmap' from the array declarations and perform 
once more the same command sequence.
 
!)

Back to examples browserPrevious exampleNext example