Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

A fully scalable model with 'loop()'

[Example Model: Space2.json; Space.txt must also be opened]

datasources: {
sun_data: { type: "csv", connection: "Space.txt", 
    indexCols: ['time'], valueCols: ['sun1x', 'sun1y', 'sun2x', 'sun2y']
	}
    },
 
formulas: {
"loop(t in 2..time)" : {    
"direction[t]": { dimensions: ['time'], value: 1.570796327, formula: "direction[t-1] + change[t]" },

"Vx[t]": { dimensions: ['time'], value: 0, formula: "Vx[t-1] + COS(direction[t])*blast[t] + x1grav[t-1] x2grav[t-1]" },
...
}
}

In this example, the dimensioning and initialization of arrays is performed inside the loop. The difference between this example and the previous example is that here an index set is determined through a data source binding. (All arrays with constants are put in an external source of type CSV and imported into the model through binding. For more information, see the Data section within the RASON Reference Guide.)

Notice that loop() is used in the formulas section and does not define any constraints. If, when evaluating a given constraint, the RASON Interpreter finds that a given part of a constraint formula depends on another formula, the whole loop must execute in sequence in order to determine the needed precedent.

Back to A Simple Loop