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
Supported FEEL Functions
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 simple 'for()' with index set and array assignment

[Example Model: UGProductMixTab3 -- To open, click RASON Examples - Example Models discussed in RASON User Guide.]

indexSets : {
    part: { value: ['chas','tube','cone','psup','elec'] },
          prod: { value: ['tv','stereo','speaker'] }
    ],
data : {
    parts : { indexCols: ['part', 'prod'],

	     value: [['chas', 'tv', 1],
			['elec', 'stereo', 1],			
			['tube', 'tv', 1],
			['cone', 'tv', 2],
			['cone', 'stereo', 2],
			['chas', 'stereo', 1],
			['cone', 'speaker', 1],
			['psup', 'tv', 1],
			['psup', 'stereo', 1],
			['elec', 'tv', 2],
			['elec', 'speaker', 1]]
    },
    inventory: { dimensions: ['part'], value: [450, 250, 800, 450, 600] }
},
constraints: {
  "for(p in 'part')": {
    "cons[p]": { formula: "sumproduct(parts[p,], x)", upper: 'inventory' }
   }
}

In the example above, five constraints are again defined in the vertical array cons[]. As before, cons[] is defined as an array (rather than a table) because its upper bound, inventory, is a vertical array. In this case, however, the index p comes from an index set. Note that x is not transposed, because parts is a table and the row of the parts table indexed by p, parts[p,], always evaluates to a vertical array.

Back to Simple For