Non-parallel array formulas
"constraints" : {
"num_used": {
"dimensions": [5],
"formula": "formula: "MMULT(parts, x)",
"upper": :"inventory"
}
},
Code snippet taken from the example, nonParallelArray.json. Click RASON Examples -- Example Models using Arrays Loops and Tables -- Using an Excel Function for a formula or constraint to open.
This type of array formula is interpreted (evaluated) once. The elements of the array are not computed through parallel, element-by-element operations. Instead, the array is produced tby the internal algorithm
of the function used in the formula. In this example, MMULT performs a matrix-vector multiplication and returns an array with 5 elements.
The result of this evaluation is assigned to the array variable num_used, which is defined as a 1-D vertical array of size 5. If this formula appears in the constraints section, the RASON
automatically generates one constraint for each element of the resulting array.
In general, a non-parallel array formula may return a one-dimensional (horizontal or vertical) array or a two-dimensional array, even when table rows or columns are referenced in the formula. The
biggest disadvantage of this array formula type is that it prevents reverse-mode evaluation, which is significantly faster than the standard forward evaluation.
|