Jump to content

Language Reference 3: Difference between revisions

From SELESwiki
No edit summary
 
(65 intermediate revisions by the same user not shown)
Line 27: Line 27:
between sources. The version here is equivalent
between sources. The version here is equivalent
to that in Excel, with reversal of parameters).
to that in Excel, with reversal of parameters).
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Constants]]


==OR==
==OR==
Line 40: Line 56:
VALUE:  
VALUE:  
Either TRUE(1) or FALSE(0)
Either TRUE(1) or FALSE(0)
NOTES:
The OR operator is equivalent to the addition operator. For example: if A is TRUE(1) and B FALSE(0), then A OR B means that A+B, which is 1+0 and is equal to 1(TRUE). If both A and B are TRUE(1), then A OR B becomes 1+1, the result will be greater than 0 and 1. In this case, the result for x will still be evaluated to 1(TRUE)


SEE ALSO:  
SEE ALSO:  
Line 45: Line 64:


Example 1:
Example 1:
     x=(2*8==16) OR (2>5)(TRUE)
     x=(2*8==16) OR (2>5) //(TRUE)
     =1
     (the result for x will be 1)


Example 2:
Example 2:
   x=(2*8!=4*4) OR (2>5) (FALSE)
   x=(2*8!=4*4) OR (2>5) //(FALSE)
     =0
     (the result for x will be 0)
SAMPLE MODELS:
<links to sample models where this function is used>
 
==OUTPUT RECORD==
DESCRIPTION:
 
USAGE:
     
REQUIRED ARGUMENTS:
Expr is any expression that evaluates to single numeric value
 
VALUE:


<figure out an end example indicator. For example, ***>
NOTES:


SEE ALSO:
[[Model Builder's Guide Chapter 9#Composite Functions]]
Example 1:
//Note this example is out of context. //See [[LSStats#centroid.lse|centroid.lse]] for the working example.
OUTPUT RECORD(ClassStatsFile)
    DECISION Area[currType] > 0
    LandscapeId: LandscapeId
    Replicate: Replicate
    pType: currType
    CCE: MeanCCE[currType]
    MaxCCE: MaxCCE[currType]
    CD: MeanCD[currType]
    ENDFN
Example 2:
//Note this example is out of context. //See [[LSStats#nn.lse|nn.lse]] for the working example.
OUTPUT RECORD(ClassStatsFile)
  DECISION Area[pType] > 0
    LandscapeId: LandscapeId
    Replicate: Replicate
    pType: pType
    MNN: CellWidth * MeanNN[pType]
    MNN2: CellWidth * MeanNN2[pType]
    MinNN: CellWidth * MinNN[pType]
    MaxNN: CellWidth * MaxNN[pType]
    NNSD: CellWidth * NNSD[pType]
    NNCV: 100 * NNSD[pType] / MeanNN[pType]
    Dispersion: 2 * (NumPatches[pType] / Area[pType])^(1/2) * MeanNN[pType]
    meanMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * meanMST[pType]
    tMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * MST[pType]
    meanMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanMPG[pType]
    tMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * MPG[pType]
    nMPG: nMPG[pType]
    meanAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanAW_MPG[pType]
    tAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * AW_MPG[pType]
    nAW_MPG: nMPG[pType]
    ENDFN
 
SAMPLE MODELS:  
SAMPLE MODELS:  
<links to sample models where this function is used>
<links to sample models where this function is used>
Line 119: Line 189:
the overall target dist. will be met.
the overall target dist. will be met.
[[Model Builder's Guide Chapter 9#Matrix Functions]]
[[Model Builder's Guide Chapter 9#Matrix Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
//Note this example is out of context. It will not run in the value model.
//See [[LSStats#stats.lse|stats.lse]] for the working example.
OVER INDEX SEQUENCE(pType + 1, NumPTypes - 1)
            pType2 = Index
            x = IF (tTE > 0) THEN Eik[pType, pType2] / tTE ELSE 0
            tIJI = tIJI + x * LOG(x)
        ENDFN
Example 2: 
//Note this example is out of context. It will not run in the value model.
//See [[LSStats#stats.lse|stats.lse]] for the working example.
OVER INDEX SEQUENCE(0, NumPTypes-1)
            pType2 = Index + MinPType
            AMik = IF (TotalEdge[pType] > 0) THEN Eik[pType, pType2] / TotalEdge[pType] ELSE 0
            IJI[pType] = IJI[pType] + AMik * LOG(AMik)
            x = IF ((TotalEdge[pType] > 0) AND (Pi > 0)) THEN Pi * Eik[pType, pType2] / TotalEdge[pType] ELSE 0
            tContag = tContag + x * LOG(x)
            measuredDiversity  = measuredDiversity - AMik * LOG(AMik)
            measuredDiversity2  = IF(pType NEQ pType2) THEN  measuredDiversity2 - AMik * LOG(AMik) ELSE measuredDiversity2
            asm = asm + AMik^2
        ENDFN
SAMPLE MODELS:
<links to sample models where this function is used>


==PAUSE==
==PAUSE==
Line 124: Line 230:
box to which the user must respond to continue[[Model Builder's Guide Chapter 9#Control Expressions]]
box to which the user must respond to continue[[Model Builder's Guide Chapter 9#Control Expressions]]


DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 


==PAUSE==
SAMPLE MODELS:
<links to sample models where this function is used>
***
(#Value) Pauses the simulation for the specified number
(#Value) Pauses the simulation for the specified number
of milliseconds and then continues[[Model Builder's Guide Chapter 9#Control Expressions]]
of milliseconds and then continues[[Model Builder's Guide Chapter 9#Control Expressions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>
==PAUSE IF==
==PAUSE IF==
Expr If the expression evaluates to TRUE, halts the  
Expr If the expression evaluates to TRUE, halts the  
Line 133: Line 272:
the user must respond to continue[[Model Builder's Guide Chapter 9#Control Expressions]]
the user must respond to continue[[Model Builder's Guide Chapter 9#Control Expressions]]


DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==PAUSE (#Value)IF==  
==PAUSE (#Value)IF==  
Line 138: Line 293:
simulation for the specified number of  
simulation for the specified number of  
milliseconds and then continues[[Model Builder's Guide Chapter 9#Control Expressions]]
milliseconds and then continues[[Model Builder's Guide Chapter 9#Control Expressions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>
==PREV==
==PREV==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#General Set, List and Graph Functions]]
==PREV LINK==
==PREV LINK==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Graph Functions]]


==RECOMPUTE==
==RECOMPUTE==
Line 147: Line 356:
recomputed before next selection
recomputed before next selection
[[Model Builder's Guide Chapter 9#Control Expressions]]
[[Model Builder's Guide Chapter 9#Control Expressions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==REGION CENTRED==
==REGION CENTRED==
Line 154: Line 380:
those cells for which this expression returns
those cells for which this expression returns
TRUE will be included.
TRUE will be included.
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
//Note This exacmple is out of context. It will not run in the value model
//See [[Distance Surface#Distance.lse|Distance.lse]] for the working example
REGION CENTRED(1, 1)
DECISION (StudyArea > 0) AND (SrcLayer <= 0) AND (DistanceFromSrc > (CellWidth *  DISTANCE(StartLocation, Location)))
ENDSL
Example 2: 
//Note This exacmple is out of context. It will not run in the value model
//See [[Filter Small#FilterSmall.lse|FilterSmall.lse]] for the working example
REGION CENTRED(1, 1.5)
DECISION (Visited EQ 0) AND (FilteredPatchLayer EQ 1)
ENDSL
Example 3:
//Note This exacmple is out of context. It will not run in the value model
//See [[The process model#producer.lse|producer.lse]] for the working example 
REGION CENTRED(0, 1, WRAPPED)
DECISION notEaten // don't spread if eaten (i.e. stop process)
ENDSL
Example 4:
//Note This exacmple is out of context. It will not run in the value model
//See [[Game of Life#GameOfLife.lse|GameOfLife.lse]] for the working example 
OVER REGION CENTRED(1,1.5)
    DECISION PrevCellState EQ 1
    numNeighbs = numNeighbs + 1
  ENDFN
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Region Functions]]


==REGION COST SURFACE==
==REGION COST SURFACE==
Line 160: Line 430:
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]


==REGION COST SURFACE==
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)
(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)
         DECISION Expr
         DECISION Expr
Line 173: Line 459:
[[Model Builder's Guide Chapter 9#Region Functions]]
[[Model Builder's Guide Chapter 9#Region Functions]]


==REGION COST SURFACE==
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(EndLocation, MaxCost, CostSurface)
(EndLocation, MaxCost, CostSurface)
DECISION Expr
DECISION Expr
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]
==REGION COST SURFACE==
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)
(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)
         DECISION Expr
         DECISION Expr
Line 189: Line 508:
cumulative cost from the cost function
cumulative cost from the cost function
[[Model Builder's Guide Chapter 9#Region Functions]]
[[Model Builder's Guide Chapter 9#Region Functions]]
==REGION LEAST COST PATH==
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(StartLocation, EndLocation)
(StartLocation, EndLocation)
DECISION Expr
DECISION Expr
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]
COST Expr[[Model Builder's Guide Chapter 9#Region Functions]]
==REGION LEAST COST PATH==(StartLocation, EndLocation, LeastCostNeighbs)
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
 
==REGION LEAST COST PATH==
(StartLocation, EndLocation, LeastCostNeighbs)
DECISION Expr[[Model Builder's Guide Chapter 9#Region Functions]]
DECISION Expr[[Model Builder's Guide Chapter 9#Region Functions]]
==REGION LEAST COST PATH==(StartLocation, EndLocation, LeastCostNeighbs, AnchorLoc)
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(StartLocation, EndLocation, LeastCostNeighbs, AnchorLoc)
DECISION Expr
DECISION Expr
Defines a region with cells that approximate
Defines a region with cells that approximate
Line 207: Line 580:
Iteration is a common aspect of models (even if it is very procedural). Most programming languages offer a “for-loop” of some kind. SELES presently provides “over index sequence” expressions as a slightly more declarative (although also more cumbersome) expression for iterating. While-loops can also be used.
Iteration is a common aspect of models (even if it is very procedural). Most programming languages offer a “for-loop” of some kind. SELES presently provides “over index sequence” expressions as a slightly more declarative (although also more cumbersome) expression for iterating. While-loops can also be used.
[[Model Builder's Guide Chapter 9#Region Functions]]
[[Model Builder's Guide Chapter 9#Region Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==REGION LOCATION==
==REGION LOCATION==
Line 216: Line 606:
                               this expression returns TRUE will be     
                               this expression returns TRUE will be     
                               included.
                               included.
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
//Note this example is out of context. //See [[Spreading1#Spreading.lse|Spreading.lse]] for the working example.
REGION LOCATION(LOCATION(NUMROWS/2, NUMCOLS/2))
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==REGION LOCATION LIST==
==REGION LOCATION LIST==
Line 226: Line 634:
                             included.  
                             included.  


==REGION LOCATION LIST==
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Region Functions]]
***
(X,n)
(X,n)
defines the region consisting of a set of n
defines the region consisting of a set of n
Line 238: Line 662:
[[Model Builder's Guide Chapter 9#Region Functions]]
[[Model Builder's Guide Chapter 9#Region Functions]]


==REGION VECTOR== (StartLocation, EndLocation) defines region consisting of cells along an
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
 
==REGION VECTOR==  
(StartLocation, EndLocation) defines region consisting of cells along an
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1:
//Note this example is out of context. It will not run in the value model.
//See [[LSStats#nn.lse|nn.lse]] for the working example.
OVER REGION VECTOR(startLocation,NNLoc)
            PatchLinks = edgeVar[rEdgeType]+1
        ENDFN
 
Example 2:
//Note this example is out of context. It will not run in the value model.
//See [[Convex Hull#ConvexHull.lse|ConvexHull.lse]] for the working example.
OVER REGION VECTOR(EdgeLocation, PivotLocation)
    DECISION !hitPivot
    IF (StudyArea > 0) // hit new vertex
        hitPivot = TRUE
        IF (EndingPivotLoc EQ -1) AND (Location NEQ PivotLocation)
          EndingPivotLoc = PivotLocation
        ENDFN
        PivotLocation = Location
    ELSE
        ConvexHull = 0 // erase
    ENDFN
  ENDFN
Example 2: 
 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Region Functions]]


==REGION WHOLE MAP==
==REGION WHOLE MAP==
Line 247: Line 727:
        returns TRUE will be included.
        returns TRUE will be included.
[[Model Builder's Guide Chapter 9#Region Functions]]
[[Model Builder's Guide Chapter 9#Region Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1:
//Note this example is out of context. It will not run in the value model.
//See [[Distance Surface#Distance.lse|Distance.lse]] for the working example. 
REGION WHOLE MAP
DECISION (StudyArea > 0) AND (SrcLayer > 0)
ENDEL
Example 2:
//Note this example is out of context. It will not run in the value model.
//See [[Convex Hull#ConvexHull.lse|ConvexHull.lse]] for the working example. 
  OVER REGION WHOLE MAP
    DECISION StudyArea > 0
    TRLoc = MAX(TRLoc, Location)
  ENDFN
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==REMOVE==
==REMOVE==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#General Set, List and Graph Functions]]
==REMOVE ALL LINKS==
==REMOVE ALL LINKS==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Graph Functions]]
==REMOVE LINK==
==REMOVE LINK==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Graph Functions]]


==RESIZE==
==RESIZE==
Line 257: Line 819:
when size is not known prior to simulation.
when size is not known prior to simulation.
[[Model Builder's Guide Chapter 9#Control Expressions]]
[[Model Builder's Guide Chapter 9#Control Expressions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1:
//Note this example is out of context. //See [[LSStats#nn.lse|nn.lse]] for the working example.
RESIZE(effectivePatchId, NP+1)
     
Example 2: 
//Note this example is out of context. //See [[LSStats#nn.lse|nn.lse]] for the working example.
RESIZE(PosList, NP+1)
SAMPLE MODELS:
<links to sample models where this function is used>
==RESPONSE==
==RESPONSE==
(Expr, #A, #B, #C) two-sided version of a standard response  
(Expr, #A, #B, #C) two-sided version of a standard response  
Line 264: Line 848:
else return 1
else return 1
[[Model Builder's Guide Chapter 9#Continuous Functions (Miscellaneous)]]
[[Model Builder's Guide Chapter 9#Continuous Functions (Miscellaneous)]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==ROUND(Expr)==
==ROUND(Expr)==
Line 279: Line 880:


SEE ALSO:  
SEE ALSO:  
[[Model Builder's Guide Chapter 9#Expressions:]]
[[Model Builder's Guide Chapter 9#Continuous Functions (Arithmetic Functions)]]


Example 1:
Example 1:
Line 288: Line 889:
<links to sample models where this function is used>
<links to sample models where this function is used>


==SEED()==
Gets the random number seed[[Model Builder's Guide Chapter 9#Control Expressions]]
==SEED==
==SEED==
(Expr) Sets the random number seed. Value returned is  
(Expr) Sets the random number seed. Value returned is  
next seed.[[Model Builder's Guide Chapter 9#Control Expressions]]
next seed.[[Model Builder's Guide Chapter 9#Control Expressions]]
==SET==
 
==SET LINK==
DESCRIPTION:
==SETAT==
 
==SETAT(Expr,PositionList,#Type)==
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
 
==SELECTAT==
 
DESCRIPTION:  
DESCRIPTION:  
A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1, and flip the bits if Type=2.
A Bit-Vector function that returns FALSE(0) if none of the bits in PositionList are set in the specified expression value and
TRUE(1) otherwise


USAGE:  
USAGE:  
   (Expr,PositionList,#Type)
   (Expr,PositionList)
        
        
REQUIRED ARGUMENTS:
REQUIRED ARGUMENTS:
Line 308: Line 924:


VALUE:  
VALUE:  
Any integer value
Either FALSE(0) or TRUE(1)


SEE ALSO: [[Model Builder's Guide Chapter 9#Bit-Vector Functions]]
SEE ALSO: [[Model Builder's Guide Chapter 9#Bit-Vector Functions]]


Example 1:
Example 1:
     The PositionList 1;4-6;27 indicates bits at positions 1,4,5,6 and 27.
     yet to be determined
 
SAMPLE MODELS:
<links to sample models where this function is used>
 
==SET==
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1
//Note this example is out of context. //See [[LSStats#centroid.lse|centroid.lse]] for the working example.
SET(patchList[i], pos1, rMaxCCE, maxCCE1)
        MaxCCE[currType] = MaxCCE[currType] + maxCCE1
        pos1 = nextPos
      ENDFN
 
Example 2: 
 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#General Set, List and Graph Functions]]
 
==SET LINK==
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 


<figure out an end example indicator. For example, ***>
Example 2: 


SAMPLE MODELS:  
SAMPLE MODELS:  
<links to sample models where this function is used>
[[Model Builder's Guide Chapter 9#Graph Functions]]


==SETAT(Expr,PositionList,#Type,#Prob)==
==SETAT==
(Expr, PositionList,#Type,#Prob) Same as above, except each position is set
***
with probability #Prob
(Expr,PositionList,#Type)
[[Model Builder's Guide Chapter 9#Bit-Vector Functions]]
DESCRIPTION:  
DESCRIPTION:  
A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1; flip the bits if Type=2; note that each position is set with probability #Prob.
A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1, and flip the bits if Type=2.


USAGE:  
USAGE:  
   (Expr,PositionList,#Type,#Prob)
   (Expr,PositionList,#Type)
        
        
REQUIRED ARGUMENTS:
REQUIRED ARGUMENTS:
Line 340: Line 996:


Example 1:
Example 1:
     The PositionList 1;4-6;27;30 indicates bits at positions 1,4,5,6 and 27, each associated with probability 30%.
     The PositionList 1;4-6;27 indicates bits at positions 1,4,5,6 and 27.
 
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
<links to sample models where this function is used>
<links to sample models where this function is used>
 
***
==SELECTAT==
(Expr,PositionList,#Type,#Prob)
(Expr, PositionList,#Type,#Prob) Same as above, except each position is set
with probability #Prob
[[Model Builder's Guide Chapter 9#Bit-Vector Functions]]
DESCRIPTION:  
DESCRIPTION:  
A Bit-Vector function that returns FALSE(0) if none of the bits in PositionList are set in the specified expression value and TRUE(1) otherwise
A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1; flip the bits if Type=2; note that each position is set with probability #Prob.


USAGE:  
USAGE:  
   (Expr,PositionList)
   (Expr,PositionList,#Type,#Prob)
        
        
REQUIRED ARGUMENTS:
REQUIRED ARGUMENTS:
Line 359: Line 1,016:


VALUE:  
VALUE:  
Either FALSE(0) or TRUE(1)
Any integer value


SEE ALSO: [[Model Builder's Guide Chapter 9#Bit-Vector Functions]]
SEE ALSO: [[Model Builder's Guide Chapter 9#Bit-Vector Functions]]


Example 1:
Example 1:
     yet to be determined
     The PositionList 1;4-6;27;30 indicates bits at positions 1,4,5,6 and 27, each associated with probability 30%.
 
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
<links to sample models where this function is used>
<links to sample models where this function is used>


==SHIFT LEFT==
==SHIFT LEFT==
Line 388: Line 1,044:
Example 1:
Example 1:
     SHIFT LEFT(7,5) means that position 7 will be shifted to position 2
     SHIFT LEFT(7,5) means that position 7 will be shifted to position 2
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
Line 411: Line 1,065:
Example 1:
Example 1:
     SHIFT RIGHT(7,5) means that position 7 will be shifted to position 12
     SHIFT RIGHT(7,5) means that position 7 will be shifted to position 12
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
Line 420: Line 1,072:
(Expr) interpret the value of the expression as an angle  
(Expr) interpret the value of the expression as an angle  
theta in degrees, and return sin(theta) [[Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)]]
theta in degrees, and return sin(theta) [[Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==SIZE LINKS==
==SIZE LINKS==
==SKEWED NORMAL CDF==
 
(Expr, Expr, Expr, Expr) skewed normal cumulative density function, where the first expression specifies the value,  
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Graph Functions]]
 
==SKEWED NORMAL==
***
(CDF)(Expr, Expr, Expr, Expr) skewed normal cumulative density function, where the first expression specifies the value,  
the second is the mode, and the third and fourth are the left and right standard deviations
the second is the mode, and the third and fourth are the left and right standard deviations
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]


==SKEWED NORMAL PDF==
DESCRIPTION:
(Expr, Expr, Expr, Expr) skewed normal probability density function,
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: 
 
Example 2: 
 
SAMPLE MODELS:
<links to sample models where this function is used>
***
(PDF)(Expr, Expr, Expr, Expr) skewed normal probability density function,
where the first expression specifies the value,
where the first expression specifies the value,
the second is the mode and the third and fourth are the standard deviations to the left and right
the second is the mode and the third and fourth are the standard deviations to the left and right
of the mode.  
of the mode.  
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==SKEWED NORMAL TEMPORAL PDF==
==SKEWED NORMAL TEMPORAL PDF==
Line 439: Line 1,161:
function
function
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]
[[Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>




==SORT==
==SORT==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#General Set, List and Graph Functions]]
==SORT LINKS==
==SORT LINKS==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>
==STRICT ORDERED==
==STRICT ORDERED==
same as LESS THAN
same as LESS THAN
[[Model Builder's Guide Chapter 9#Composite Functions]]
[[Model Builder's Guide Chapter 9#Composite Functions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>
==SUM==
==SUM==
DESCRIPTION:  
DESCRIPTION:  
Line 473: Line 1,266:
         5   
         5   
       ENDFN  
       ENDFN  
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
Line 484: Line 1,276:


==TAIL==
==TAIL==
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>
==TAN==
==TAN==
DESCRIPTION:  
DESCRIPTION:  
Line 503: Line 1,313:
   x=TAN(90)
   x=TAN(90)
     =-286411217403671.25
     =-286411217403671.25
<figure out an end example indicator. For example, ***>


SAMPLE MODELS:  
SAMPLE MODELS:  
<links to sample models where this function is used>
<links to sample models where this function is used>
[[Model Builder's Guide Chapter 9#Composite Functions]]
[[Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)]]


==UNIFORM==
==UNIFORM==
(Expr, Expr) draw a value from a uniform distribution, where the first expression determines the minimum value and the second determines the maximum
(Expr, Expr) draw a value from a uniform distribution, where the first expression determines the minimum value and the second determines the maximum
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
//Note this example is out of context. //See [[The CA model#consumeCA.lse|consumeCA.lse]] for the working example.
IF UNIFORM(0,1) < pDeathConsumer
    LSState = Uncolonised
ENDFN
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==UNIFORM TEMPORAL PDF==
==UNIFORM TEMPORAL PDF==
Line 518: Line 1,348:
<Variable> value of an independent variable <Variable>[Expr] value of a vector global variable
<Variable> value of an independent variable <Variable>[Expr] value of a vector global variable
<Variable>[Expr, Expr] value of an array global variable
<Variable>[Expr, Expr] value of an array global variable
[[Model Builder's Guide Chapter 9#Continuous Functions (Arithmetic Functions)]]
 


(Expr) value of the expression Expr + Expr sum of two expressions Expr - Expr value of the first expression minus the value
(Expr) value of the expression Expr + Expr sum of two expressions Expr - Expr value of the first expression minus the value
Line 526: Line 1,356:
root can be computed with1/n as the power.
root can be computed with1/n as the power.
| Expr | absolute value of the expression  
| Expr | absolute value of the expression  
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==WAIT UNTIL==
==WAIT UNTIL==
Line 531: Line 1,378:
communication and synchronization with
communication and synchronization with
an external application. [[Model Builder's Guide Chapter 9#Control Expressions]]
an external application. [[Model Builder's Guide Chapter 9#Control Expressions]]
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
<links to sample models where this function is used>


==WHILE==
==WHILE==
Expr While loop: process sub-expressions denoted by
Expr
“…” while the expression evaluates to TRUE
While loop: process sub-expressions denoted by “…” while the expression evaluates to TRUE
ENDFN
ENDFN
[[Model Builder's Guide Chapter 9#Control Expressions]]
 
DESCRIPTION:
 
USAGE:       
 
REQUIRED ARGUMENTS:
 
VALUE:
 
SEE ALSO:
 
Example 1: //Note this example is out of context. //See [[LSStats#stats.lse|stats.lse]]
WHILE (pos)
            patchVar [=] GET(coreAreaList[i], pos)
            pos = NEXT(coreAreaList[i], pos)
            // i = patchVar[rType]
            patchSize = patchVar[rArea]
            patchCoreSize = patchVar[rCoreArea]
            patchPerim = patchVar[rPerim]
            CASD2[i] = CASD2[i] + (patchCoreSize - MCA2[i])^2
            tCASD2 = tCASD2 + (patchCoreSize - tMCA2)^2
        ENDFN
 
Example 2: 
 
SAMPLE MODELS: [[Model Builder's Guide Chapter 9#Control Expressions]]


==ZERO==
==ZERO==
return 0.0
return 0.0
DESCRIPTION:
USAGE:       
REQUIRED ARGUMENTS:
VALUE:
SEE ALSO:
Example 1: 
Example 2: 
SAMPLE MODELS:
[[Model Builder's Guide Chapter 9#Constants]]

Latest revision as of 22:09, 15 November 2006

ONE

return 1.0

  1. Number return value of the number specified

<Constant> return value of a named constant <Constant>[Expr] return value of a named vector constant <Constant>[Expr, Expr] return value of a named array constant <Macro>[Expr] return value of expression at specified index in macro


(Expr, Expr) draw a value from a normal distribution, where the first expression specifies the mean and the second specifies the standard deviation

(Expr, Expr, Expr) draw a value from a skewed normal distribution, where the first expression specifies the mode and the second and third specify the standard deviations to the left and right of the mode (Expr, Expr) draw a value from a log normal distribution, where the first expression specifies the mean and the second specifies the standard deviation of the underlying normal distribution

(Expr, Expr) draw a value from a Weibull distribution, where the first expression specifies the beta and the second specifies alpha (Note:terminology varies between sources. The version here is equivalent to that in Excel, with reversal of parameters). DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Constants

OR

DESCRIPTION: A Boolean function operator that returns TRUE(1) if value of at least one expression is TRUE(1) and FALSE(0) otherwise.

USAGE:

  x=Expr OR Expr
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Either TRUE(1) or FALSE(0)

NOTES: The OR operator is equivalent to the addition operator. For example: if A is TRUE(1) and B FALSE(0), then A OR B means that A+B, which is 1+0 and is equal to 1(TRUE). If both A and B are TRUE(1), then A OR B becomes 1+1, the result will be greater than 0 and 1. In this case, the result for x will still be evaluated to 1(TRUE)

SEE ALSO: Model Builder's Guide Chapter 9#Composite Functions

Example 1:

   x=(2*8==16) OR (2>5) //(TRUE)
   (the result for x will be 1)

Example 2:

  x=(2*8!=4*4) OR (2>5) //(FALSE)
   (the result for x will be 0)

SAMPLE MODELS: <links to sample models where this function is used>

OUTPUT RECORD

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE:

NOTES:

SEE ALSO: Model Builder's Guide Chapter 9#Composite Functions

Example 1: //Note this example is out of context. //See centroid.lse for the working example.

OUTPUT RECORD(ClassStatsFile)
   DECISION Area[currType] > 0
   LandscapeId: LandscapeId
   Replicate: Replicate
   pType: currType
   CCE: MeanCCE[currType]
   MaxCCE: MaxCCE[currType]
   CD: MeanCD[currType]
   ENDFN

Example 2: //Note this example is out of context. //See nn.lse for the working example.

OUTPUT RECORD(ClassStatsFile)
 DECISION Area[pType] > 0
   LandscapeId: LandscapeId
   Replicate: Replicate
   pType: pType
   MNN: CellWidth * MeanNN[pType]
   MNN2: CellWidth * MeanNN2[pType]
   MinNN: CellWidth * MinNN[pType]
   MaxNN: CellWidth * MaxNN[pType]
   NNSD: CellWidth * NNSD[pType]
   NNCV: 100 * NNSD[pType] / MeanNN[pType]
   Dispersion: 2 * (NumPatches[pType] / Area[pType])^(1/2) * MeanNN[pType]
   meanMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * meanMST[pType]
   tMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * MST[pType]
   meanMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanMPG[pType]
   tMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * MPG[pType]
   nMPG: nMPG[pType]
   meanAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanAW_MPG[pType]
   tAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * AW_MPG[pType]
   nAW_MPG: nMPG[pType]
   ENDFN
  

SAMPLE MODELS: <links to sample models where this function is used>

OVER INDEX SEQUENCE

(Expr, Expr) defines linear sequence of location indices. DECISION Expr If there is a decision expression, then only those cells for which this expression returns TRUE will be included. The system variable Index holds the value of the index at each value in the sequence

Over region expressions are very frequently used to visit all cells in a landscape that meet some condition (e.g. to compute the size of the forest at initiation). Model Builder's Guide Chapter 9#Region Functions OVER RegionFunction Apply a set of sub-expressions at all spatial

  Expression	locations specified by a region function

 : ENDFN Model Builder's Guide Chapter 9#Region Functions AT LOCATION #Expr Apply a set of state-changes at a specified

  Expression	location

: ENDFN Model Builder's Guide Chapter 9#Region Functions

Matrix assignment is indicated using “[=]” instead of “=”. The proper dimensions of the component arrays must be met.

Variable [=] Variable assign variable of same dimension, or a single value to all entries Variable [=] Variable + Variable sum variables of same dimension (or with a constant) Variable [=] Variable - Variable subtract variables of same dimension (or with a constant) Variable [=] Variable * Variable matrix or scalar multiplication.

Variable [=] TRANSPOSE(Variable) matrix transposition Variable [=] Variable^-1 invert a matrix Variable = SUM(Variable) sum all entries in a matrix Variable [=] SUM ROWS (Variable) sum all rows of a matrix (result has one value per column) Variable [=] SUM COLS(Variable) sum all columns of a matrix

Variables [=] SORT(Variable, Expr) sort rows of an input matrix where rank is given by Expr. The system variable “Index” can appear in the expression and will take on the range of indices in the input array. The resulting sorted matrix will be assigned.

Variable [=] MPM_MULT(Variable, Variable) Performs a “matrix population model” (MPM) integer-based multiplication. Assumes that first matrix is two-dimensional and that second is a vector. The result is two-dimensional, where entries above diagonal represent "offspring", entries on the diagonal represent "survivors" and entries below the diagonal represent "succeeders"

Variable [=] CONTAG(Variable, Variable) Creates a “temporal contagion” matrix. Given probabilities (first parameter) for a set of states and a two-dimensional contagion array (values –1 to 1 indicating affinity), generates a matrix where each row is a prob. dist. For transitions given the row value, and the overall target dist. will be met. Model Builder's Guide Chapter 9#Matrix Functions DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See stats.lse for the working example.

OVER INDEX SEQUENCE(pType + 1, NumPTypes - 1)
           pType2 = Index
           x = IF (tTE > 0) THEN Eik[pType, pType2] / tTE ELSE 0
           tIJI = tIJI + x * LOG(x)
        ENDFN


Example 2: //Note this example is out of context. It will not run in the value model. //See stats.lse for the working example.

OVER INDEX SEQUENCE(0, NumPTypes-1)
           pType2 = Index + MinPType
           AMik = IF (TotalEdge[pType] > 0) THEN Eik[pType, pType2] / TotalEdge[pType] ELSE 0
           IJI[pType] = IJI[pType] + AMik * LOG(AMik)
           x = IF ((TotalEdge[pType] > 0) AND (Pi > 0)) THEN Pi * Eik[pType, pType2] / TotalEdge[pType] ELSE 0
           tContag = tContag + x * LOG(x)
           measuredDiversity  = measuredDiversity - AMik * LOG(AMik)
           measuredDiversity2  = IF(pType NEQ pType2) THEN  measuredDiversity2 - AMik * LOG(AMik) ELSE measuredDiversity2
           asm = asm + AMik^2
        ENDFN

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE

Halts the simulation and displays a dialog box to which the user must respond to continueModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(#Value) Pauses the simulation for the specified number of milliseconds and then continuesModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE IF

Expr If the expression evaluates to TRUE, halts the simulation and displays a dialog box to which the user must respond to continueModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE (#Value)IF

Expr If the expression evaluates to TRUE, Pauses the simulation for the specified number of milliseconds and then continuesModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PREV

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions


RECOMPUTE

Only valid in consequent expressions of ProbInit and also when ProbInit recompute flag has been set. Causes prob. surface to be recomputed before next selection Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION CENTRED

(Expr, Expr [,DistanceType][,WRAPPED]) DECISION Expr defines a region centred on the current cell. If there is a decision expression, then only those cells for which this expression returns TRUE will be included.

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note This exacmple is out of context. It will not run in the value model //See Distance.lse for the working example

REGION CENTRED(1, 1)
DECISION (StudyArea > 0) AND (SrcLayer <= 0) AND (DistanceFromSrc > (CellWidth *   DISTANCE(StartLocation, Location)))
ENDSL

Example 2: //Note This exacmple is out of context. It will not run in the value model //See FilterSmall.lse for the working example

REGION CENTRED(1, 1.5)
DECISION (Visited EQ 0) AND (FilteredPatchLayer EQ 1)
ENDSL

Example 3: //Note This exacmple is out of context. It will not run in the value model //See producer.lse for the working example

REGION CENTRED(0, 1, WRAPPED)
DECISION notEaten // don't spread if eaten (i.e. stop process)
ENDSL

Example 4: //Note This exacmple is out of context. It will not run in the value model //See GameOfLife.lse for the working example

OVER REGION CENTRED(1,1.5)
    DECISION PrevCellState EQ 1
    numNeighbs = numNeighbs + 1
 ENDFN


SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

REGION COST SURFACE

(EndLocation, MaxCost, CostSurface) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)

       DECISION Expr	
       COST Expr

Defines a region surrounding a cell with cumulative costs less than MaxCost. Stops growing when EndLocation is reached or all costs are greater than MaxCost. Second form also records gradient and anchor location layers. The CostSurface layer records the cumulative cost from the cost function Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)

       DECISION Expr	
       COST Expr

Defines a region surrounding a cell with cumulative costs less than MaxCost. Stops growing when EndLocation is reached or all costs are greater than MaxCost. Second form also records gradient and anchor location layers. The CostSurface layer records the cumulative cost from the cost function Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(StartLocation, EndLocation) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LEAST COST PATH

(StartLocation, EndLocation, LeastCostNeighbs) DECISION ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(StartLocation, EndLocation, LeastCostNeighbs, AnchorLoc) DECISION Expr Defines a region with cells that approximate the least-cost path between two cells. The first generates the cost function internally. The latter two use input information from a pre-computed cost surface region. Providing both the gradient and anchor location layers provides the most accurate approximation.

Iteration is a common aspect of models (even if it is very procedural). Most programming languages offer a “for-loop” of some kind. SELES presently provides “over index sequence” expressions as a slightly more declarative (although also more cumbersome) expression for iterating. While-loops can also be used. Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LOCATION

(Expr) DECISION Expr

                             defines the region consisting of a of a single
                             location index. If there is a decision 
                             expression, then only those cells for which 
                             this expression returns TRUE will be    
                             included.

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See Spreading.lse for the working example.

REGION LOCATION(LOCATION(NUMROWS/2, NUMCOLS/2))

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LOCATION LIST

(Number+) DECISION Expr

                            defines the region consisting of a set of  a set 
                            of known location indices. If there is a 
                            decision expression, then only those cells for
                            which this expression returns TRUE will be
                            included. 

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

(X,n) defines the region consisting of a set of n location indices stored in one-dimensional X.

REGION RECT

(Expr, Expr, Expr, Expr) defines a rectangular region. If there is a DECISION Expr decision expression defined, then only those cells for which this expression returns TRUE will be included Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION VECTOR

(StartLocation, EndLocation) defines region consisting of cells along an

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See nn.lse for the working example.

OVER REGION VECTOR(startLocation,NNLoc)
           PatchLinks = edgeVar[rEdgeType]+1
        ENDFN

Example 2: //Note this example is out of context. It will not run in the value model. //See ConvexHull.lse for the working example.

OVER REGION VECTOR(EdgeLocation, PivotLocation)
    DECISION !hitPivot
    IF (StudyArea > 0) // hit new vertex
       hitPivot = TRUE
       IF (EndingPivotLoc EQ -1) AND (Location NEQ PivotLocation)
          EndingPivotLoc = PivotLocation
       ENDFN
       PivotLocation = Location
    ELSE
       ConvexHull = 0 // erase
    ENDFN
 ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

REGION WHOLE MAP

DECISION Expr

                       defines the region consisting of the entire
                       landscape. If there is a decision expression, 

then only those cells for which this expression returns TRUE will be included. Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See Distance.lse for the working example.

REGION WHOLE MAP
DECISION (StudyArea > 0) AND (SrcLayer > 0)
ENDEL

Example 2: //Note this example is out of context. It will not run in the value model. //See ConvexHull.lse for the working example.

  OVER REGION WHOLE MAP
    DECISION StudyArea > 0
    TRLoc = MAX(TRLoc, Location)
 ENDFN

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REMOVE

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

RESIZE

(Variable, Expr) Changes size (number of entries) in a global variable. Values are not maintained. Useful for when size is not known prior to simulation. Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See nn.lse for the working example.

RESIZE(effectivePatchId, NP+1)
     

Example 2: //Note this example is out of context. //See nn.lse for the working example.

RESIZE(PosList, NP+1)

SAMPLE MODELS: <links to sample models where this function is used>

RESPONSE

(Expr, #A, #B, #C) two-sided version of a standard response function for the value X of the first expression: if (X < A) return e^(-(X-A)^2/(2*(C^2)) else if (X > B) return e^(-(X-B)^2/(2*(C^2)) else return 1 Model Builder's Guide Chapter 9#Continuous Functions (Miscellaneous)

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

ROUND(Expr)

DESCRIPTION: The rounding operator

USAGE:

  x=ROUND(Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Expression value rounded to the nearest integer

SEE ALSO: Model Builder's Guide Chapter 9#Continuous Functions (Arithmetic Functions)

Example 1:

  x=ROUND(0.773)
   =1

SAMPLE MODELS: <links to sample models where this function is used>

SEED

(Expr) Sets the random number seed. Value returned is next seed.Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SELECTAT

DESCRIPTION: A Bit-Vector function that returns FALSE(0) if none of the bits in PositionList are set in the specified expression value and TRUE(1) otherwise

USAGE:

  (Expr,PositionList)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Either FALSE(0) or TRUE(1)

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   yet to be determined

SAMPLE MODELS: <links to sample models where this function is used>

SET

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See centroid.lse for the working example.

SET(patchList[i], pos1, rMaxCCE, maxCCE1)
        MaxCCE[currType] = MaxCCE[currType] + maxCCE1
        pos1 = nextPos
     ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

SETAT

(Expr,PositionList,#Type) DESCRIPTION: A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1, and flip the bits if Type=2.

USAGE:

  (Expr,PositionList,#Type)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   The PositionList 1;4-6;27 indicates bits at positions 1,4,5,6 and 27.

SAMPLE MODELS: <links to sample models where this function is used>

(Expr,PositionList,#Type,#Prob) (Expr, PositionList,#Type,#Prob) Same as above, except each position is set with probability #Prob Model Builder's Guide Chapter 9#Bit-Vector Functions DESCRIPTION: A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1; flip the bits if Type=2; note that each position is set with probability #Prob.

USAGE:

  (Expr,PositionList,#Type,#Prob)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   The PositionList 1;4-6;27;30 indicates bits at positions 1,4,5,6 and 27, each associated with probability 30%.

SAMPLE MODELS: <links to sample models where this function is used>


SHIFT LEFT

DESCRIPTION: A Bit-Vector function that shifts value of first expression to the left by number of bits specified by second expression

USAGE:

  SHIFT LEFT(Expr,Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   SHIFT LEFT(7,5) means that position 7 will be shifted to position 2

SAMPLE MODELS: <links to sample models where this function is used>

SHIFT RIGHT

DESCRIPTION: A Bit-Vector function that shifts value of first expression to the right by number of bits specified by second expression

USAGE:

  SHIFT RIGHT(Expr,Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   SHIFT RIGHT(7,5) means that position 7 will be shifted to position 12

SAMPLE MODELS: <links to sample models where this function is used>

SIN

(Expr) interpret the value of the expression as an angle theta in degrees, and return sin(theta) Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>


DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

SKEWED NORMAL

(CDF)(Expr, Expr, Expr, Expr) skewed normal cumulative density function, where the first expression specifies the value, the second is the mode, and the third and fourth are the left and right standard deviations Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(PDF)(Expr, Expr, Expr, Expr) skewed normal probability density function, where the first expression specifies the value, the second is the mode and the third and fourth are the standard deviations to the left and right of the mode. Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SKEWED NORMAL TEMPORAL PDF

(Expr, Expr, Expr, Expr) temporal skewed normal probability density function Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>


SORT

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

STRICT ORDERED

same as LESS THAN Model Builder's Guide Chapter 9#Composite Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SUM

DESCRIPTION: Returns the number that is the sum of all the expressions.

USAGE:

  x=SUM 
      Expr
      ...  
    ENDFN

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value.

VALUE: the sum of all the arguments.

SEE ALSO: <a link to the composite functions section of seles modellers guide>

EXAMPLES: <add carriage return here> Example 1:

  y = 3
  x = SUM  
        y  
        y+2  
        5  
      ENDFN 

SAMPLE MODELS: <links to sample models where this function is used> Model Builder's Guide Chapter 9#Composite Functions

DIVIDE successive division of the sub-expressions

Model Builder's Guide Chapter 9#Composite Functions

TAIL

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

TAN

DESCRIPTION: The tan function operator

USAGE:

  x=TAN(Expr)

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value.

VALUE: Interpret the value of the expression as an angle theta in degrees, and return cos(theta)

SEE ALSO: <a link to the composite functions section of seles modellers guide>

Example 1:

  x=TAN(90)
   =-286411217403671.25

SAMPLE MODELS: <links to sample models where this function is used> Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)

UNIFORM

(Expr, Expr) draw a value from a uniform distribution, where the first expression determines the minimum value and the second determines the maximum

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See consumeCA.lse for the working example.

IF UNIFORM(0,1) < pDeathConsumer
   LSState = Uncolonised
ENDFN

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

UNIFORM TEMPORAL PDF

(Expr, Expr, Expr) temporal uniform probability density expression Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

<Variable> value of an independent variable <Variable>[Expr] value of a vector global variable <Variable>[Expr, Expr] value of an array global variable


(Expr) value of the expression Expr + Expr sum of two expressions Expr - Expr value of the first expression minus the value of the second expression Expr * Expr product of two expressions Expr / Expr value of the first expression divided by value of the second expression Expr ^ Expr value of the first expression to the power of the value of the second expression. An nth root can be computed with1/n as the power. | Expr | absolute value of the expression

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

WAIT UNTIL

Expr Suspend execution until the expression returns TRUE (1). This is intended for controlling communication and synchronization with an external application. Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

WHILE

Expr While loop: process sub-expressions denoted by “…” while the expression evaluates to TRUE ENDFN

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See stats.lse

WHILE (pos)
           patchVar [=] GET(coreAreaList[i], pos)
           pos = NEXT(coreAreaList[i], pos)
           // i = patchVar[rType]
           patchSize = patchVar[rArea]
           patchCoreSize = patchVar[rCoreArea]
           patchPerim = patchVar[rPerim]
           CASD2[i] = CASD2[i] + (patchCoreSize - MCA2[i])^2
           tCASD2 = tCASD2 + (patchCoreSize - tMCA2)^2
        ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Control Expressions

ZERO

return 0.0

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Constants