Arrays and tables in indexed array formulas
Currently the RASON modeling language supports arrays with up to 2 dimensions. If you require a structure with more than 2 dimensions, you must use a table instead. Tables provide several advantages over arrays:
- Tables may have more than 2 dimensions
- A table result may be used in an indexed array formula
- A table may be sparse, whereas arrays are always dense
- Evaluating a table is generally less computationally expensive than evaluating an array with more than two dimensions
The example below shows how an indexed array formula is assigned to a table.
...
"constraints": {
"comment": "Demand satisfaction, capacity limits, and flow balance",
"for(c in customers, p in products)": {
"comment": "Ensure all customer demand is met",
"d_con": {
"formula": "sum(w_c_num[c,p,]) + sum(f_c_num[c,p,]) - demand[c,p]",
"lower": 0,
"finalValue": []
}
},
},
...
Code snippet taken from the example, Using Sum Aggregate. Click RASON Examples -- Example Models using Arrays Loops and Tables to open.
|