[ Search |  Up Level |  Project home |  Index |  Class hierarchy ]

 Shared.ox

Components shared by components of niqlow .  ⇩ 

  1. CV and AV
  2. Volume and Noise Levels
  3. Log Files
  4. Integration, Kernels
Author:
© 2011-2023 Christopher Ferrall

Documentation of Items Defined in Shared.ox  ⇧ 

 Global variables, functions, enumerations

Variables
 BaseTag static const Base tags for parallel messaging.
 curdir static const
 DIFF_EPS static const tolerance level 0: \(10^{-8}\).
 DIFF_EPS1 static const tolerance level 1: \(5\times 10^{-6}\).
 DIFF_EPS2 static const tolerance level 2: \(10^{-4}\).
 DIFF_EPS3 static const tolerance level 3: \(10^{-2}\).
 IIDZpars static const IID normal parameter vector.
 mymomlabels static const labels for MyMoments
 SQRT_EPS static const \(\sqrt{\epsilon_m}\) \(10^{-8}\).
 SSQ_TOLER static const Euclidean tolerance, \(10^{-12}\).
 VZero static const 0 as a vector .
 ZeroForSure static const used in transitions.
Functions
 AV ActualValue: Returns X->myAV() if it exists or CV(X).
 ColLogit The Multinomial logit smoothing function (over columns).
 CV Return the Current Value of a Quantity: access X.v, X, X() or X(arg).
 DeltaV Row-Difference of a matrix.
 Dimensions Return rows() and columns() as a row vector.
 DiscreteNormal Return Nx1 vector of values corresponding to the 1/(N+1) percentiles of the normal distribution.
 DrawOne Return index of a single draw from the multinomial distribution.
 Epanechnikov Compute the Epanechnikov kernel matrix for a data matrix.
 FLogit The standard logistic cumulative distribution.
 GaussianKernel Compute the Gausian kernel matrix for a data matrix.
 HTopen
 MyMoments Print Column Moments.
 RowLogit The Multinomial logit smoothing function (over rows).
 SameDims Check that two objects have same rows and columns.
 SumToOne Return the completed simplex of a vector or double.
 TypeCheck Check that an object is of a required class, or one of a required class.
 vararray Convert an array of strings into a space-separated string.
 varlist Parse a string for variable names; return array of strings.
Enumerations
 AggregatorTypes Tags for Types of vector-valued objective Aggregation.
 ConstraintTypes Tags for Types of Constraints.
 ConvergenceResults Code for solutions to Optimization and Non-Linear System solving.
 Names_for_Integers Pseudonyms for -3, -2, ….
 NextTreatmentStates Possible next treatment phases.
 NoiseLevels Levels of output to produce while executing.
 NormalParams Tags for parameter vectors of normal distribution.
 ParallelExecutionModes Modes of Execution when executing in parallel.
 StateTypes Codes for Type.

 CGI : Zauxiliary

. @internal
Public methods
 Finalize static Finalize the CGI component of the output; Ox output appears below.
 GetVar static Find and return the CGI key value
 Initialize static Initialize the processing of CGI post data.
 Parse static Parse and return the values of a HTML form.
 ParseQ static Parse the query

 CPoint : Point : LinePoint : Zauxiliary

Store a point for a constrained objective.
Public fields
 eq inequalities.
 ineq equalities.
 L Merit value.
Public methods
 Vec
Inherited methods from Point:
aggregate, Point, Vstore
Inherited methods from LinePoint:
GetV, LinePoint
Inherited fields from Point:
AggType, F, G, H, J, SE, X
Inherited fields from LinePoint:
step, V, v

 Discrete : Quantity

Discrete values: actions, states, auxiliaries.
Public fields
 actual corresponding model vals.
 N Number of different values
 pdf vector of prob.
 subv subvector objected belongs to.
 vals const range(0,N-1)
Public methods
 Discrete Create a discrete quantity .
 GetN
 PDF virtual
 SetActual virtual Initialize the actual values.
 Track virtual
 Update virtual The default Discrete Variable update does nothing.
Inherited methods from Quantity:
SetVolume
Inherited fields from Quantity:
L, logf, pos, track, v, Volume

 Discretized : Zauxiliary

A continuous discretization of a (potentially) continuous quantity.
Public fields
 f 1xM row vector of unique indices into nodes.
 nodes const Quantity object or points.
 p NxM matrix of weights.
 pts N-array of matrices, either 2x1 or 2x2.
first row are node indices, second is weight on the node.
Public methods
 Approx Map vector of values into current nodes.
 Discretized Map a continuous outcome onto a set of discrete nodes.

 Equality : Equations : Zauxiliary

A container for equality constraints.
Public methods
 Equality
 print
Inherited methods from Equations:
Equations, norm, penalty
Inherited fields from Equations:
J, L, lam, N, rlabels, v

 Equations : Zauxiliary

Code a system of constraints.

Equations are used in systems and constrained optimization.
Public fields
 J Jacobian.
 L const array of equation labels
 lam current multiplier
 N const number of equations
 rlabels static const lables for equation elements.
 v current value
Public methods
 Equations Create a system of equations.
 norm virtual
 penalty virtual
 print virtual

 GaussianQuadrature : Integration : Zauxiliary

 GHK : Integration : Zauxiliary

Smooth Simulation of Multinomial Normal Probabilities and EValues. When using NnotIID an object is created for each choice set \(A(\theta).\)
Public fields
 C const J-array of Choleski of M[j]Sigma M[j]'.
 CSET
 hR const half-replication (anti-thetics).
 iseed static initial seed.
 J const dimensions on integration, number of feasible options.
 L 1xR upper bounds.
 M const J-array of delta matrices.
 nu JxR matrix of N(0,1) simulated values.
 pj Pj.
 pk incremental simulated prob.
 R const number of replications.
 sigs vector of standard deviations .
 SimJ const J-1.
 u 1xR uniform values.
 vj Evj.
 Volume static output level
Public methods
 GHK Set constants for GHK.
 SetC Update array of choice-specific Choleskie's
 SetSeed static
 SimDP Use GHK to simulate choice probabilities and Emaxes for a matrix of index values.
 SimProb Use GHK to simulate state-contingent choice probability when U() includes additive N(0,Σ) errors.

 GQH : GaussianQuadrature : Integration : Zauxiliary

Gauss-Hermite Quadrature Integration.

$$\int f(x)exp\{-x2/2\}dx \approx \sum_{m=1}^M \omega_m f(x_m).$$

This can be used to compute the expected value under the normal distribution.

Let \(z \sim N(0,1)\).
Since \(\phi(z) = (2\pi)^{-0.5} exp{-x^2/2},\) then
$$E[f(z)] \approx (2\pi)^{-0.5}\sum_{m=1}^M \omega_m f(x_m).$$

Example:
GQH::Initialize(8);
println("E[x*x] = ", GQH::wght * sqr(GQH::nodes)  );  // / M_SQRT2PI
Comments:
Thanks to Jason Rheinlander for finding and fixing an error in the previous version.
Public fields
 nodes static the nodes or mantissa values xm
 order static currrent order M
 wght static corresponding weights ωm
Public methods
 coef static Return the polynomial coefficients of Hn polynomial .
 Initialize static Set the nodes and weights for Gauss-Hermite Quadrature.

 GQL : GaussianQuadrature : Integration : Zauxiliary

Gauss-Laguerre Quadrature Integration.

$$\int_0^\infty f(x) e^{-1} dx \approx \sum_{m=0}^{M-1} \omega_m f(x_m)$$

This can be used to compute the expected value under the exponential distribution.

Example:
GQL::Initialize(8);
println("E[x*x] = ", GQL::wght * sqr(GQL::nodes) );
Public fields
 nodes static the nodes or mantissa values xm
 wght static corresponding weights ωm
Public methods
 Initialize static Gauss-Laguerre nodes and weights.

 InEquality : Equations : Zauxiliary

A container for inequality constraints.
Public methods
 InEquality
 print
Inherited methods from Equations:
Equations, norm, penalty
Inherited fields from Equations:
J, L, lam, N, rlabels, v

 Integration : Zauxiliary

Container for different integration techniques.

 LinePoint : Zauxiliary

Holds one line maximization try.
Public fields
 step step length.
 V v value .
 v obj value.
Public methods
 Copy virtual
 GetV virtual
 LinePoint

 MixPoint : Point : LinePoint : Zauxiliary

Store a point for a mixture objective.
Public fields
 Dvar const
 mix mixture elements.
 sp const
 W weight matrix
 WF free weights.
Public methods
 aggregate virtual aggregate blackbox objectives into a scalar value.
Inherited methods from Point:
Point, Vstore
Inherited methods from LinePoint:
GetV, LinePoint
Inherited fields from Point:
AggType, F, G, H, J, SE, X
Inherited fields from LinePoint:
step, V, v

 Parameter : Quantity

Continuously varying quantity: the base class for parameters of an Objective.
Public fields
 block 0 or pointer to param block.
 DoNotConstrain Flag to ignore constraints.
 DoNotVary Treat as Determined, for now.
 f Current free value f.
 ival const Initial passed value.
 NearFlat static const tolerance for too near flat part of transformation.
 scale Scaling value s.
 start Value at start of iteration.
Public methods
 Decode virtual Default decoding: no scaling, no constraining.
 Encode virtual Default encoding: no scaling, no constraining.
 Menu virtual
 Parameter Create a new parameter.
 ReadCGI virtual
 ReInitialize Reset the parameter to its hard-coded values.
 Reset Reset the starting value of a parameter.
 SetDoNotVary virtual Set the value of DoNotVary.
 ToggleDoNotVary virtual Toggle the value of DoNotVary.
Inherited methods from Quantity:
SetVolume
Inherited fields from Quantity:
L, logf, pos, track, v, Volume

 Point : LinePoint : Zauxiliary

Store information about a multidimensional point. An objective or system of equations contains the current point in cur. Algorithms use a point to store temporary values.
Public fields
 AggType form of aggregation of vfunc() into func().
 F Free vector.
 G Gradient
 H Hessian
 J Jacobian
 SE \(\sqrt(diag(H-1f))\).
 X Structural vector.
Public methods
 aggregate virtual aggregate blackbox objectives into a scalar value.
 Point
 Vstore virtual
Inherited methods from LinePoint:
GetV, LinePoint
Inherited fields from LinePoint:
step, V, v

 Quantity

Container for discrete variables (DDP) and continuous parameters (FiveO).
Public fields
 L const Label
 logf Log file dedicated to this qty.
 pos position in vector
 track Data tracking object.
 v Current actual value
 Volume Volume of output.
Public methods
 SetVolume Control variable-specifc output.

 SepPoint : Point : LinePoint : Zauxiliary

Store a point for a separable objective.
Public fields
 bb const
 Kvar const
Public methods
 aggregate virtual aggregate separable objectives into a scalar value.
 SepPoint
Inherited methods from Point:
Point, Vstore
Inherited methods from LinePoint:
GetV, LinePoint
Inherited fields from Point:
AggType, F, G, H, J, SE, X
Inherited fields from LinePoint:
step, V, v

 SysPoint : Point : LinePoint : Zauxiliary

A system point.
Public methods
 SysPoint
Inherited methods from Point:
aggregate, Point, Vstore
Inherited methods from LinePoint:
GetV, LinePoint
Inherited fields from Point:
AggType, F, G, H, J, SE, X
Inherited fields from LinePoint:
step, V, v

 Version : Zauxiliary

Checks minimum Ox version and prints copyright info.
Public fields
 HTopen static HTML log is open.
 logdir static directory to put log files in.
 MPIserver static TRUE if running in parallel and in server mode.
 tmstmp static time stamp for log files.
 version static const Current niqlow version.
Public methods
 Check static Check versions and set timestamp, log directory.

 Zauxiliary

A container for auxiliary structures, which helps organize the hierarchy of classes.

 Global

Enumerations
AggregatorTypes Tags for Types of vector-valued objective Aggregation. All objectives in FiveO take the form $$f = \Omega_{i=1}^N v_i.$$ where \(v\) is the vector returned by the Objective::vfunc() method that the user typically provides for their objective and \(\Omega\) is an aggregator If the objective is a System then this is the system of equations. The user's objective is called by Objective::vobj() and the the vector is stored. Then Objective::fobj aggregates the vector into a real number using one of the aggregators below.
TagValue\(\Omega\)
LINEAR\({\sum}_i\ v_i\)
LOGLINEAR\({\sum}_i \ln(v_i)\)
MULTIPLICATIVE\({\prod}_i v_i\)
MINUSSUMOFSQUARES\(-{\sum}_i v_i^2\)
SUMOFSQUARES\({\sum}_i v_i^2\)
LINEAR, LOGLINEAR, MULTIPLICATIVE, MINUSSUMOFSQUARES, SUMOFSQUARES, Aggregators
ConstraintTypes Tags for Types of Constraints. Used by Constrained objectives. EQUALITY, INEQUALITY, ConstraintTypes
ConvergenceResults Code for solutions to Optimization and Non-Linear System solving. NONE, MAXITERATIONS, FAIL, WEAK, SECONDRESET, STRONG, ConvergenceResults
Names_for_Integers Pseudonyms for -3, -2, …. Zero, One, Two, Three, TrackAll, NotInData, UseCurrent, UseCheckPoint, AggGroup, UseDefault, UseLabel, UnInitialized, Impossible, DoAll, NoMatch, AllFixed, AllRand, UseSubSample, ResetValue, IterationFailed, UseGradient, ErgodicDist, CondProbOne, abbrevsz, xax, yax, zax, Naxes, _lo, _hi, GraphLimits
NextTreatmentStates Possible next treatment phases. stayinf, gotonextf, exittreatment, NextTreatmentStates
NoiseLevels Levels of output to produce while executing. SILENT, QUIET, LOUD, NOISY, NoiseLevels
NormalParams Tags for parameter vectors of normal distribution. Nmu, Nsigma, Nrho, NormalParams
ParallelExecutionModes Modes of Execution when executing in parallel. See BaseTag
MultiParamVectors: Sending different parameter vectors to nodes to compute overall objective.
OneVector: Sending a single parameter vector to nodes to solve separate sub-problems which will be aggregated by the Client. This involves Objective::vfunc().
MultiParamVectors, OneVector, ParallelModes
StateTypes Codes for Type. These codes (and their order) determine what calculations to do at the endogenous state \(\theta\).
TagsValue\(\theta\) Type
ORDINARY,INSUBSAMPLE 0randomly selected for first stage of KW approximation
NOTSASMPLED,IGNOREEXOG1approximated if KW or utility does not depend on \(\epsilon\)
LASTT 2subsampled AND last period of decision-making
LASTNOTSAMPLED 3LASTT AND NOTSAMPLED
TERMINAL 4Terminal state
See also:
MakeTerminal, SubSampleStates
ORDINARY, INSUBSAMPLE, NOTSAMPLED, IGNOREEXOG, LASTT, LASTNOTSAMPLED, TERMINAL, TERMNOTSAMPLED, StateTypeCutoffs

 AV

AV ( X , ... )
ActualValue: Returns X->myAV() if it exists or CV(X).
Parameters:
X anything
... argument passed to CV()

Returns:
X->myAV() or CV(X)

X               Returns         Notes
Discrete      X->myAV()       (any class with the member function defined)
Other Object    CV(X)
Comments:
This allows user utility to access the current actual value of a state. This also works for StateBlock which will return the items from the Grid of points.
See also:
CV StateVariable::myAV ActionVariable::myAV

 BaseTag

static const decl BaseTag
Base tags for parallel messaging.

 ColLogit

ColLogit ( x , rho )
The Multinomial logit smoothing function (over columns).
Parameters:
x m×n matrix.
rho double [default=1.0] smoothing factor
Returns:
\(\exp(\rho x)\)./sumr(\(\exp(\rho x)\))

 curdir

static const decl curdir

 CV

CV ( X , ... )
Return the Current Value of a Quantity: access X.v, X, X() or X(arg).
Parameters:
X a double, integer, static function of the form X() or X(arg), or any object with a member named v.
an array of CV compatible elements will return the horizontal concatenation value of the results as matrix.

... a single argument can be passed along with X(). Further arguments are ignored

X               Returns         Notes
ActionVariable  X->myCV()       X's column of values in \(\alpha\)
Other Object    X.v             If v is a member
array           row of CV(X)    recursively call CV() or CV(...) for all elements
function        X() or X(...)   simply call function sending optional arguments as array
all else        X               CV() of arithmetic objects is the value itself

Returns:
X.v, X, X(), X(arg)
Comments:
This allows elements of the code to be represented several different ways.
Typically the argument should be the matrix of feasible actions, as this is how CV() is used inside Transit.
No argument is passed by Transitions() and ExogenousTransition

 DeltaV

DeltaV ( V )
Row-Difference of a matrix.
Parameters:
V Nx1 x N matrix vector, N > 1.
Returns:
(N-1)xM matrix, δ = V[i][]-V[i-1][]
Comments:
Dimensions and type are not checked!

 DIFF_EPS

static const decl DIFF_EPS
tolerance level 0: \(10^{-8}\).

 DIFF_EPS1

static const decl DIFF_EPS1
tolerance level 1: \(5\times 10^{-6}\). .

 DIFF_EPS2

static const decl DIFF_EPS2
tolerance level 2: \(10^{-4}\). .

 DIFF_EPS3

static const decl DIFF_EPS3
tolerance level 3: \(10^{-2}\). .

 Dimensions

Dimensions ( A )
Return rows() and columns() as a row vector.
Parameters:
A matrix

Returns:
rows(A)~columns(A)

 DiscreteNormal

DiscreteNormal ( N , pars )
Return Nx1 vector of values corresponding to the 1/(N+1) percentiles of the normal distribution.
Parameters:
N number of points to return
pars 2x1 vector or array of NormalParams
Nmu mean μ Default=0.0
Nsigma standard deviation σ Default=1.0
Returns:
μ + σΦ-1(q), q=(1 ... N)/N+1

 DrawOne

DrawOne ( P )
Return index of a single draw from the multinomial distribution.
Parameters:
P vector of probabilities, p0, p0, … 1-∑pk
Returns:
index of simulated draw

 Epanechnikov

Epanechnikov ( X , h )
Compute the Epanechnikov kernel matrix for a data matrix.
Parameters:
X RxNd matrix of points
h bandwidth
Returns:
NdxNd matrix

 FLogit

FLogit ( x )
The standard logistic cumulative distribution.
Parameters:
x double or vector.
Returns:
exp(x)./(1+exp(x))

 GaussianKernel

GaussianKernel ( X , inh )
Compute the Gausian kernel matrix for a data matrix.
Parameters:
X RxNd matrix of points
h bandwidth. -1 [default] use Silverman
> 0.0 value.
Returns:
NdxNd matrix

 HTopen

HTopen ( fn )

 IIDZpars

static const decl IIDZpars
IID normal parameter vector. @NormalParams.

 MyMoments

MyMoments ( M , rlabels , oxf )
Print Column Moments.
Parameters:
M matrix: matrix to compute (column) moments for
rlabels (optional), array of labels for variables
oxf int, print to screen (default),
file, printed to file
Returns:
matrix of moments
Comments:
See Ox moments()

 mymomlabels

static const decl mymomlabels
labels for MyMoments

 RowLogit

RowLogit ( x , rho )
The Multinomial logit smoothing function (over rows).
Parameters:
x m×n matrix.
rho double [default=1.0] smoothing factor
Returns:
\(exp(\rho x)\)./sumc(\(exp(\rho x)\))

 SameDims

SameDims ( A , B )
Check that two objects have same rows and columns.
Parameters:
A matrix
B matrix

Returns:
TRUE if A and B have the same dimensions

 SQRT_EPS

static const decl SQRT_EPS
\(\sqrt{\epsilon_m}\) \(10^{-8}\).

 SSQ_TOLER

static const decl SSQ_TOLER
Euclidean tolerance, \(10^{-12}\).

 SumToOne

SumToOne ( v )
Return the completed simplex of a vector or double.
Parameters:
v double or column vector.
Returns:
v | (1-sumc(v))

 TypeCheck

TypeCheck ( obj , cname , Fatal , msg )
Check that an object is of a required class, or one of a required class.
Parameters:
obj object
cname Class name
Array of class names
Fatal TRUE [default]= end on the error
FALSE , only issue warning.
SILENT no message, just return outcome
msg Message to print if not SILENT and class fails to match (default message is "Class fails to match")

Returns:
FALSE if no match
1+i where i is index of first match in the array (so TRUE if first/only matches)

 vararray

vararray ( s )
Convert an array of strings into a space-separated string.
Parameters:
sa a string or an array of strings
Returns:
string
Example:
vararray({"A","B","Joe"})   →  "A B Joe "
vararray("A B Joe ")   →  "A B Joe "

 varlist

varlist ( s )
Parse a string for variable names; return array of strings.
Parameters:
s string
Returns:
a string if s has a single variable name
an array of variable names
Example:
varlist("A B   Joe")   →  {"A","B","Joe"}
varlist("Joe") → "Joe"

 VZero

static const decl VZero
0 as a vector .

 ZeroForSure

static const decl ZeroForSure
used in transitions.

 CGI

 Finalize

static CGI :: Finalize ( )
Finalize the CGI component of the output; Ox output appears below.

 GetVar

static CGI :: GetVar ( key )
Find and return the CGI key value
Parameters:
key string, CGI post keyword
Returns:
value of the key
-1 if key not valid

 Initialize

static CGI :: Initialize ( title )
Initialize the processing of CGI post data.
Parameters:
title string, HTML title

 Parse

static CGI :: Parse ( )
Parse and return the values of a HTML form.
Returns:
array of parallel values

 ParseQ

static CGI :: ParseQ ( )
Parse the query

 CPoint

 eq

decl eq [public]
inequalities.

 ineq

decl ineq [public]
equalities.

 L

decl L [public]
Merit value.

 Vec

 Discrete

 actual

decl actual [public]
corresponding model vals.

 Discrete

Discrete :: Discrete ( L , N )
Create a discrete quantity .
Parameters:
L string a label or name for the variable.
N positive integer, number of values.
N=1 is a constant.
Volume default=SILENT. NoiseLevels

 GetN

Discrete :: GetN ( )

 N

decl N [public]
Number of different values

 PDF

virtual Discrete :: PDF ( )

 pdf

decl pdf [public]
vector of prob. of vals.

 SetActual

virtual Discrete :: SetActual ( MaxV , Report )
Initialize the actual values.
Parameters:
MaxV non-zero double, default = 1.0
N×1 vector, actual
Report FALSE [default], do not print out current to actual mapping
TRUE, print mapping If a double is sent the actual vector to 0,…, MaxV.

Example:
 a = new ActionVariable("att",3);   // None, half-time, full-time
 a -> SetActual();                  // AV(a) = 0  .5  1.0
OR:
 a -> SetActual(40);                // AV(a) = 0  20  40  (hours)

taxbrack = new StateVariable("s",5); //lower bound on tax rate brackets taxbrack -> SetActual( <0; 20000; 55000; 80000; 165000> );

See also:
Update

 subv

decl subv [public]
subvector objected belongs to.

 Track


 Update

virtual Discrete :: Update ( )
The default Discrete Variable update does nothing. Derived discrete types can define their own Updates which called when parameters of a model (may) have changed. This depends on UpdateTimes
See also:
SetUpdateTime

 vals

const decl vals [public]
range(0,N-1)

 Discretized

 Approx

Discretized :: Approx ( x , trans )
Map vector of values into current nodes.
Parameters:
x column vector of values
trans TRUE, calculate f and p like output of Transit()
Example:
v = new Discretized(<0;1;2;3>);
v->Approx(<-1.3;1.2;2>,TRUE);
After execution, these value will be set:
v.pts = { < 0				//-1.3 is to left of first node
            1.0 	>,		// all weight on the node
		  < 1 	2			// 1.2 is between 2nd and 3rd nodes
		    0.8 0.2 >,		// 20% of the gap between nodes
		  < 2				// 2 is exactly equal to 3rd node
		    1.0 	> }
v.f = < 0  	1 	2 	3	>	// 4 nodes have positive weight
v.p = < 1.0 0.0 0.0	0.0
		0.0 0.8 0.2 1.0
		0.0 0.0 0.0 1.0	>

 Discretized

Discretized :: Discretized ( nodes )
Map a continuous outcome onto a set of discrete nodes.

 f

decl f [public]
1xM row vector of unique indices into nodes.

 nodes

const decl nodes [public]
Quantity object or points.

 p

decl p [public]
NxM matrix of weights.

 pts

decl pts [public]
N-array of matrices, either 2x1 or 2x2.
first row are node indices, second is weight on the node.

 Equality

 Equality

Equality :: Equality ( LorNorv )

 print

Equality :: print ( )

 Equations

 Equations

Equations :: Equations ( LorN )
Create a system of equations.
Parameters:
LorN array of strings (labels)
string, a list of labels processed by varlist
positive integer, number of equations

 J

decl J [public]
Jacobian.

 L

const decl L [public]
array of equation labels

 lam

decl lam [public]
current multiplier

 N

const decl N [public]
number of equations

 norm

virtual Equations :: norm ( )

 penalty

virtual Equations :: penalty ( )

 print


 rlabels

static const decl rlabels [public]
lables for equation elements.

 v

decl v [public]
current value

 GHK

 C

const decl C [public]
J-array of Choleski of M[j]Sigma M[j]'.

 CSET

decl CSET [public]

 GHK

GHK :: GHK ( R , J )
Set constants for GHK.
Parameters:
R integer, number of replications
J integer, choice dimensions

 hR

const decl hR [public]
half-replication (anti-thetics).

 iseed

static decl iseed [public]
initial seed.

 J

const decl J [public]
dimensions on integration, number of feasible options.

 L

decl L [public]
1xR upper bounds.

 M

const decl M [public]
J-array of delta matrices. \(M[j]\) is \(J\times J\). The first row contains a 1 in the \(j\) column. The remaining rows contain -1 in the \(j\) column and 1 in each non-j column so that deltas can be commuted.

 nu

decl nu [public]
JxR matrix of N(0,1) simulated values.

 pj

decl pj [public]
Pj.

 pk

decl pk [public]
incremental simulated prob. vector.

 R

const decl R [public]
number of replications.

 SetC

GHK :: SetC ( Sigma )
Update array of choice-specific Choleskie's
Parameters:
Sigma J×J variance matrix

 SetSeed

static GHK :: SetSeed ( newseed )

 sigs

decl sigs [public]
vector of standard deviations .

 SimDP

GHK :: SimDP ( V )
Use GHK to simulate choice probabilities and Emaxes for a matrix of index values.
Parameters:
V J×1 vector of choice values

Returns:
2x1 array of J×1 vector of simulated Emaxes and choice probabilities

 SimJ

const decl SimJ [public]
J-1.

 SimProb

GHK :: SimProb ( j , V )
Use GHK to simulate state-contingent choice probability when U() includes additive N(0,Σ) errors. \(Ev\) is this simulated (conditional) value of setting \(\alpha^\star = j\): $$Ev_j = \int_{-\infty}^{+\infty} (V_j+z_j) \left[ \int_{-\infty}^{L_{\sim j1}}\cdots \int_{-\infty}^{L_{\sim jJ^-}} f(\delta_{j} | z_j)d\delta_{j} \right] f(z_j)dz_j.$$ Here \(\delta_{j}\) is the \(J-1\) vector of \(z_i-z_j.\) \(L_{\sim ji} = -(V_i-V_j)\) is the upper bound on the region of \(z_i\) consistent with \(j\) being better than \(i\). \(P_j\) is the same expression except \((V_j+z_j)\) is replaced by \(1\).

Bellman routines compute $$Emax = \sim_{j=0}^{J-1} Ev_j P_j.$$

Parameters:
j integer, option to simulate probability for
V J×1 vector of choice values

Cholesky matrices are updated by (internal) calls to NnotIID::SetC simulated probability and Ev for option j are left in vj and pj


 u

decl u [public]
1xR uniform values.

 vj

decl vj [public]
Evj.

 Volume

static decl Volume [public]
output level

 GQH

 coef

static GQH :: coef ( n )
Return the polynomial coefficients of Hn polynomial . Element 0 is the coefficient on x^n in the H polynomial, element n is the constant (i.e. x^0) coefficient.
Parameters:
n the order of the polynomial
Returns:
Hermite polynomial coefficients, 1/2 yields probabilists Hermite polynomial coefficients.as a 1-by-(n+1) row vector

 Initialize

static GQH :: Initialize ( order )
Set the nodes and weights for Gauss-Hermite Quadrature.

$$\int f(x) e^{-x^} dx \approx \sum_{m=1}^M \omega_m f(x_m).$$ This can be used to compute the expected value under the normal distribution.

Let \(z \sim N(0,1)\).
Since \(\phi(z) = (2\pi)^{-0.5}\exp{-x^2/2}\),then
$$E[f(z)] \approx (2\pi)^{-0.5}\sum_{m=1}^M \omega_m f(x_m).$$

Parameters:
order integer, M

Example:
GHQ::Initialize(8);
println("E[x*x] = ", GQH::wght * sqr(GQH::nodes)  );  // / M_SQRT2PI

 nodes

static decl nodes [public]
the nodes or mantissa values xm

 order

static decl order [public]
currrent order M

 wght

static decl wght [public]
corresponding weights ωm

 GQL

 Initialize

static GQL :: Initialize ( order )
Gauss-Laguerre nodes and weights.
∫_0+∞ f(x)exp(-x) ≅ ∑m ωm f(xm)
Parameters:
order integer, 2-6, 8, 10, 20, 32

 nodes

static decl nodes [public]
the nodes or mantissa values xm

 wght

static decl wght [public]
corresponding weights ωm

 InEquality

 InEquality

InEquality :: InEquality ( LorNorv )

 print

InEquality :: print ( )

 LinePoint

 Copy

virtual LinePoint :: Copy ( h )

 GetV

virtual LinePoint :: GetV ( )

 LinePoint

LinePoint :: LinePoint ( )

 step

decl step [public]
step length.

 V

decl V [public]
v value .

 v

decl v [public]
obj value.

 MixPoint

 aggregate

aggregate blackbox objectives into a scalar value.
Parameters:
inV=0, if no argument, V data member holds individual values
matrix of separable values to be aggregated within columns
outv=0, if no argument, objective stored in this.v
address to return objective The matrix passed as inV should be N×M.

See also:
AggregatorTypes, Objective::SetAggregation

 Dvar

const decl Dvar [public]

 mix

decl mix [public]
mixture elements.

 sp

const decl sp [public]

 W

decl W [public]
weight matrix

 WF

decl WF [public]
free weights.

 Parameter

 block

decl block [public]
0 or pointer to param block.

 Decode

virtual Parameter :: Decode ( f )
Default decoding: no scaling, no constraining.
Returns:
v

 DoNotConstrain

decl DoNotConstrain [public]
Flag to ignore constraints.

 DoNotVary

decl DoNotVary [public]
Treat as Determined, for now.

 Encode

virtual Parameter :: Encode ( )
Default encoding: no scaling, no constraining.
v = start;
scale = 1.0;
f = v;
Returns:
v

 f

decl f [public]
Current free value f.

 ival

const decl ival [public]
Initial passed value.

 Menu

virtual Parameter :: Menu ( )

 NearFlat

static const decl NearFlat [public]
tolerance for too near flat part of transformation.

 Parameter

Parameter :: Parameter ( L , ival )
Create a new parameter.
Parameters:
L parameter label
ival initial value

Typically a user would create an object of class derived from this base class. This function is called by those derived classes to set common elements of paramters.


 ReadCGI


 ReInitialize

Parameter :: ReInitialize ( )
Reset the parameter to its hard-coded values.
This does this:
	v = start = scale = CV(ival);
	f = 1.0;
    Encode();

Typically this is called by a method of the Objective to re-initialize some or all of the parameters that belong to it.


 Reset

Parameter :: Reset ( newv , IsCode )
Reset the starting value of a parameter.
Parameters:
newv value to reset at
IsCode TRUE [default] newv is a free value
FALSE newv is structural
Returns:
the new starting structural value
See also:
ReInitialize

 scale

decl scale [public]
Scaling value s.

 SetDoNotVary

virtual Parameter :: SetDoNotVary ( setting )
Set the value of DoNotVary.
Parameters:
setting TRUE or FALSE

 start

decl start [public]
Value at start of iteration.

 ToggleDoNotVary

virtual Parameter :: ToggleDoNotVary ( )
Toggle the value of DoNotVary.

 Point

 aggregate

virtual Point :: aggregate ( inV , outv )
aggregate blackbox objectives into a scalar value.
Parameters:
inV=0, if no argument, V data member holds individual values
matrix of separable values to be aggregated within columns
outv=0, if no argument, objective stored in this.v
address to return objective The matrix passed as inV should be N×M.

See also:
AggregatorTypes, Objective::SetAggregation

 AggType

decl AggType [public]
form of aggregation of vfunc() into func().
See also:
Objective::SetAggregation, AggregatorTypes

 F

decl F [public]
Free vector.

 G

decl G [public]
Gradient

 H

decl H [public]
Hessian

 J

decl J [public]
Jacobian

 Point

Point :: Point ( )

 SE

decl SE [public]
\(\sqrt(diag(H-1f))\).

 Vstore

virtual Point :: Vstore ( inV )

 X

decl X [public]
Structural vector.

 Quantity

 L

const decl L [public]
Label

 logf

decl logf [public]
Log file dedicated to this qty.

 pos

decl pos [public]
position in vector

 SetVolume

Quantity :: SetVolume ( Volume )
Control variable-specifc output.
Parameters:
Volume new NoiseLevels

Each quantity variable has a volume setting which is initialized to SILENT.

If the new Volume is greater than the current value then a log file is opened if one is not already open.

If the new Volume is SILENT and a log file is already open then the log file is closed.

See also:
logf

 track

decl track [public]
Data tracking object.

 v

decl v [public]
Current actual value

 Volume

decl Volume [public]
Volume of output.

 SepPoint

 aggregate

virtual SepPoint :: aggregate ( inV , outv )
aggregate separable objectives into a scalar value.
Parameters:
inV=0, if no argument, V data member holds separable values
matrix of separable values to be aggregated within columns
outv=0, if no argument, objective stored in this.v
address to return objective The matrix passed as inV should be (K×NvfuncTerms)×M.

 bb

const decl bb [public]

 Kvar

const decl Kvar [public]

 SepPoint

SepPoint :: SepPoint ( Kvar , bb )

 SysPoint

 SysPoint

SysPoint :: SysPoint ( )

 Version

 Check

static Version :: Check ( indir )
Check versions and set timestamp, log directory.
Parameters:
logdir str (default="."). A directory path or file prefix to attach to all log files. All log files will receive the same time stamp, which is set here.
Comments:
Only the first call does anything. Any subsequent calls return immediately.

 HTopen

static decl HTopen [public]
HTML log is open.

 logdir

static decl logdir [public]
directory to put log files in.

 MPIserver

static decl MPIserver [public]
TRUE if running in parallel and in server mode.

 tmstmp

static decl tmstmp [public]
time stamp for log files.

 version

static const decl version [public]
Current niqlow version. @name niqlowversion