Initializing help system before first use

Checking memory usage


Type: Transportation
Rating: 2 (easy-medium)
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.
File(s): flow.mos, flowh.mos
Data file(s): flow.dat

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.
 
!)

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.
 
!)

© 2001-2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.