Rule Solver allows creators of business decision models to define constrained (unknown) variables using the predefined templates. Here is an example of defining decision variables using the column “SolverDefineVariables“:

This column may use 1, 2, or 3 parameters and you don’t need to define sub-columns for empty parameters. You may have multiple decision tables with columns of the type “SolverDefineVariables”.
Here are Solver’s methods for defining new constrained variables, expressions, or their arrays.
| Method Name | Parameters |
|---|---|
| NewVar or New Variable | Creates a new constrained integer variable using two parameters: Par 1 defines a minimal value. Par 2 defines a maximal value. Sample decision models: “XYZ” and “MapColoring“ |
| NewStringVar or New String Variable | Creates a new constrained text variable using one parameter: Par 1 defines an array of strings with possible text values. Sample decision model: “MapColoringPreferences“ |
| NewVariables or New Variables | Creates a new array of constrained integer variables using 3 parameters: Par 1 defines an array of strings with the names of variables. Par 2 defines a minimal value. Par 3 defines a maximal value. Sample decision model: “Zebra” (DefineVariables) |
| VarOperValue or Variable Operator Value | Creates a new constrained integer expression using three parameters: Par 1 defines a name of the existing constrained variable (expression). Par 2 defines an operator such as “+”, “-“, “*”, “/”, “=”, “!=”, “>”, “>=”, “<=”, “<“. Par 3 defines a value. Sample decision models: “Zebra” (DefineExpressions) |
| VarOperVar or Variable Operator Variable | Creates a new constrained integer expression using three parameters: Par 1 defines a name of the first constrained variable (expression). Par 2 defines an operator such as “+”, “-“, “*”, “/”, “=”, “!=”, “>”, “>=”, “<=”, “<“. Par 3 defines a name of the second constrained variable (expression). Sample decision models: “XYZ” (DefineVariables) |
| AddVar or Ad Variable | Adds previously created constrained variable defined in Par 1 to the array defined in the first column. If the array does not exist, it will be created. |
| AddVarOperValue or Add Variable Operator Value | Adds a new constrained expression to the array defined in the first column. The expression is the same as in the method “VarOperValue”. |
| AddVarOperVar or Add Variable Operator Variable | Adds a new constrained expression to the array defined in the first column. The expression is the same as in the method “VarOperVar”. |
| Sum | Creates a sum of all constrained variables in the array defined in Par 1 |
| ScalarProduct or Scalar Product | Creates a scalar product of constrained variables defined in Par 1 and a regular integer array of coefficients defined in Par 2. |
| Prod | Creates a product of all constrained variables in the array defined in Par 1 |
| ScalarProduct or Scalar Product | Creates a scalar product of constrained variables defined in Par 1 and a regular integer array of coefficients defined in Par 2. |
| Assign | After a solution is found, assigns a found value of the constrained variable in Par 1 to a regular decision variable defined in Par 2 |
