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
By clicking on a file name, a preview is opened at the bottom of this page.
flow.mos[download]
flowh.mos[download]

Data Files





flow.mos

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

   File flow.mos
   `````````````
   Use of dynamic arrays to reduce size of tables

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

model "Dynamic arrays"
 declarations
  Suppliers = 1..150
  Customers = 1..10000
  COST: dynamic array(Suppliers,Customers) of real
  flow: dynamic 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 'dynamic' from the array declarations and perform 
once more the same command sequence.
 
!)

Back to examples browserPrevious exampleNext example