@frontlinesystems/rason-mcp-server 2026.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +35 -0
- package/README.md +282 -0
- package/examples/EXAMPLES_REFERENCE.md +128 -0
- package/examples/Optimization/Conic/AirlineHubConic.json +112 -0
- package/examples/Optimization/Conic/AirlineHubConic2.json +109 -0
- package/examples/Optimization/Conic/AirlineHubConic3.json +112 -0
- package/examples/Optimization/Conic/AirlineHubConic4.json +100 -0
- package/examples/Optimization/Conic/AirlineHubConic5.json +102 -0
- package/examples/Optimization/DataBinding/ProductMixCsv.json +82 -0
- package/examples/Optimization/DataBinding/ProductMixCsv4.json +96 -0
- package/examples/Optimization/DataBinding/ProductMixExcel.json +74 -0
- package/examples/Optimization/DataBinding/ProductMixExcel1.json +87 -0
- package/examples/Optimization/DataBinding/ProductMixExcel11.json +109 -0
- package/examples/Optimization/DataBinding/ProductMixExcel2.json +78 -0
- package/examples/Optimization/DataBinding/ProductMixTab.json +90 -0
- package/examples/Optimization/DataBinding/ProductMixTab1.json +74 -0
- package/examples/Optimization/DataBinding/ProductMixTab2.json +78 -0
- package/examples/Optimization/Linear/Inventory.json +200 -0
- package/examples/Optimization/Linear/Matop.json +120 -0
- package/examples/Optimization/Linear/ProductMix.json +98 -0
- package/examples/Optimization/Linear/ProductMix2.json +73 -0
- package/examples/Optimization/Linear/ProductMix3.json +50 -0
- package/examples/Optimization/Linear/ProductMix4.json +57 -0
- package/examples/Optimization/Linear/ProductMixCsv1.json +106 -0
- package/examples/Optimization/Linear/ProductMixCsv2.json +106 -0
- package/examples/Optimization/Linear/ProductMixSQL11.json +82 -0
- package/examples/Optimization/Linear/Rowop.json +127 -0
- package/examples/Optimization/NonLinear/AirlineHub.json +64 -0
- package/examples/Optimization/NonLinear/AirlineHub2.json +48 -0
- package/examples/Optimization/NonLinear/AirlineHub3.json +48 -0
- package/examples/Optimization/NonSmooth/Inventory2.json +160 -0
- package/examples/Optimization/Quadratic/PortfolioOpt.json +56 -0
- package/examples/Optimization/Quadratic/PortfolioOpt2.json +66 -0
- package/examples/Optimization/WithUncertainty/GasCompanyChance.json +79 -0
- package/examples/Optimization/WithUncertainty/GasCompanyRecourse.json +79 -0
- package/examples/Optimization/WithUncertainty/ProjectSelect.json +78 -0
- package/examples/Optimization/WithUncertainty/ProjectSelect2.json +82 -0
- package/examples/Optimization/WithUncertainty/ProjectSelect3.json +85 -0
- package/examples/Optimization/WithUncertainty/ProjectSelect4.json +75 -0
- package/examples/Simulation/CandyStoreSalesUsingSIP.json +148 -0
- package/examples/Simulation/CollegeFundGrowth1.json +424 -0
- package/examples/Simulation/CollegeFundGrowth1SIPModel.json +28 -0
- package/examples/Simulation/CollegeFundGrowth2.json +416 -0
- package/examples/Simulation/CollegeFundGrowthSIP.json +402 -0
- package/examples/Simulation/GBMSimulationModel.json +237 -0
- package/examples/Simulation/YieldManagement(Sim).json +70 -0
- package/examples/Simulation/YieldManagement2(Sim).json +73 -0
- package/examples/calculation/DMNExamples/DMN Box Fun with typeDef result.json +54 -0
- package/examples/calculation/DMNExamples/DMN Context example.json +69 -0
- package/examples/calculation/DMNExamples/DMN DT with typeDef result.json +43 -0
- package/examples/calculation/DMNExamples/FEEL Date Time example.json +28 -0
- package/examples/calculation/DMNExamples/FEEL For iteration example.json +66 -0
- package/examples/calculation/DMNExamples/FEEL For with two indices.json +16 -0
- package/examples/calculation/DMNExamples/FEEL For with typeDef result.json +88 -0
- package/examples/calculation/DMNExamples/FEEL If Then Else example.json +26 -0
- package/examples/calculation/DMNExamples/FEEL List example.json +38 -0
- package/examples/calculation/DMNExamples/FEEL List operator.json +17 -0
- package/examples/calculation/DMNExamples/FEEL List with typeDef collection.json +37 -0
- package/examples/calculation/DMNExamples/FEEL Some or Every example.json +66 -0
- package/examples/calculation/DecisionTables/DT Datasource example.json +53 -0
- package/examples/calculation/DecisionTables/DT Date and Time examples.json +92 -0
- package/examples/calculation/DecisionTables/DT Expression example.json +32 -0
- package/examples/calculation/DecisionTables/DT Hit Policy examples.json +137 -0
- package/examples/calculation/DecisionTables/DT Loan Recommend model.json +82 -0
- package/examples/calculation/DecisionTables/DT Loan Strategy Model and Predictive CSV-XML.json +219 -0
- package/examples/calculation/DecisionTables/DT Loan Strategy model and Datasource.json +286 -0
- package/examples/calculation/DecisionTables/DT Loan Strategy model and Predictive.json +204 -0
- package/examples/calculation/DecisionTables/DT Loan Strategy model by scratch.json +214 -0
- package/examples/calculation/DecisionTables/DT Output Order example.json +40 -0
- package/examples/calculation/DecisionTables/DT Unique example.json +39 -0
- package/examples/calculation/TypeDefinitions/TypeDefCF.json +65 -0
- package/examples/calculation/TypeDefinitions/TypeDefDT.json +58 -0
- package/examples/datamining/AffinityAnalysis/AssociationRules.json +52 -0
- package/examples/datamining/Classification/DecisionTree.json +91 -0
- package/examples/datamining/Classification/DiscriminantAnalysis.json +82 -0
- package/examples/datamining/Classification/Ensembles/Bagging.json +67 -0
- package/examples/datamining/Classification/Ensembles/Boosting.json +68 -0
- package/examples/datamining/Classification/Ensembles/RandomTrees.json +92 -0
- package/examples/datamining/Classification/FindBestModel.json +87 -0
- package/examples/datamining/Classification/LogisticRegression.json +83 -0
- package/examples/datamining/Classification/NaiveBayes.json +79 -0
- package/examples/datamining/Classification/NearestNeighbors.json +85 -0
- package/examples/datamining/Classification/NeuralNetwork.json +93 -0
- package/examples/datamining/Clustering/Hierarchical.json +55 -0
- package/examples/datamining/Clustering/KMeans.json +72 -0
- package/examples/datamining/DataSources/DelimitedFile.json +50 -0
- package/examples/datamining/DataSources/JSONFile.json +50 -0
- package/examples/datamining/DataSources/MSAccessDatabase.json +50 -0
- package/examples/datamining/DataSources/MSExcelTable.json +51 -0
- package/examples/datamining/DataSources/MSSQLDatabase.json +50 -0
- package/examples/datamining/DataSources/ODATATable.json +50 -0
- package/examples/datamining/DataSources/ODBCDatabase.json +50 -0
- package/examples/datamining/FeatureSelection/LinearWrapping.json +54 -0
- package/examples/datamining/FeatureSelection/LogisticWrapping.json +57 -0
- package/examples/datamining/FeatureSelection/Univariate.json +79 -0
- package/examples/datamining/Regression/DecisionTree.json +82 -0
- package/examples/datamining/Regression/Ensembles/Bagging.json +63 -0
- package/examples/datamining/Regression/Ensembles/Boosting.json +63 -0
- package/examples/datamining/Regression/Ensembles/RandomTrees.json +79 -0
- package/examples/datamining/Regression/FindBestModel.json +87 -0
- package/examples/datamining/Regression/LinearRegression.json +125 -0
- package/examples/datamining/Regression/NearestNeighbors.json +78 -0
- package/examples/datamining/Regression/NeuralNetwork.json +83 -0
- package/examples/datamining/Scoring/JSONClassifier.json +63 -0
- package/examples/datamining/Scoring/JSONClassifierNN.json +63 -0
- package/examples/datamining/Scoring/JSONClusterizer.json +38 -0
- package/examples/datamining/Scoring/JSONForecaster.json +50 -0
- package/examples/datamining/Scoring/JSONLinearRegression.json +57 -0
- package/examples/datamining/Scoring/JSONPCA.json +42 -0
- package/examples/datamining/Scoring/JSONRegressor.json +57 -0
- package/examples/datamining/Scoring/JSONTransformer.json +39 -0
- package/examples/datamining/Scoring/PMMLClassifier.json +43 -0
- package/examples/datamining/Scoring/PMMLForecaster.json +44 -0
- package/examples/datamining/Scoring/PMMLRegressor.json +39 -0
- package/examples/datamining/Scoring/PMMLTransformer.json +39 -0
- package/examples/datamining/Simulation/LinearRegressionSimulation.json +118 -0
- package/examples/datamining/Simulation/SyntheticDataGeneration.json +109 -0
- package/examples/datamining/Simulation/pmml-risk-scoring.json +63 -0
- package/examples/datamining/Summarizer/Summarization.json +55 -0
- package/examples/datamining/TextMining/LatentSemanticAnalysis.json +52 -0
- package/examples/datamining/TextMining/TfIdf-FileData.json +66 -0
- package/examples/datamining/TextMining/TfIdf-InlineData.json +56 -0
- package/examples/datamining/TimeSeries/AddHoltWinters.json +80 -0
- package/examples/datamining/TimeSeries/Arima.json +75 -0
- package/examples/datamining/TimeSeries/DoubleExponential.json +66 -0
- package/examples/datamining/TimeSeries/Exponential.json +65 -0
- package/examples/datamining/TimeSeries/LagAnalysis.json +49 -0
- package/examples/datamining/TimeSeries/MovingAverage.json +66 -0
- package/examples/datamining/TimeSeries/MulHoltWinters.json +66 -0
- package/examples/datamining/TimeSeries/NoTrendHoltWinters.json +66 -0
- package/examples/datamining/Transformation/Binning.json +70 -0
- package/examples/datamining/Transformation/CanonicalVariateAnalysis.json +48 -0
- package/examples/datamining/Transformation/CategoryReduction.json +52 -0
- package/examples/datamining/Transformation/Factorization.json +51 -0
- package/examples/datamining/Transformation/MissingDataHandling.json +84 -0
- package/examples/datamining/Transformation/OneHotEncoding-DataInline.json +55 -0
- package/examples/datamining/Transformation/OneHotEncoding-DatainFile.json +49 -0
- package/examples/datamining/Transformation/PartitionTimeSeries.json +49 -0
- package/examples/datamining/Transformation/Partitioning-DF.json +73 -0
- package/examples/datamining/Transformation/Partitioning.json +47 -0
- package/examples/datamining/Transformation/PartitioningWithOversampling-DF.json +66 -0
- package/examples/datamining/Transformation/PartitioningWithOversampling.json +45 -0
- package/examples/datamining/Transformation/PrincipalComponentsAnalysis.json +53 -0
- package/examples/datamining/Transformation/Rescaling.json +68 -0
- package/examples/datamining/Transformation/Sampling.json +44 -0
- package/examples/datamining/Transformation/StratifiedSampling.json +47 -0
- package/examples/flow/SQLServerTransform.json +261 -0
- package/examples/flow/dm-calc-pipeline.json +278 -0
- package/examples/flow/dm-pipeline-simulation.json +114 -0
- package/examples/flow/opt-sim-pipeline.json +160 -0
- package/examples/flow/sim-dm-pipeline.json +107 -0
- package/examples/flow/sim-sim-pipeline.json +137 -0
- package/examples/index.json +4679 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/DataFiltering/ListwithFilter.json +53 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/ProductMix5.json +58 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/compoundWhileStatement.json +36 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/ifThenElseStatement.json +34 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/nestedLoop.json +26 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/ParallelArray.json +48 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/indexedArray.json +70 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/nonParallelArray.json +50 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/sumAggregateExample.json +338 -0
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/tsp.json +62 -0
- package/examples/rason-features/BoxIterators/Box_Fun_Loop_Iter_Sim_RASON.json +191 -0
- package/examples/rason-features/BoxIterators/Box_Fun_Loop_Sim_RASON.json +76 -0
- package/examples/rason-features/BoxIterators/Box_Fun_Sim_RASON.json +109 -0
- package/examples/rason-features/BoxIterators/Box_Iter_SIM_RASON.json +69 -0
- package/examples/rason-features/BoxIterators/Box_Iterator_Calc_Loop.json +183 -0
- package/examples/rason-features/BoxIterators/Box_Iterator_with_typeDef_partial.json +79 -0
- package/examples/rason-features/BoxLambdaExamples/BoxFunOptimize.json +155 -0
- package/examples/rason-features/BoxLambdaExamples/BoxFunSimulate.json +119 -0
- package/examples/rason-features/BoxLambdaExamples/LambdaFunOptimize.json +143 -0
- package/examples/rason-features/BoxLambdaExamples/LambdaFunSimulate.json +82 -0
- package/examples/rason-features/ReferenceGuide/RGFirehouseLocation.json +69 -0
- package/examples/rason-features/ReferenceGuide/RGFirehouseLocationConic.json +114 -0
- package/examples/rason-features/ReferenceGuide/RGProductMixCsv1.json +108 -0
- package/examples/rason-features/ReferenceGuide/RGProductMixExcel11.json +117 -0
- package/examples/rason-features/ReferenceGuide/RGProductMixSQL11.json +108 -0
- package/examples/rason-features/UserGuide/UGAirlineHubCSV.json +67 -0
- package/examples/rason-features/UserGuide/UGForecast.json +51 -0
- package/examples/rason-features/UserGuide/UGProductMix1.json +49 -0
- package/examples/rason-features/UserGuide/UGProductMix2.json +49 -0
- package/examples/rason-features/UserGuide/UGProductMixTab1.json +68 -0
- package/examples/rason-features/UserGuide/UGProductMixTab2.json +77 -0
- package/examples/rason-features/UserGuide/UGProductMixTab3.json +67 -0
- package/examples/rason-features/UserGuide/UGProductMixTab4.json +71 -0
- package/examples/rason-features/UserGuide/UGProductMixTab5.json +68 -0
- package/examples/rason-features/UserGuide/UGProjectSelect0.json +92 -0
- package/examples/rason-features/UserGuide/UGProjectSelect1.json +75 -0
- package/examples/rason-features/UserGuide/UGProjectSelect2.json +75 -0
- package/examples/rason-features/UserGuide/UGYieldManagement1.json +62 -0
- package/examples/rason-features/UserGuide/UGYieldManagement2.json +62 -0
- package/examples/rason-features/UserGuide/UGYieldManagement3.json +64 -0
- package/out/index.cjs +361 -0
- package/package.json +76 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "RGProductMixExcel11",
|
|
3
|
+
"modelDescription": "RASON Conic Optimization Example: Example illustrates how to bind to an Excel sheet: In this example, data is imported from an Excel file. To perform the same steps when importing/exporting to an Excel file, you need to specify the cell address containing the dimensions to be imported and/or the cells to which the results should be exported. In this example, the vars_data data source is again importing initial decision variable values and then exporting the final decision variable values to the same Excel workbook. See Data Sources within the RASON Reference Guide for more information. (Click Help tab to download.) ",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "Imports data from outside datasources.",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"comment": "Imports the parts data.",
|
|
9
|
+
"type": "excel",
|
|
10
|
+
"connection": "ProductMixExcel.xlsx",
|
|
11
|
+
"selection": "Sheet1!G2:I12",
|
|
12
|
+
"indexCols": [ "parts", "prods" ],
|
|
13
|
+
"valueCols": [ "qty" ],
|
|
14
|
+
"direction": "import"
|
|
15
|
+
},
|
|
16
|
+
"invent_data": {
|
|
17
|
+
"comment": "Imports the inventory data.",
|
|
18
|
+
"type": "excel",
|
|
19
|
+
"connection": "ProductMixExcel.xlsx",
|
|
20
|
+
"selection": "Sheet1!N2:O6",
|
|
21
|
+
"indexCols": [ "parts" ],
|
|
22
|
+
"valueCols": [ "inventory" ],
|
|
23
|
+
"direction": "import"
|
|
24
|
+
},
|
|
25
|
+
"profit_data": {
|
|
26
|
+
"comment": "Imports the profit per unit data.",
|
|
27
|
+
"type": "excel",
|
|
28
|
+
"connection": "ProductMixExcel.xlsx",
|
|
29
|
+
"selection": "Sheet1!K2:L4",
|
|
30
|
+
"indexCols": [ "prods" ],
|
|
31
|
+
"valueCols": [ "profits" ],
|
|
32
|
+
"direction": "import"
|
|
33
|
+
},
|
|
34
|
+
"vars_data": {
|
|
35
|
+
"comment": "The vars_data data source performs a dual function by first importing the decision variable initial values from the Excel file ProductMixExcel.xlsx and then saving the final variable values back to that same file. The first property, type, specifies the type of file where the data is being imported/exported ('Excel'), the second property, connection, specifies the file name within quotes ('ResultVarsInit.txt') and the third property, selection, specifies where the final variable values will be appended ('Sheet1!Q2:R4'). We could pass a defined name here rather than a cell address. The fourth and fifth properties (indexCols and valueCols) are required for importing the initial variable values. The property, indexCols specifies the dimension(s) (or column(s)) to be imported and the property, valueCols, specifies the value column to be imported. Within variables, the x array definition uses the valueCol property to pass the initial variable values and the binding property to 'bind' to the vars_data data source. Since only one output property (finalValue:[]) is present within the x array definition, only the final variable values will be appended to the original cell address, Q2:R4. The last property, 'direction', indicates that the file will be both imported and exported hence the setting 'import/export'. Note: If the 'initials' column heading in Excel is replaced with 'finalValue'. RASON will both read the initial variable values from cells R2:R4 and overwrite these values with the final variable values after the model is solved.",
|
|
36
|
+
"type": "excel",
|
|
37
|
+
"connection": "ProductMixExcel.xlsx",
|
|
38
|
+
"selection": "Sheet1!Q2:R4",
|
|
39
|
+
"indexCols": [ "prods" ],
|
|
40
|
+
"valueCols": [ "initials" ],
|
|
41
|
+
"direction": "import/export"
|
|
42
|
+
},
|
|
43
|
+
"fcns_data": {
|
|
44
|
+
"comment": "The fcns_data datasource exports the final constraint values to the Excel file, ProductMixExcel.xlsx. The first property, type: 'Excel', specifies the type of file where the data is being imported/exported, in this instance an Excel file. The second property, connection, specifies the file name within quotes ('ProductMixExce.xlsx'). The 3rd property, selection: 'Sheet1!U2:U6', gives the location, within the ProductMixExcel.xlsx workbook, where the final constraint values will be saved. Alternatively, we could pass a defined name here. The 4th property, indexCols, indexes the data by the 'prods' column (or dimension). The binding property within the c constraint definition binds the constraint block c to the fcns_data datasource. One output property (finalValue:[]) is included in the c definition. The RASON interpreter will append the final constraint values to the original selection. The last property, 'direction', indicates that the file will be exported. (The default setting for the direction property is 'import'.) For a complete list of results that may be written to a writeable data source, see the constraints section discussion within the RASON Reference Guide.",
|
|
45
|
+
"type": "excel",
|
|
46
|
+
"connection": "ProductMixExcel.xlsx",
|
|
47
|
+
"selection": "Sheet1!U2:U6",
|
|
48
|
+
"indexCols": [ "parts" ],
|
|
49
|
+
"direction": "export"
|
|
50
|
+
},
|
|
51
|
+
"obj_data": {
|
|
52
|
+
"comment": "The obj_data datasource exports the final objective value to ProductMixExcel.xlsx. The first property, type, specifies the file type ('Excel'), the second property, connection, specifies the file name ('ResultObj.txt') and the third property, selection, specifies where the final objective value will be written ('Sheet1!X1'). The binding property within the total objective definition the objective definition to the obj_data data source. Since only the finalValue result property is present within the objective definition, only the final value of the objective function (a single value) will be saved to ProductMixExcel!X2. The last property, 'direction', indicates that the file will be exported. For a complete list of results that may be written to a writeable data source, see the objective section discussion within the RASON Reference Guide.",
|
|
53
|
+
"type": "excel",
|
|
54
|
+
"connection": "ProductMixExcel.xlsx",
|
|
55
|
+
"selection": "Sheet1!X2",
|
|
56
|
+
"direction": "export"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"data": {
|
|
60
|
+
"comment": "Binds the datasources to data component.",
|
|
61
|
+
"parts2": {
|
|
62
|
+
"comment": "Binds the values in the qty column in the parts_data datasource to parts2 data component.",
|
|
63
|
+
"binding": "parts_data",
|
|
64
|
+
"valueCol": "qty"
|
|
65
|
+
},
|
|
66
|
+
"invent": {
|
|
67
|
+
"comment": "Binds the values in the inventory column in the invent_data datasource to invent data component.",
|
|
68
|
+
"binding": "invent_data",
|
|
69
|
+
"valueCol": "inventory"
|
|
70
|
+
},
|
|
71
|
+
"profit": {
|
|
72
|
+
"comment": "Binds the values in the profits column in the profit_data datasource to profit data component.",
|
|
73
|
+
"binding": "profit_data",
|
|
74
|
+
"valueCol": "profits"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"formulas": {
|
|
78
|
+
"comment": "Use this section to calculate intermediate formulas to be used within the constraints and objective sections.",
|
|
79
|
+
"piv_parts": {
|
|
80
|
+
"comment": "Calculates the amount of parts used to produce all three products.",
|
|
81
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"variables": {
|
|
85
|
+
"comment": "Decision Variables",
|
|
86
|
+
"x": {
|
|
87
|
+
"comment": "The amount of products to produce, x[1] = TVs, x[2] = Stereos, x[3] = Speakers",
|
|
88
|
+
"dimensions": [ "prods" ],
|
|
89
|
+
"binding": "vars_data",
|
|
90
|
+
"valueCol": "initials",
|
|
91
|
+
"lower": 0,
|
|
92
|
+
"finalValue": [],
|
|
93
|
+
"indexValue": []
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"constraints": {
|
|
97
|
+
"comment": "Constraints",
|
|
98
|
+
"c": {
|
|
99
|
+
"comment": "Generates 5 constraints that calculate the number of parts used in creating the three products, then sets each constraint equal to the amount of each part in inventory.",
|
|
100
|
+
"dimensions": [ "parts" ],
|
|
101
|
+
"binding": "fcns_data",
|
|
102
|
+
"formula": "MMULT(piv_parts, x) - invent",
|
|
103
|
+
"upper": 0,
|
|
104
|
+
"finalValue": []
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"objective": {
|
|
108
|
+
"comment": "objective function",
|
|
109
|
+
"total": {
|
|
110
|
+
"comment": "Calculates the profit by multiplying the profit per unit of each product by the final variable values.",
|
|
111
|
+
"binding": "obj_data",
|
|
112
|
+
"formula": "sumproduct(x, profit)",
|
|
113
|
+
"type": "maximize",
|
|
114
|
+
"finalValue": []
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "RGProductMixSQL11",
|
|
3
|
+
"modelDescription": "RASON Conic Optimization Example that uses SQL table binding: This example illustrates how to import and export data from an odbc database, specifically a Microsoft Access database. See the Named Data Connections within the RASON User Guide for more information on how to create a named data connection where you can maintain your data access credentials in a secure Azure 'vault' rather than passing them in the connection property.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "Imports data from outside datasources. ValueCols must follow indexCols in selections",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"comment": "Imports the parts data.",
|
|
9
|
+
"type": "odbc",
|
|
10
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
11
|
+
"selection": "SELECT Parts as parts, Products as prods, Qty as qty FROM Parts ORDER BY ID",
|
|
12
|
+
"indexCols": [ "parts", "prods" ],
|
|
13
|
+
"valueCols": [ "qty" ],
|
|
14
|
+
"direction": "import"
|
|
15
|
+
},
|
|
16
|
+
"invent_data": {
|
|
17
|
+
"comment": "Imports the inventory data.",
|
|
18
|
+
"type": "odbc",
|
|
19
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
20
|
+
"selection": "SELECT Parts as parts, Inventory as inventory FROM Inventory ORDER BY ID",
|
|
21
|
+
"indexCols": [ "parts" ],
|
|
22
|
+
"valueCols": [ "inventory" ],
|
|
23
|
+
"direction": "import"
|
|
24
|
+
},
|
|
25
|
+
"profit_data": {
|
|
26
|
+
"comment": "Imports the profit per unit data.",
|
|
27
|
+
"type": "odbc",
|
|
28
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
29
|
+
"selection": "SELECT Products as prods, Profit as profit FROM Profits ORDER BY ID",
|
|
30
|
+
"indexCols": [ "prods" ],
|
|
31
|
+
"valueCols": [ "profit" ],
|
|
32
|
+
"direction": "import"
|
|
33
|
+
},
|
|
34
|
+
"vars_data": {
|
|
35
|
+
"comment": "The vars_data data source performs a dual function by first importing the decision variable initial values from the Access database and then saving the final variable values back to that same file. The first property, type, specifies the type of file where the data is being imported/exported ('msaccess'), the second property, connection, specifies the file name within quotes ('ProductMixAccess.accdb') and the third property, selection, imports two fields from the Profits table in order by ID ('SELECT Products, Initials FROM Profits ORDER BY ID). The 4th property, indexCols, indexes the data by the prods dimension while the 5th property, valueCols, imports the actual numerical data. The direction property ensures that the initial variable values are imported and the final variable values are exported using direction: 'import/export'. Within variables, the x array definition uses the valueCol property to pass the initial variable values and the binding property to bind to the vars_data data source. The final variable values (requested using the output property finalValues:[] within the x array definition) will be appended to the Profits table.",
|
|
36
|
+
"type": "odbc",
|
|
37
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
38
|
+
"selection": "SELECT Products as prods, Initials as initials FROM Profits ORDER BY ID",
|
|
39
|
+
"indexCols": [ "prods" ],
|
|
40
|
+
"valueCols": [ "initials" ],
|
|
41
|
+
"direction": "import/export"
|
|
42
|
+
},
|
|
43
|
+
"fcns_data": {
|
|
44
|
+
"comment": "The fcns_data datasource, exports the final constraint values to the Access data base file, ProductMixAccess.accdb. The first property, type: 'msaccess', specifies the type of file where the data is being imported/exported. Alternatively, 'access' or 'odbc' could have been passed instead of 'msaccess'. The second property, connection, specifies the file name within quotes ('ProductMixAcess.accdb'). The 3rd property, selection: 'ResultFcns', creates a table within the Access database, where the final constraint values will be saved. The direction property ensures that the file is 'exported'. Within the c constraint definition, the constraint block is bound to the fcns_data data source by the binding property. The output property, finalValue:[], will export the final constraint values to the ResultsFcns table within the file, ProductMixAccess.accdb.",
|
|
45
|
+
"type": "odbc",
|
|
46
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
47
|
+
"selection": "ResultFcns",
|
|
48
|
+
"direction": "export"
|
|
49
|
+
},
|
|
50
|
+
"obj_data": {
|
|
51
|
+
"comment": "The obj_data datasource exports the final objective value to ProductMixAccess.accdb. Again the first property, type, specifies the file type ('msaccess'), the second property, connection, specifies the file name ('ProductMixAccess.accdb') and the third property, selection, specifies the table where the final objective value will be written ('ResultObj'). The direction property ensures that the file is 'exported'. The binding property within the total objective definition 'binds' the objective to the obj_data source. The output property, finalValue:[], exports the final objective function value to the ResultObj table within the file ProductMixAccess.accdb.",
|
|
52
|
+
"type": "odbc",
|
|
53
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
54
|
+
"selection": "ResultObj",
|
|
55
|
+
"direction": "export"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"data": {
|
|
59
|
+
"comment": "Binds the datasources to data component.",
|
|
60
|
+
"profit": {
|
|
61
|
+
"comment": "Binds the values in the profits column in the profit_data datasource to profit data component. If valueCol property is missing, RASON assumes the value column is the last column in the table.",
|
|
62
|
+
"binding": "profit_data"
|
|
63
|
+
},
|
|
64
|
+
"invent": {
|
|
65
|
+
"comment": "Binds the values in the inventory column in the invent_data datasource to invent data component.",
|
|
66
|
+
"binding": "invent_data"
|
|
67
|
+
},
|
|
68
|
+
"parts2": {
|
|
69
|
+
"comment": "Binds the values in the qty column in the parts_data datasource to parts2 data component.",
|
|
70
|
+
"binding": "parts_data"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"formulas": {
|
|
74
|
+
"comment": "Use this section to calculate intermediate formulas to be used within the constraints and objective sections.",
|
|
75
|
+
"piv_parts": {
|
|
76
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"variables": {
|
|
80
|
+
"comment": "Decision Variables",
|
|
81
|
+
"x": {
|
|
82
|
+
"comment": "The amount of products to produce, x[1] = TVs, x[2] = Stereos, x[3] = Speakers",
|
|
83
|
+
"dimensions": [ "prods" ],
|
|
84
|
+
"valuecol": "initials",
|
|
85
|
+
"lower": 0,
|
|
86
|
+
"finalValue": []
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"constraints": {
|
|
90
|
+
"comment": "Constraints",
|
|
91
|
+
"c": {
|
|
92
|
+
"comment": "Generates 5 constraints that calculate the number of parts used in creating the three products, then sets each constraint equal to the amount of each part in inventory.",
|
|
93
|
+
"dimensions": [ "parts" ],
|
|
94
|
+
"formula": "MMULT(piv_parts, x)",
|
|
95
|
+
"upper": "invent",
|
|
96
|
+
"finalValue": []
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"objective": {
|
|
100
|
+
"comment": "objective function",
|
|
101
|
+
"total": {
|
|
102
|
+
"comment": "Calculates the profit by multiplying the profit per unit of each product by the final variable values.",
|
|
103
|
+
"formula": "sumproduct(x, profit)",
|
|
104
|
+
"type": "maximize",
|
|
105
|
+
"finalValue": []
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGAirlineHubCSV",
|
|
3
|
+
"modelDescription": "RASON Distance Minimization Nonlinear Optimization Example - This example is used in the Introduction chapter within the RASON User Guide (downloadable from the Help tab) to illustrate RASON's ability to import data from an outside source. Many realistic models use large tables of data, often drawn from multiple data fields or databases. The goal of this example is to find a location of an airline hub serving several regional airports. The location of the hub should be as close to equidistant to each airport served, as possible. In this example the datasources section imports a CSV file containing a list of coordinates for the regional airports. AirlineHubData.csv contains three columns: 'cities', containing the city name, dx and dy, containing the x and y coordinates of each airport. Our list of city coordinates is located in a CSV file, however, our data could also have been located in an ODBC database or an Excel file. Click Help - RASON Subscriptions -- Data Connections to see how to setup a secure data connection in RASON. To download AirlineHubData.csv, click Download RASON example data from the ribbon. To attach the file to the example, click Choose Files (on the Properties pane), browse to the location of the downloaded files, select AirlineHubData.csv and click Open. Then click POST (upload icon on ribbon) to post the model to the RASON Server. Finally, click the down arrow next the Play icon and click Solve to solve the model. The x and y values in the final solution will be the x and y coordinates of the proprosed airline hub.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"engineSettings": {
|
|
6
|
+
"comment": "Since this model is nonlinear, the GRG Nonlinear engine is selected as the solving engine.",
|
|
7
|
+
"engine": "GRG Nonlinear"
|
|
8
|
+
},
|
|
9
|
+
"datasources": {
|
|
10
|
+
"comment": "The dataSources section defines a source from which the data values will be imported, in this case a comma-separated-value (CSV) file named AirlineHubData.csv. The data source defines an index column, CITIES, which is used to dimension the array of constraints, c.",
|
|
11
|
+
"city_data": {
|
|
12
|
+
"type": "csv",
|
|
13
|
+
"connection": "AirlineHubData.csv",
|
|
14
|
+
"indexCols": [ "cities" ],
|
|
15
|
+
"valueCols": [ "dx", "dy" ],
|
|
16
|
+
"direction": "import"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"variables": {
|
|
20
|
+
"comment": "This example contains three decision variables x, y and z. The x and y variables will hold the final x and y coordinates of the proposed firehouse location. The third variable, z, will be minimized in the objective function. Since the finalValue property is present, the final value of each variable will be returned in the results.",
|
|
21
|
+
"x": {
|
|
22
|
+
"comment": "The x coordinate of the proposed airport location. Since the finalValue property is present, the final value of the objective function will be returned in the results.",
|
|
23
|
+
"value": 1.0,
|
|
24
|
+
"finalValue": []
|
|
25
|
+
},
|
|
26
|
+
"y": {
|
|
27
|
+
"comment": "The y coordinate of the proposed airport location. Since the finalValue property is present, the final value of the objective function will be returned in the results.",
|
|
28
|
+
"value": 1.0,
|
|
29
|
+
"finalValue": []
|
|
30
|
+
},
|
|
31
|
+
"z": {
|
|
32
|
+
"comment": "The z variable that will be minimized in the objective function. Since the finalValue property is present, the final value of the objective function will be returned in the results.",
|
|
33
|
+
"value": 1.0,
|
|
34
|
+
"finalValue": []
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"data": {
|
|
38
|
+
"comment": "In the data section of the model, we bind the names dx and dy to 1-dimensional arrays from the corresponding value columns dx and dy. This model can be used to solve many different instances of this facility location problem, for a variable number of cities.",
|
|
39
|
+
"dx": {
|
|
40
|
+
"comment": "x coordinates of each city bound to the dx data array.",
|
|
41
|
+
"binding": "city_data",
|
|
42
|
+
"valueCol": "dx"
|
|
43
|
+
},
|
|
44
|
+
"dy": {
|
|
45
|
+
"comment": "y coordinates of each city bound to the dy data array.",
|
|
46
|
+
"binding": "city_data",
|
|
47
|
+
"valueCol": "dy"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"constraints": {
|
|
51
|
+
"c": {
|
|
52
|
+
"comment": "There will be 1 constraint per city regional airport. The distance formula is used to calculate the distance bewteen the proprosed hub's location and the city regional airport.",
|
|
53
|
+
"dimensions": [ "cities", 1 ],
|
|
54
|
+
"upper": 0,
|
|
55
|
+
"formula": "sqrt((x - dx)^2 + (y - dy)^2) - z"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"objective": {
|
|
59
|
+
"comment": "The objective function minimizes the z variable creating a squashing effect that pushes the distances between the proposed airling hub and the distance between each city airport to be as small as possible.",
|
|
60
|
+
"obj": {
|
|
61
|
+
"comment": "Since the finalValue property is present, the final value of the objective function will be returned in the results. Note that the final value for the z variable and the objective will be equal.",
|
|
62
|
+
"type": "minimize",
|
|
63
|
+
"formula": "z",
|
|
64
|
+
"finalValue": []
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGForecastSimExample",
|
|
3
|
+
"modelDescription": "RASON Forecast Simulation Example - This example appears in the Defining Your Simulation MOdel chapter in the RASON User Guide. Imagine that you are the sales manager for a company that is planning to introduce a new product. You need to estimate the first year profit from this product (which depends on the number of unit sales), the price per unit sold, the unit manufacturing cost, and any fixed costs or overhead. You have been advised that the unit manufacturing cost will range between $4.50 and $8.50, with a most-likely cost of $6.50. Based on your market research, you believe it is equally likely that the market demand will be Slow, OK, or Hot.",
|
|
4
|
+
"modelType": "simulation",
|
|
5
|
+
"comment": "When creating any RASON model, our model definition begins with a simple open bracket. Next we see three optional, but strongly recommended, high level properties, modelName, modelDescription and modelType. ModelName assigns a name to the model for easy retrieval later, modelDescription gives a short description of the problem and modelType informs the RASON Server that this model is a simulation model.",
|
|
6
|
+
"uncertainVariables": {
|
|
7
|
+
"comment": "There are two uncertain variables in this model, marketType and unitCost. The unit cost uses the PsiTriangular distribution to model the manufacturing cost while marketType uses the PsiIntUniform distribution to model the market demand. Since these are distributions, there will be 1000 values (the default setting for number of trials) returned for both marketType and unitCost.",
|
|
8
|
+
"marketType": {
|
|
9
|
+
"comment": "Since there are equal chances that the market will be Slow, OK, or Hot, we want to create an uncertain variable that selects among these three possibilities, by drawing a random number – say 1, 2 or 3 – with equal probability. We can do this easily in the RASON modeling language using an integer uniform probability distribution or PsiIntUniform(). Sales Volume and Selling Price will both be based on this uncertain variable. See the marketType uncertain variable in below. A sample drawn from a discrete distribution is always one of a set of discrete values, such as integer values. For more information on this distribution, see the RASON Reference Guide, downloadable from the Help tab. ",
|
|
10
|
+
"formula": "PsiIntUniform(1,3)"
|
|
11
|
+
},
|
|
12
|
+
"unitCost": {
|
|
13
|
+
"comment": "There are not just three, but many possible values for this variable: It can be anywhere from $4.50 to $8.50, with a most likely cost of $6.50. A crude but effective way to model this is to use a triangular distribution. The RASON modeling language provides a function called PsiTriangular() for this distribution (see the unitCost uncertain variable below). For more information on this distribution, see the RASON Reference Guide, downloadable from the Help tab.",
|
|
14
|
+
"formula": "PsiTriangular(4.5, 6.5, 8.5)"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"formulas": {
|
|
18
|
+
"comment": "The salesVolume and sellingPrice formulas use the value of the PsiIntUniform distribution to determine which market (Slow, OK, or Hot) is selected per trial. If marketType equals 1, the Sales Volume and Selling Price are 50,000 and $11, if marketType equals 2, the Sales Volume and Selling Price are 75,000 and $10 and if marketType equals 3, the Sales Volume and Selling Price are 100,000 and $8.",
|
|
19
|
+
"salesVolume": {
|
|
20
|
+
"comment": "Calculates the sales volume based on the marketType uncertain variable. Since salesVolume is based on the marketType uncertain variable, there will be 1000 values returned, not just a single value.",
|
|
21
|
+
"formula": "if(marketType = 1, 50000, if(marketType = 2, 75000, if(marketType = 3, 100000)))"
|
|
22
|
+
},
|
|
23
|
+
"sellingPrice": {
|
|
24
|
+
"comment": "Calculates the product selling price based on the marketType uncertain variable. Since salesVolume is based on the marketType uncertain variable, there will be 1000 values returned, not just a single value.",
|
|
25
|
+
"formula": "if(marketType = 1, 11, if(marketType = 2, 10, if(marketType = 3, 8)))"
|
|
26
|
+
},
|
|
27
|
+
"grossSales": {
|
|
28
|
+
"comment": "Calculates gross sales as a product of selling price and sales volume. Since grossSales is indirectly based on the marketType uncertain variable, there will be 1000 values returned, not just a single value.",
|
|
29
|
+
"formula": "sellingPrice * salesVolume"
|
|
30
|
+
},
|
|
31
|
+
"totalCosts": {
|
|
32
|
+
"comment": "Calculates the total costs as a product of sales volume and unit cost. Since totalCosts is indirectly based on the marketType uncertain variable, there will be 1000 values returned, not just a single value.",
|
|
33
|
+
"formula": "salesVolume * unitCost"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"data": {
|
|
37
|
+
"comment": "The data section holds the constant fixedCosts, which equals $120,000.",
|
|
38
|
+
"fixedCosts": {
|
|
39
|
+
"value": 120000
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"uncertainFunctions": {
|
|
43
|
+
"comment": "The last section, uncertainFunctions, calculates the Net Profit by subtracting totalCosts and fixedCosts from grossSales. Since we want to know the expected (or average) net profit, we ask for the mean in our result. Note that the result of the formula ('grossSales - totalCosts - fixedCosts') is 1,000 scenarios or trials, rather than a single value. The mean that will be returned in the result will be the true average of Net Profit across 1,000 or more scenarios or trials – not a single calculation from average values of the inputs. We could have asked for additional result measures for netProfit such as the minimum function value, maximum function value, standard deviation, variance, median, mode, etc. One, several, or all can be returned in a result. View them in the results under netProfit_statistics. View all 1000 trials under netProfit_trials and view the percentile values under netProfit_percentiles. For a complete list of measures that may be returned please see the chapter RASON Model Components in the RASON Reference Guide.",
|
|
44
|
+
"netProfit": {
|
|
45
|
+
"formula": "grossSales - totalCosts - fixedCosts",
|
|
46
|
+
"mean": [],
|
|
47
|
+
"percentiles": [],
|
|
48
|
+
"trials": []
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGProductMix1_BasicLinearModel",
|
|
3
|
+
"modelDescription": "RASON Product Mix Example: UGProductMix1 Example - This example is discussed in the Defining Your Optimization Model chapter. Assume a company manufatures TVs, stereos and speakers, using a common parts inventory of chassis, LOCD screens, speakers power supplies and various internal electronics. Parts are in limited supply. This model works well for the business situation initially described, with exactly three products and five types of parts but it's not very flexible. What if more products were added and more parts were required? In the next example UGProductMix2Example, the model will be generalized so it can handle different numbers of products and parts.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "In variables, a column vector x of size 3 is defined (x[1], x[2] and x[3]) to hold the number of products to produce. These are the decision variables. The dimensions of an array can be explicitly defined by the dimensions property. However, in the absence of the dimensions property (as in this example), the 'value', 'lower', or 'upper' properties can implicitly define the shape of the array, as is shown here using the 'lower' property. The empty array, finalValue[] tells RASON that we want the results from solving to include the final values of each variable.",
|
|
7
|
+
"x": {
|
|
8
|
+
"comment": "The decision variables are the number of products of each type to build: x1 for TV sets, x2 for stereos and x3 for speakers. Since a negative number of parts can not be manufactured, a lower bound of 0 is supplied for each variable using the 'lower' property. See the variable final values in the result under x.",
|
|
9
|
+
"lower": [ 0, 0, 0 ],
|
|
10
|
+
"finalValue": []
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"constraints": {
|
|
14
|
+
"comment": "Building each product requires a certain number of parts of each type. For example, TV sets and stereos each require one chassis, but speakers don't use one. The number of parts used depends on the mix of products built (the left hand side of each constraint), and we have a limited number of parts of each type on hand (the corresponding constraint right hand side). Since the number of products built must be nonnegative, we also have the constraints x1, x2, x3 >= 0. Note that terms like 0 x3 are included purely to show the structure of the model – they can be either omitted or included in your data. The 5 constraints are calculated in Constraints by multiplying the decision variables (x[1], x[2] and x[3]) by the number of parts required. The number of parts used must be less than or equal to the number of parts in inventory, so the upper bound for our first constraint is: x[1] * 1 + x[2] * 1 + x[3] * 0 <= 450. The other constraints are similar. Note that both the upper and lower properties only support constant values, no formulas. ",
|
|
15
|
+
"chassisUsed": {
|
|
16
|
+
"comment": "#Tvs * 1 + #Stereos * 1 + #Speakers * 0 - Each TV and stereo require 1 chassis each. There are 450 chassis on hand in inventory. ",
|
|
17
|
+
"formula": "x[1] * 1 + x[2] * 1 + x[3] * 0",
|
|
18
|
+
"upper": 450
|
|
19
|
+
},
|
|
20
|
+
"screensUsed": {
|
|
21
|
+
"comment": "#Tvs * 1 + #Stereos * 0 + #Speakers * 0 - Each TV requires screens chassis each. There are 250 screens on hand in inventory. ",
|
|
22
|
+
"formula": "x[1] * 1 + x[2] * 0 + x[3] * 0",
|
|
23
|
+
"upper": 250
|
|
24
|
+
},
|
|
25
|
+
"speakersUsed": {
|
|
26
|
+
"comment": "#Tvs * 2 + #Stereos * 2 + #Speakers * 1 - Each TV and stereo require 2 speakers each; a speaker only requires 1 speaker part. There are 800 speakers on hand in inventory. ",
|
|
27
|
+
"formula": "x[1] * 2 + x[2] * 2 + x[3] * 1",
|
|
28
|
+
"upper": 800
|
|
29
|
+
},
|
|
30
|
+
"powerUsed": {
|
|
31
|
+
"comment": "#Tvs * 1 + #Stereos * 1 + #Speakers * 0 - Each TV and stereo require 1 power cord each. There are 450 power cords on hand in inventory. ",
|
|
32
|
+
"formula": "x[1] * 1 + x[2] * 1 + x[3] * 0",
|
|
33
|
+
"upper": 450
|
|
34
|
+
},
|
|
35
|
+
"electronicsUsed": {
|
|
36
|
+
"comment": "#Tvs * 2 + #Stereos * 1 + #Speakers * 1 - Each TV requires 2 electronic components and each stero and speaker require 1. There are 600 chassis on hand in inventory. ",
|
|
37
|
+
"formula": "x[1] * 2 + x[2] * 1 + x[3] * 1",
|
|
38
|
+
"upper": 600
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"objective": {
|
|
42
|
+
"obj": {
|
|
43
|
+
"comment": "There is a fixed profit per unit for each product, so the objective function (the quantity we want to maximize) is: Maximize 75 x1 + 50 x2 + 35 x3 (Profit). See the objective value in the results under obj.",
|
|
44
|
+
"type": "maximize",
|
|
45
|
+
"formula": "x[1] * 75 + x[2] * 50 + x[3] * 35",
|
|
46
|
+
"finalValue": []
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGProductMix2_ImprovedLinearModel",
|
|
3
|
+
"modelDescription": "RASON Product Mix Example: UGProductMix2 Example - This example is discussed in the Defining Your Optimization chapter within the RASON User Guide. See 'The Improve Model' section within the chapter. One way to make the original product mix model (UGProductMix1Example) more flexible is to use RASON's built-in functions that operate on all the elements of an array at once, treating it as a vector or matrix. With this version of the model, if the number of parts or products are increased or decreased, you will need to adjust the size of your arrays, but no changes will be needed for the constraints formula which can sometimes be the hardest part of the model to define.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "In the variables section, we again define a column vector x of size 3 but this time the dimensions property is used to explicitly define the size of the array. As a result, we can pass a single value to the lower property applying a lower bound of 0 to all three elements of the x array. Again, the empty array, finalValue:[] tells the RASON system that you want the results from solving to include the final values of each variable.",
|
|
7
|
+
"X": {
|
|
8
|
+
"dimensions": [ 3 ],
|
|
9
|
+
"lower": 0,
|
|
10
|
+
"finalValue": []
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"data": {
|
|
14
|
+
"profit": {
|
|
15
|
+
"dimensions": [ 3, 1 ],
|
|
16
|
+
"value": [ 75, 50, 35 ],
|
|
17
|
+
"finalValue": []
|
|
18
|
+
},
|
|
19
|
+
"parts": {
|
|
20
|
+
"dimensions": [ 5, 3 ],
|
|
21
|
+
"value": [
|
|
22
|
+
[ 1, 1, 0 ],
|
|
23
|
+
[ 1, 0, 0 ],
|
|
24
|
+
[ 2, 2, 1 ],
|
|
25
|
+
[ 1, 1, 0 ],
|
|
26
|
+
[ 2, 1, 1 ]
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"inventory": {
|
|
30
|
+
"value": [ 450, 250, 800, 450, 600 ]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"constraints": {
|
|
34
|
+
"comment": "In the original example (UGProductMix1Example), the 5 constraints were calculated using explicit formulas such as 'x[1] * 1 + x[2] * 1 + x[3] * 0'. In this model, three arrays are created in the 'data' section to hold the information for the model: profits (to hold the profit margin of each product), inventory (to hold the available inventory) and parts (a matrix holding the part requirements for each product). Note: The RASON Language Interpreter currently ONLY supports constants, a name with constant values, or a named array of constants for the lower and upper arguments.",
|
|
35
|
+
"numUsed": {
|
|
36
|
+
"comment": "The MMULT function in the num_used constraint multiplies the matrix parts (with 5 rows and 3 columns) by the column vector x. The product of this multiplication is a column vector with 5 rows which must be less than the column vector, inventory.",
|
|
37
|
+
"dimensions": [ 5 ],
|
|
38
|
+
"formula": "MMULT(parts, X)",
|
|
39
|
+
"upper": "inventory"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"objective": {
|
|
43
|
+
"total": {
|
|
44
|
+
"type": "maximize",
|
|
45
|
+
"formula": "sumproduct(X, profit)",
|
|
46
|
+
"finalValue": []
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGProductMixTable1",
|
|
3
|
+
"modelDescription": "RASON Product Mix Example: Arrays in the RASON Modeling language are limited to 2-dimensions. If you require an array containing more than 2-dimensions, a table may be created. There are many advantages to using tables: 1. Tables may hold more than 2 dimensions, 2. A table result may be used in an indexed array formula, 3. A table can be sparse while an array is dense, 4. The evaluation of a table is less expensive (time consuming) than the evaluation of an array with more than 2 dimensions. In this example, the matrix above has been specified in line (within the RASON model) as the parts table. This table contains 15 elements and is indexed using two dimensions: part and prod. Note that this table is DENSE, meaning that zero values have been supplied as well as non-zero values. See the next example, UGProductMixTable2 to see an example of a SPARSE table, meaning only non-zero values are supplied. (To open this full example, and any example referenced in this guide, click the down array under RASON examples -- Examples discussed in the RASON User Guide.)",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"data": {
|
|
6
|
+
"parts": {
|
|
7
|
+
"comment": "Notice that even though the parts table is listed horizontally in the RASON model, the table elements are stored in a vertical array.",
|
|
8
|
+
"indexCols": ["part", "prod"],
|
|
9
|
+
"value": [
|
|
10
|
+
["chas", "tv", 1],
|
|
11
|
+
["elec", "stereo", 1],
|
|
12
|
+
["tube", "tv", 1],
|
|
13
|
+
["cone", "tv", 2],
|
|
14
|
+
["cone", "stereo", 2],
|
|
15
|
+
["chas", "stereo", 1],
|
|
16
|
+
["cone", "speaker", 1],
|
|
17
|
+
["psup", "tv", 1],
|
|
18
|
+
["psup", "stereo", 1],
|
|
19
|
+
["elec", "tv", 2],
|
|
20
|
+
["elec", "speaker", 1]
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"profits": {
|
|
24
|
+
"value": [75, 50, 35],
|
|
25
|
+
"binding": "get",
|
|
26
|
+
"finalValue": []
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"variables": {
|
|
30
|
+
"x": {
|
|
31
|
+
"comment": "The x array, dimensioned using the index column prod, is an array of size 3 containing the decision values x[1], x[2] and x[3]. These are the number of each product to produce.",
|
|
32
|
+
"dimensions": ["prod"],
|
|
33
|
+
"value": 0,
|
|
34
|
+
"lower": 0,
|
|
35
|
+
"finalValue": []
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"constraints": {
|
|
39
|
+
"comment": "Five constraints are formulated by 'slicing' the table to obtain the correct part data. For example, in the first constraint, c1, parts['chas', ] slices the table across the part chas which results in the elements: 1, 1, 0. The second constraint, c2, slices the table across tube obtaining the elements 1, 0, 0. Constraints c3, c4 and c5 are calculated in the same fashion.",
|
|
40
|
+
"c1": {
|
|
41
|
+
"formula": "sumproduct(parts['chas',], x)",
|
|
42
|
+
"upper": 450
|
|
43
|
+
},
|
|
44
|
+
"c2": {
|
|
45
|
+
"formula": "sumproduct(parts['tube',], x)",
|
|
46
|
+
"upper": 250
|
|
47
|
+
},
|
|
48
|
+
"c3": {
|
|
49
|
+
"formula": "sumproduct(parts['cone',], x)",
|
|
50
|
+
"upper": 800
|
|
51
|
+
},
|
|
52
|
+
"c4": {
|
|
53
|
+
"formula": "sumproduct(parts['psup',], x)",
|
|
54
|
+
"upper": 450
|
|
55
|
+
},
|
|
56
|
+
"c5": {
|
|
57
|
+
"formula": "sumproduct(parts['elec',], x)",
|
|
58
|
+
"upper": 600
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"objective": {
|
|
62
|
+
"total": {
|
|
63
|
+
"formula": "sumproduct(x, profits)",
|
|
64
|
+
"type": "maximize",
|
|
65
|
+
"finalValue": []
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "UGProductMixTable2",
|
|
3
|
+
"modelDescription": "RASON Product Mix Example: This example solves the same model as UGProductMixTable1, with two modifications. 1. Instead of passing a DENSE table, in which both zero and non-zero elements are passed in the parts table, this example passes a SPARSE table where only non-zero elements are passed. 2. This example model illustrates how to use an index set to dimension a table. RASON uses index sets exclusively to dimension tables and arrays.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"indexSets": {
|
|
6
|
+
"comment": "The indexSets section is used exclusively to dimension tables and arrays. Typical mathematical programming models include multiple tables and arrays indexed over various index sets. An index set should be created at the beginning of the model to establish a basis of order for each dimension appearing in a table or array. Otherwise, the user will be required to keep track of and maintain the correct order of elements in all arrays and tables present in the model. An index set is always a 1-dimensional array and must be defined within the indexSets section of the RASON model. For more information on index sets, see the Index Sets section within the RASON Reference Guide.",
|
|
7
|
+
"part": {
|
|
8
|
+
"comment": "The example code below creates the part ordered set. The part set contains five items (in order as entered): chas, tube, cone, psup and elec. while the prod set contains 3 items: tv, stereo and speakers. For more information on index sets, see the Index Sets section within the RASON Reference Guide.",
|
|
9
|
+
"value": ["chas", "tube", "cone", "psup", "elec"]
|
|
10
|
+
},
|
|
11
|
+
"prod": {
|
|
12
|
+
"comment": "The example code below creates the prod ordered set. The prod set contains 3 items: tv, stereo and speakers. For more information on index sets, see the Index Sets section within the RASON Reference Guide.",
|
|
13
|
+
"value": ["tv", "stereo", "speaker"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"data": {
|
|
17
|
+
"comment": "In the data section, an inline table object, parts, is created containing two index columns (parts and prods) and a value column. Since the index set prod exists, we can dimension the profits array according to this set in order to assign the correct profit values to the appropriate products. Likewise, we can dimension the inventory array according to the part set in order to assign the correct inventory level to each part. See UGProductMixTable3 for an illustration of the sort property.",
|
|
18
|
+
"parts": {
|
|
19
|
+
"comment": "Note that the order in which the table elements are entered is irrelevant since we are supplying both dimensions for each value. ",
|
|
20
|
+
"indexCols": ["part", "prod"],
|
|
21
|
+
"value": [
|
|
22
|
+
["chas", "tv", 1],
|
|
23
|
+
["elec", "stereo", 1],
|
|
24
|
+
["tube", "tv", 1],
|
|
25
|
+
["cone", "tv", 2],
|
|
26
|
+
["cone", "stereo", 2],
|
|
27
|
+
["chas", "stereo", 1],
|
|
28
|
+
["cone", "speaker", 1],
|
|
29
|
+
["psup", "tv", 1],
|
|
30
|
+
["psup", "stereo", 1],
|
|
31
|
+
["elec", "tv", 2],
|
|
32
|
+
["elec", "speaker", 1]
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"profits": {
|
|
36
|
+
"dimensions": ["prod"],
|
|
37
|
+
"value": [75, 50, 35],
|
|
38
|
+
"binding": "get",
|
|
39
|
+
"finalValue": []
|
|
40
|
+
},
|
|
41
|
+
"inventory": {
|
|
42
|
+
"dimensions": ["part"],
|
|
43
|
+
"value": [450, 250, 800, 450, 600],
|
|
44
|
+
"binding": "get",
|
|
45
|
+
"finalValue": []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"formulas": {
|
|
49
|
+
"comment": "Notice the use of the PIVOT function in the piv_parts formula. Recall that a table is stored as a vertical array. The PIVOT function returns a 2-dimensional table (or a 1- dimensional table) of values with rows and columns assigned by the index columns in the table passed as the first argument. (The first argument passes the data.) The second argument is the index column(s) to be assigned as column(s) in the PIVOT table. (These are the dimensions that will make up the columns of the table.) The third argument is the index column(s) to be assigned as row(s) in the PIVOT table. (These are the dimensions that will make up the rows of the table.) In this example, the table parts contains two index columns, parts and prods. The PIVOT function creates a 2-dimensional array of values by assigning the prod dimension (TV, Stereos and Speakers) as columns and the part dimension(chas, cone, elec, psup and tube) as rows. The result is a 5 x 3 matrix. Since piv_parts is now a 2-dimensional table, we can perform matrix multiplication using the MMULT (inherited from Excel) function to multiply this table by the variable array, x (which is also a vertical array). The result of this operation is a vertical array of size 5 which must be less than the inventory array (enforced by the upper property of 0). ",
|
|
50
|
+
"piv_parts": {
|
|
51
|
+
"formula": "PIVOT(parts, { 'prod' }, { 'part' })"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"variables": {
|
|
55
|
+
"comment":"The x array is dimensioned using the prod index.",
|
|
56
|
+
"x": {
|
|
57
|
+
"dimensions": ["prod"],
|
|
58
|
+
"value": 0,
|
|
59
|
+
"lower": 0,
|
|
60
|
+
"finalValue": []
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"constraints": {
|
|
64
|
+
"c": {
|
|
65
|
+
"dimensions": ["part"],
|
|
66
|
+
"formula": "MMULT(piv_parts, x) - inventory",
|
|
67
|
+
"upper": 0
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"objective": {
|
|
71
|
+
"total": {
|
|
72
|
+
"formula": "sumproduct(x, profits)",
|
|
73
|
+
"type": "maximize",
|
|
74
|
+
"finalValue": []
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|