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

The SUM Aggregate Function

Currently, the RASON modeling language supports one aggregation statement which may be used to summarize a formula, the sum formula. Similar to for(), sum() is a statement that behaves not as a programming language loop, but rather as an attribute to its assigned formula. The sum() function computes a formula for a given set of indices.

sum(p in 'POT', g in 'GRADE'): {
   cost: { formula: "AMT[p, g] * Prem_Cost[g]"}
}

The formula for cost will be computed for each index and the sum of all resultant products will be calculated.

Note: The RASON language sum() statement described above should not be confused with the sum() function that may exist within a formula.

In this example code, AMT is an array, indexed by p and g and Prem_Cost is an array, indexed by g. If AMT[p,g] is a 2x2 matrix

1 1

2 2

and Prem_Cost[g] is a 2 x 1 vertical array

6

9

then PremiumCost will equal 45 (1 * 6 + 1 * 9 + 2 * 6 + 2 * 9).

Back to Advanced Indexed Array Formulas