Uploading External Data Files
A few optimization, decision table and data science examples require input files such as csv files or a Microsoft ExcelTM workbook. If solving one of
these data source example models, you must download the input files by clicking the Download RASON Example Data icon (cloud icon) on the Editor ribbon.
The compressed file, datafiles.zip, will be downloaded; unzip these files into a desired location. You can determine if the example uses an external
data source by inspecting the dataSources section of the RASON model. As an illustration, open the example ProductMixCsv1.json under Linear Optimizations
in the Example RASON model list.
This example imports 3 external dataSources, parts_data, invent_data and profit_data, exports 2 files containing the results of the solve, fcns_data and
obj_data, and uses 1 file to import the starting values of the variables and then exports back the final variable values, vars_data.
{
"modelName": "productMixCsv1Example",
"modelType": "optimization",
"modelDescription": "Example of using CSV table binding to read params
and save results",
"datasources": {
"parts_data": {
"type": "csv",
"connection": "ProductMixParts.txt",
"indexCols": [
"parts",
"prods"
],
"valueCols": [
"qty"
],
"direction": "import"
},
"invent_data": {
"type": "csv",
"connection": "ProductMixInventory.txt",
"indexCols": [
"parts"
],
"valueCols": [
"inventory"
],
"direction": "import"
},
"profit_data": {
"type": "csv",
"connection": "ProductMixProfits.txt",
"indexCols": [
"prods"
],
"valueCols": [
"profits"
],
"direction": "import"
},
"vars_data": {
"type": "csv",
"connection": "ResultVarsInit.txt",
"indexCols": [
"prods"
],
"valueCols": [
"initials"
],
"direction": "import/export"
},
"fcns_data": {
"type": "csv",
"connection": "ResultFcns.txt",
"direction": "export"
},
"obj_data": {
"type": "csv",
"connection": "ResultObj.txt",
"direction": "export"
}
},
All data sources containing the property "direction": "import" must first be uploaded. Data contained in an external source file may be uploaded by
using Choose Files on the Properties pane on the right of the Editor page. External data can be used in two ways. 1. As constant values or data 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 endpoint), "mssql" (Microsoft SQL), "oracle" (Oracle database), csv (Comma Separated Value), "json"
(JSON file), or "xml" (XML file). For more information on using external data sources, please see Data Sources within the RASON Reference Guide.
To upload the files that are importing data onto the RASON server, click Choose Files on the right, browse to the location where you saved the files
and click OK. Files that will contain exported data do not need to be uploaded.
Once the files are uploaded, solving the model proceeds as normal by calling:
- POST rason.net/api/model to post the model, along with the data files, to the RASON server and obtain a resource ID.
- POST rason.net/api/model/{nameorid}/solvetype where
- solvetype = solve, optimize, simulate, datamine, decision or diagnose
- nameorid = resource ID obtained from the call to POST rason.net/api/model
- GET rason.net/api/model/{nameorid}/status where
- nameorid is the new model instance obtained from the call to POST rason.net/api/model/{nameorid}/solvetype
- GET rason.net/api/model/{nameorid}/result where
- nameorid is the model instance obtained from the call to POST rason.net/api/model/{nameorid}/solvetype
Twelve different examples illustrate how to score labeled and unlabeled data. All can be found under RASON Examples – Scoring.
These examples all include at least one input data file and one fitted model. All fitted models are generated using a previous classification,
regression or transformation Rason model. Although it is not necessary to run the classification, regression or transformation model in order
to first generate the fitted model, this has already been done for you -- they can be found in datafiles.zip-- although, it is a good idea to do so."
See the RASON Editor Page section within the RASON Services Web IDE chapter in the RASON User Guide for more details on which
input files are required to successfully solve each RASON example.
|