DEFINITION MODULE IdentifyPars;
(*******************************************************************
Module IdentifyPars (Version 1.2)
Copyright (c) 1990-2006 by Olivier Roth, Andreas Fischlin and
ETH Zurich.
Purpose Identifies parameters of a "ModelWorks" model
implemented as a model definition program.
Remarks Uses internally the "Dialog Machine", the mandatory
client interface of ModelWorks, i.e. SimBase and
SimMaster, and from the optional client interface the
module SimObjects. Moreover the auxiliary library
modules Lists, IRand, and Matrices (actually consisting
of many modules).
Note, this module exists in several implementation
versions, since the more complex identification routines
such as Powell have been implemented in form of large
libraries. The simple implementation does not
import from this package and has therefore the advantage
of being much smaller; however, as a consequence, the
method Powell can't be used in this version (On the Macintosh
check the version text with the Get Info command to verify
which version you are currently using).
Implementation restriction: A maximum of 1024 parameters
can be identified at once.
Programming
o Design
Olivier Roth 19/05/1990
o Implementation
Olivier Roth 19/05/1990
Andreas Fischlin 24/01/1993
ETH Zurich
Systems Ecology
CHN E 35.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND
URLs:
<mailto:RAMSES@env.ethz.ch>
<http://www.sysecol.ethz.ch>
<http://www.sysecol.ethz.ch/SimSoftware/RAMSES>
Last revision of definition: 08/06/2002 AF
*******************************************************************)
TYPE
RealFct = PROCEDURE (): REAL;
MinMethod = (halfDouble, amoeba, price, random, brent, powell, simplex);
(* Description of the different methods can be found in:
+ Press, H.W., Flannery, B.P., Teukolsky, S.A. & Vetterling, W.T., 1986,
"Numerical Recipes: the Art of Scientific Computing", Cambridge University Press,
New York, 818pp.
+ Price, W.L., 1976, "A controlled random search procedure for global
optimisation", The Computer Journal 20(4): 367-370.
*)
PROCEDURE MarkParForIdentification( VAR p: REAL );
PROCEDURE UnmarkParForIdentification( VAR p: REAL );
PROCEDURE UnmarkAllParsForIdentification;
(* maintains a list of parameters which are to be identified later
with the identification procedures of this module (see
below). You may mark or unmark any parameter from that list
by means of the 3 procedures above, given the parameters have
been previously declared to ModelWorks by SimBase.DeclP. or
interactively by a call to procedure MinimizeAfterDialog (see
below). *)
PROCEDURE SetDefltMinim( meth: MinMethod;
maxIter: INTEGER;
convC: REAL );
PROCEDURE GetDefltMinim( VAR meth: MinMethod;
VAR maxIter: INTEGER;
VAR convC: REAL );
(* Set/get the default minimization method "meth", the default maximum
number of iterations "maxIter", and the default convergence
criterion value "convC". These procedures are typically called
before "MinimizeAfterDialog" to assure meaningfull default
settings. *)
PROCEDURE MinimizeDialog(VAR method: MinMethod; VAR convC: REAL;
VAR maxIter: INTEGER;
VAR cancOrNoPs, anyPRChanged: BOOLEAN);
(* Opens a scrollable selector box in which you may choose and select
(mark) parameters interactively to be identified. The range
in which the parameters ought to be identified can also be
edited. Typically you call Minimize with the returned
parameters unless cancOrNoPs is TRUE (cancOrNoPs denotes
either that the user has cancelled the dialog or that she/he
has marked no parameters for identification. anyPRChanged
returns TRUE only if the user has edited the identification
range of some parameters, i.e. the interval in which
parameters are to be identified. To learn about which parameters
have been marked for identification you can use SimObjects and
inspect field chAttr=identify (where identify=1C) in the
ObjectHeader of all parameters. Note, any parameter with the
identifier "logPIFlagIdent", "ignMVFlagIdent", "scalePIIdent" or
with field chAttr = hide, (where hide = 2C), will not be displayed
in the parameter list. The parameters with the listed identifiers
are reserved for use by auxiliary module IdentParMod. *)
PROCEDURE Minimize( method: MinMethod; convC: REAL;
maxIter: INTEGER; func: RealFct );
(* Executes all necessary runs to perform an identification. "method"
specifies one of the above listed identification methods,
"convC" stands for a convergence criterion value, "maxIter"
denotes the maximum number of iterations, and "func" is a
function procedure returning the value of the performance
index by calling e.g. SimRun and then
SimDeltaCalc.GetDeltaStat. Note: "maxIter" is NOT the exact
maximal number of performed SimRun's, since an iteration
consists usually of several runs (depending on the selected
identification method). *)
PROCEDURE SuppressAllMonitoring;
PROCEDURE ResetAllMonitoring;
(* Above two procedures are a convenient way to suppress or reset all
monitoring during an identification. Typically you call
SuppressAllMonitoring just before calling Minimize or
ResetAllMonitoring to resume the "normal" monitoring after
returning from Minimize. *)
PROCEDURE MinimizeAfterDialog( func: RealFct );
(* Calls first MinimizeDialog and then Minimize as given by the
returned parameter values. MinimizeAfterDialog operates on the
default parameter values. "func" is the procedure computing the
performance index (i.e. it calls e.g. SimRun and then
SimDeltaCalc.GetDeltaStat). Note that this routine calls first
SuppressAllMonitoring before calling Minimize. It also resets
all monitoring according to the defaults at the end of Minimize.
*)
END IdentifyPars.