Using the Binding Property
What if you wanted to temporarily change the values of the Profit array in order to (say) create a "what if" scenario: "What if", we raised the
price of each product by $25? The binding property within the RASON Modeling language serves two functions, one of which is allowable write access
to a table or array outside of the RASON model environment. For example, passing binding: "get" to the profits array within the
data section would allow us to change the values for this array directly, through a REST API call.
data: {
profits: { dimensions: [3], value: [75, 50, 35], binding: "get", finalValue: []
},
To change the array elements in profits to 100, 75, 50; pass the following to a REST API call, via standard HTTP GET parameters,
for example:
$.get(https://rason.net/api/optimize?profits=100,75,50...
To change only one element, say the middle element from 50 to 60, use:
$.get(https://rason.net/api/optimize?profits[2]=60...
What if our data is contained within an outside datasource, such as an SQL database? As mentioned earlier, the RASON V2020 makes it exceptionally
easy to work with data sources in the Microsoft ecosystem, such as:
- OneDrive and OneDrive for Business
- Common Data Service for Dynamics 365, Power Apps and Power Automate
- OData and CDS support for Power BI
- CData Cloud Hub support for access to 100+ enterprise data sources
External data sources may be defined in the (optional) dataSources section. Data from an outside datasource is imported into
parametric tables or arrays to be used in 1. formula calculations or 2. as initial starting points for decision variables in a nonlinear optimization
model. Currently the RASON modeling language supports nine different data types: "excel" (Microsoft Excel), "access" or "msaccess" (Microsoft Access),
"odbc" (ODBC database), "odata" (ODATA database), "mssql" (Microsoft SQL), "oracle" (Oracle database), CSV (Comma Separated Value), "json" (JSON file),
or "xml" (XML file). Data sources such as "SQL", "ODBC" and "CSV" contain data in tables with records described by index and value columns. Binding
to these data sources results in table objects. Data source types such as Excel and CSV may contain data in 2-dimensional arrays without any descriptions.
Binding to these data sources results in array objects. Objects must be bound to data sources within the data section. However, if exporting the results
of a solve, we must bind to objects within the variables, constraints, objective,
uncertainVariables and uncertainFunctions sections. See the chapter "Using the REST API" for detailed
information on how to create a new data connection and then use this connection in your RASON model.
Solving the Model
Optimization models written in the Rason modeling language can be solved in two different ways: 1. Using the RASON REST Server or 2.
Calling the Solver SDK directly. You can call the RASON REST server by using the RASON Web IDE on the website www.rason.com or by using the
RASON REST API from within your own application. You can call the Solver SDK directly using the RASON Modeling language by using the RASON
Desktop IDE or by calling prob.load within a programming language such as C# or Java. No matter how you solve the model, the result will
always be valid JSON. See the chapter "Solving RASON Models" for complete details on how to run a simulation model from the Editor page on
www.RASON.com.
|