@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,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "productMixCsv1Example",
|
|
3
|
+
"modelDescription": "Product Mix CSV 1 RASON Optimization Example: This example uses CSV table binding to read parameter values and save the final results. Recall that the Product Mix example finds the optimal product mix that a company should manufacture in order to maximize gross profit.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "There are 6 datasources (parts_data, invent_data, profit_data, vars_data, fcns_data and obj_data) that will either import data, export data or both. Download all 6 data source files by clicking the download icon on the Editor tab ribbon. Then attach all 6 files by clicking Choose Files in the Properties tab (to the right), navigating to the location of the saved files, and clicking Open. The index columns are specified using 'indexCols'. The value column is specified using 'valueCols'. All files are of type CSV. See the RASON User Guide for a complete list of supported file types. 'Direction' specifies if this is an import or export. Note that the valueCols property must always follow the indexCols property.",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"comment": "This data source pulls data from the ProductMixParts.txt file. This data source file contains two index sets, 'parts' and 'prods' and contains the required number of parts required to produce each product. The column in the data source containing the values is 'qty'. Since we are reading data from this source, the direction is 'import'.",
|
|
9
|
+
"type": "csv",
|
|
10
|
+
"connection": "ProductMixParts.txt",
|
|
11
|
+
"indexCols": [ "parts", "prods" ],
|
|
12
|
+
"valueCols": [ "qty" ],
|
|
13
|
+
"direction": "import"
|
|
14
|
+
},
|
|
15
|
+
"invent_data": {
|
|
16
|
+
"comment": "This data source pulls data from the ProductMixInventory.txt file. This data source file contains one index, 'parts'. The column 'inventory' contains the number of parts in inventory. Since we are reading data from this source, the direction is 'import'.",
|
|
17
|
+
"type": "csv",
|
|
18
|
+
"connection": "ProductMixInventory.txt",
|
|
19
|
+
"indexCols": [ "parts" ],
|
|
20
|
+
"valueCols": [ "inventory" ],
|
|
21
|
+
"direction": "import"
|
|
22
|
+
},
|
|
23
|
+
"profit_data": {
|
|
24
|
+
"comment": "This data source pulls data from the ProductMixProfits.txt file. This data source contains one index, 'prods'. The profit per unit for each product produced is in the 'profits' col. Since we are reading data from this source, the direction is 'import'.",
|
|
25
|
+
"type": "csv",
|
|
26
|
+
"connection": "ProductMixProfits.txt",
|
|
27
|
+
"indexCols": [ "prods" ],
|
|
28
|
+
"valueCols": [ "profits" ],
|
|
29
|
+
"direction": "import"
|
|
30
|
+
},
|
|
31
|
+
"vars_data": {
|
|
32
|
+
"comment": "This data source pulls data from the ResultVarsInit.txt file. This data source contains one index, 'prods'. The initial value for each variable is listed under 'initials'. Since we are reading the initial variable values and also saving the final values to this source, the direction is 'import/export'.",
|
|
33
|
+
"type": "csv",
|
|
34
|
+
"connection": "ResultVarsInit.txt",
|
|
35
|
+
"indexCols": [ "prods" ],
|
|
36
|
+
"valueCols": [ "initials" ],
|
|
37
|
+
"direction": "import/export"
|
|
38
|
+
},
|
|
39
|
+
"fcns_data": {
|
|
40
|
+
"comment": "Final constraint values will be exported, or saved, to the file, ResultFcns.txt. Since this file is used for export only, there is no need to attach this file to the model using Choose Files...",
|
|
41
|
+
"type": "csv",
|
|
42
|
+
"connection": "ResultFcns.txt",
|
|
43
|
+
"direction": "export"
|
|
44
|
+
},
|
|
45
|
+
"obj_data": {
|
|
46
|
+
"comment": "The final objective value will be exported, or saved, to the file, ResultObj.txt. Since this file is used for export only, there is no need to attach this file to the model using Choose Files...",
|
|
47
|
+
"type": "csv",
|
|
48
|
+
"connection": "ResultObj.txt",
|
|
49
|
+
"direction": "export"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"data": [
|
|
53
|
+
{
|
|
54
|
+
"comment": "Binds the 'parts_data' data source to 'parts2' data array.",
|
|
55
|
+
"name": "parts2",
|
|
56
|
+
"binding": "parts_data",
|
|
57
|
+
"valueCol": "qty"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"comment": "Binds the 'invent_data' data source to 'invent' data array.",
|
|
61
|
+
"name": "invent",
|
|
62
|
+
"binding": "invent_data",
|
|
63
|
+
"valueCol": "inventory"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"comment": "Binds the 'profit_data' data source to 'profit' data array.",
|
|
67
|
+
"name": "profit",
|
|
68
|
+
"binding": "profit_data",
|
|
69
|
+
"valueCol": "profits"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"formulas": [
|
|
73
|
+
{
|
|
74
|
+
"comment": "Constructs a pivot table, piv_parts, using the Excel function, PIVOT, using data from the parts2 data array.",
|
|
75
|
+
"name": "piv_parts",
|
|
76
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"variables": {
|
|
80
|
+
"comment": "Creates the 'x' variable array from the 'vars_data' datasource. The initial variable values are set to the values listed in the 'initials' column in the data source. The final variable values will be exported back to this file after the solve is complete.",
|
|
81
|
+
"name": "x",
|
|
82
|
+
"binding": "vars_data",
|
|
83
|
+
"valueCol": "initials",
|
|
84
|
+
"lower": 0,
|
|
85
|
+
"finalValue": []
|
|
86
|
+
},
|
|
87
|
+
"constraints": [
|
|
88
|
+
{
|
|
89
|
+
"comment": "5 constraints limiting the number of parts used by the number of parts in inventory. The result of the Excel MMULT function generates 5 constraints with right hand sides pulled from the invent data array. The final constraint values will be exported back to the same data source.",
|
|
90
|
+
"name": "c",
|
|
91
|
+
"dimensions": [ "parts" ],
|
|
92
|
+
"formula": "MMULT(piv_parts, x)",
|
|
93
|
+
"upper": "invent",
|
|
94
|
+
"binding": "fcns_data",
|
|
95
|
+
"finalValue": []
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"objective": {
|
|
99
|
+
"comment": "Calculates the objective function by multiplying the number of products produced (the variables in the x array) by the profit per unit values from the profit data array imported from the obj_data data source. The final objective value will be exported back to this data source.",
|
|
100
|
+
"name": "total",
|
|
101
|
+
"formula": "sumproduct(x, profit)",
|
|
102
|
+
"type": "maximize",
|
|
103
|
+
"binding": "obj_data",
|
|
104
|
+
"finalValue": []
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "productMixCSV2Example",
|
|
3
|
+
"modelDescription": "Product Mix CSV2 RASON Optimization Example: This example uses CSV table binding to import parameter values and export (save) results. Notice that in this example, the x array within Variables, includes the indexCols property. Recall that the Product Mix example finds the optimal product mix that a company should manufacture in order to maximize gross profit.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "There are 6 datasources (parts_data, invent_data, profit_data, vars_data, fcns_data and obj_data) that will either import data, export data or both. Download all 6 data source files by clicking the download icon on the Editor tab ribbon. Then attach all 6 files by clicking Choose Files in the Properties tab (to the right), navigating to the location of the saved files, and clicking Open. The index columns are specified using 'indexCols'. The value column is specified using 'valueCols'. All files are of type CSV. See the RASON User Guide for a complete list of supported file types. 'Direction' specifies if this is an import or export. Note that the valueCols property must always follow the indexCols property.",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"comment": "This data source pulls data from the ProductMixParts.txt file. This data source file contains two indices, 'parts' and 'prods'. The column 'qty' contains the number of parts required to produce each product. Since we are reading data from this source, the direction is 'import'.",
|
|
9
|
+
"type": "csv",
|
|
10
|
+
"connection": "ProductMixParts.txt",
|
|
11
|
+
"indexCols": [ "parts", "prods" ],
|
|
12
|
+
"valueCols": [ "qty" ],
|
|
13
|
+
"direction": "import"
|
|
14
|
+
},
|
|
15
|
+
"invent_data": {
|
|
16
|
+
"comment": "This data source pulls data from the ProductMixInventory.txt file. This data source file contains one index, 'parts'. The column 'inventory' contains the number of parts in inventory. Since we are reading data from this source, the direction is 'import'.",
|
|
17
|
+
"type": "csv",
|
|
18
|
+
"connection": "ProductMixInventory.txt",
|
|
19
|
+
"indexCols": [ "parts" ],
|
|
20
|
+
"valueCols": [ "inventory" ],
|
|
21
|
+
"direction": "import"
|
|
22
|
+
},
|
|
23
|
+
"profit_data": {
|
|
24
|
+
"comment": "This data source pulls data from the ProductMixProfits.txt file. This data source contains one index, 'prods'. The profit per unit for each product produced is in the 'profits' col. Since we are reading data from this source, the direction is 'import'.",
|
|
25
|
+
"type": "csv",
|
|
26
|
+
"connection": "ProductMixProfits.txt",
|
|
27
|
+
"indexCols": [ "prods" ],
|
|
28
|
+
"valueCols": [ "profits" ],
|
|
29
|
+
"direction": "import"
|
|
30
|
+
},
|
|
31
|
+
"vars_data": {
|
|
32
|
+
"comment": "This data source pulls data from the ResultVarsInit.txt file. This data source contains one index, 'prods'. The initial value for each variable is listed under 'initials'. Since we are reading the initial variable values and also saving the final values to this source, the direction is 'import/export'. Note that the indexCols/valueCols properties are missing. In this case, RASON assumes the last column in table.",
|
|
33
|
+
"type": "csv",
|
|
34
|
+
"connection": "ResultVarsInit.txt",
|
|
35
|
+
"direction": "import/export"
|
|
36
|
+
},
|
|
37
|
+
"fcns_data": {
|
|
38
|
+
"comment": "Final constraint values will be exported, or saved, to the file, ResultFcns.txt. Since this file is used for export only, there is no need to attach this file to the model using Choose Files...",
|
|
39
|
+
"type": "csv",
|
|
40
|
+
"connection": "ResultFcns.txt",
|
|
41
|
+
"direction": "export"
|
|
42
|
+
},
|
|
43
|
+
"obj_data": {
|
|
44
|
+
"comment": "The final objective value will be exported, or saved, to the file, ResultObj.txt. Since this file is used for export only, there is no need to attach this file to the model using Choose Files...",
|
|
45
|
+
"type": "csv",
|
|
46
|
+
"connection": "ResultObj.txt",
|
|
47
|
+
"direction": "export"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"data": [
|
|
51
|
+
{
|
|
52
|
+
"comment": "Binds the 'parts_data' data source to 'parts2' data array.",
|
|
53
|
+
"name": "parts2",
|
|
54
|
+
"binding": "parts_data",
|
|
55
|
+
"valueCol": "qty"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"comment": "Binds the 'invent_data' data source to 'invent' data array.",
|
|
59
|
+
"name": "invent",
|
|
60
|
+
"binding": "invent_data",
|
|
61
|
+
"valueCol": "inventory"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"comment": "Binds the 'profit_data' data source to 'profit' data array.",
|
|
65
|
+
"name": "profit",
|
|
66
|
+
"binding": "profit_data",
|
|
67
|
+
"valueCol": "profits"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"formulas": [
|
|
71
|
+
{
|
|
72
|
+
"comment": "Constructs a pivot table, piv_parts, using the Excel function, PIVOT, using data from the parts2 data array.",
|
|
73
|
+
"name": "piv_parts",
|
|
74
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"variables": {
|
|
78
|
+
"comment": "Creates the 'x' variable array from the 'vars_data' datasource. The initial variable values are set to the values listed in the 'initials' column in the data source. The final variable values will be exported back to this file after the solve is complete. Note that in this example, the indexCols property is specified, 'prods', whereas in ProductMixCSV1, this property was omitted.",
|
|
79
|
+
"name": "x",
|
|
80
|
+
"indexCols": [ "prods" ],
|
|
81
|
+
"value": 0,
|
|
82
|
+
"lower": 0,
|
|
83
|
+
"binding": "vars_data",
|
|
84
|
+
"finalValue": []
|
|
85
|
+
},
|
|
86
|
+
"constraints": [
|
|
87
|
+
{
|
|
88
|
+
"comment": "5 constraints limiting the number of parts used by the number of parts in inventory. The result of the Excel MMULT function generates 5 constraints with right hand sides pulled from the invent data array. The final constraint values will be exported back to the fcns_data data source, ultimately ResultFcns.txt.",
|
|
89
|
+
"name": "c",
|
|
90
|
+
"dimensions": [ "parts" ],
|
|
91
|
+
"formula": "MMULT(piv_parts, x)",
|
|
92
|
+
"upper": "invent",
|
|
93
|
+
"binding": "fcns_data",
|
|
94
|
+
"finalValue": []
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"objective": {
|
|
98
|
+
"comment": "Calculates the objective function by multiplying the number of products produced (the variables in the x array) by the profit per unit values from the profit data array imported from the obj_data data source. The final objective value will be exported back to the obj_data data source, ultimately ResultObj.txt.",
|
|
99
|
+
"name": "total",
|
|
100
|
+
"formula": "sumproduct(x, profit)",
|
|
101
|
+
"type": "maximize",
|
|
102
|
+
"binding": "obj_data",
|
|
103
|
+
"finalValue": []
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "productMixSQL11Example",
|
|
3
|
+
"modelDescription": "Product Mix SQL RASON Optimization Example: This example illustrates how to import data from an SQL table using the Product Mix example. Recall that the Product Mix example finds the optimal product mix that a company should manufacture in order to maximize gross profit.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "This example import data from three datasources: parts_data, invent_data and profit_data. The 'type' property specifies the file type. See the RASON User Guide for a list of all supported data types. The 'connection' property passes the SQL database credentials. Note that the SQL database could also be added as a Data Connection which allows SQL credentials to be entered in a secure location and out of the code. See Data Connections within the RASON User Guide for more information. The 'selection' property selects the data columns in the SQL database, 'indexCols' selects the indices for the data, 'valueCols' selects the column containing the data values and 'direction' specifies whether the data will be imported or exported. Note that the valueCols property must follow the indexCols property",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"type": "odbc",
|
|
9
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
10
|
+
"selection": "SELECT Parts as parts, Products as prods, Qty as qty FROM Parts ORDER BY ID",
|
|
11
|
+
"indexCols": [ "parts", "prods" ],
|
|
12
|
+
"valueCols": [ "qty" ],
|
|
13
|
+
"direction": "import"
|
|
14
|
+
},
|
|
15
|
+
"invent_data": {
|
|
16
|
+
"type": "odbc",
|
|
17
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
18
|
+
"selection": "SELECT Parts as parts, Inventory as inventory FROM Inventory ORDER BY ID",
|
|
19
|
+
"indexCols": [ "parts" ],
|
|
20
|
+
"valueCols": [ "inventory" ],
|
|
21
|
+
"direction": "import"
|
|
22
|
+
},
|
|
23
|
+
"profit_data": {
|
|
24
|
+
"type": "odbc",
|
|
25
|
+
"connection": "Driver={SQL Server};Server=tcp:solver.database.windows.net,1433;Database=Rason;Uid=rasonread;Pwd=Rason1234;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",
|
|
26
|
+
"selection": "SELECT Products as prods, Profit as profit FROM Profits ORDER BY ID",
|
|
27
|
+
"indexCols": [ "prods" ],
|
|
28
|
+
"valueCols": [ "profit" ],
|
|
29
|
+
"direction": "import"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"data": [
|
|
33
|
+
{
|
|
34
|
+
"comment": "Binds the 'profit_data' data source to 'profit' data array. Note that the valueCol property is missing. In this case, RASON assumes the last column in the table.",
|
|
35
|
+
"name": "profit",
|
|
36
|
+
"binding": "profit_data"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"comment": "Binds the 'invent_data' data source to 'invent' data array. Note that since the valueCol property is missing, RASON assumes the last column in the table.",
|
|
40
|
+
"name": "invent",
|
|
41
|
+
"binding": "invent_data"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"comment": "Binds the 'parts_data' data source to 'parts2' data array. Note that since the valueCol property is missing, RASON assumes the last column in the table.",
|
|
45
|
+
"name": "parts2",
|
|
46
|
+
"binding": "parts_data"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"formulas": [
|
|
50
|
+
{
|
|
51
|
+
"comment": "Constructs a pivot table, piv_parts, using the Excel function, PIVOT, using data from the parts2 data array.",
|
|
52
|
+
"name": "piv_parts",
|
|
53
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"variables": {
|
|
57
|
+
"comment": "Creates the 'x' variable array of size 'prods', or 3. The initial variable values are set to the values listed in the 'value' column, or 0. The final variable values will be returned in the result because of presence of the keyword finalValue, but will not be exported to a file since no 'binding' keyword is present.",
|
|
58
|
+
"name": "x",
|
|
59
|
+
"dimensions": [ "prods" ],
|
|
60
|
+
"value": 0,
|
|
61
|
+
"lower": 0,
|
|
62
|
+
"finalValue": []
|
|
63
|
+
},
|
|
64
|
+
"constraints": [
|
|
65
|
+
{
|
|
66
|
+
"comment": "5 constraints limiting the number of parts used by the number of parts in inventory. The result of the Excel MMULT function generates 5 constraints with right hand sides pulled from the 'invent' data array. The final constraint values will be returned in the results due to the presence of the finalValue keyword, but will not be exported since no 'binding' property is present.",
|
|
67
|
+
"name": "c",
|
|
68
|
+
"dimensions": [ "parts" ],
|
|
69
|
+
"formula": "MMULT(piv_parts, x)",
|
|
70
|
+
"upper": "invent",
|
|
71
|
+
"finalValue": []
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"objective": {
|
|
75
|
+
"comment": "Calculates the objective function by multiplying the number of products produced (the variables in the x array) by the profit per unit values from the profit data array imported from the profit_data data source. The final objective value will be returned in the result due to the presence of the finalValue keyword.",
|
|
76
|
+
|
|
77
|
+
"name": "total",
|
|
78
|
+
"formula": "sumproduct(x, profit)",
|
|
79
|
+
"type": "maximize",
|
|
80
|
+
"finalValue": []
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "rowopExample",
|
|
3
|
+
"modelDescription": "RASON example uses Frontline's ROWOP function to solve a famous and difficult fixed-charge transportation optimization model. The optimal objective = 3712. In a fixed charge constraint, a binary variable is forced to 1 if the corresponding continuous variable is nonzero. In other words, if X >0 then Y = 1. From here the binary variable may be multiplied by a constant value to model a penalty or charge.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"data": {
|
|
6
|
+
"comment": "The data section contains constant parameters utilized in the model to generate the constraints and the objective.",
|
|
7
|
+
"rows": {
|
|
8
|
+
"comment": "Creates constant, rows, with an assigned value = 14.",
|
|
9
|
+
"value": 14
|
|
10
|
+
},
|
|
11
|
+
"cols": {
|
|
12
|
+
"comment": "Creates constant, cols, with an assigned value = 18.",
|
|
13
|
+
"value": 18
|
|
14
|
+
},
|
|
15
|
+
"I": {
|
|
16
|
+
"comment": "Creates the array, I, of size 14. All elements values = 1.",
|
|
17
|
+
"dimensions": [ "rows" ],
|
|
18
|
+
"value": 1
|
|
19
|
+
},
|
|
20
|
+
"J": {
|
|
21
|
+
"comment": "Creates the array, J, of size 18. All elements values = 1.",
|
|
22
|
+
"dimensions": [ "cols" ],
|
|
23
|
+
"value": 1
|
|
24
|
+
},
|
|
25
|
+
"Demand": {
|
|
26
|
+
"comment": "Creates the array, Demand. The size of the array is inferred by the number of values passed. These values represent the demand.",
|
|
27
|
+
"value": [ 6, 13, 21, 11, 20, 4, 35, 13, 20, 9, 7, 18, 14, 22, 33, 45, 11, 8 ]
|
|
28
|
+
},
|
|
29
|
+
"Supply": {
|
|
30
|
+
"comment": "Creates the array, Supply. The size of the array is inferred by the number of values passed. These values represent the supply.",
|
|
31
|
+
"value": [ 21, 19, 24, 10, 27, 25, 10, 16, 17, 38, 22, 33, 22, 26 ]
|
|
32
|
+
},
|
|
33
|
+
"Cost": {
|
|
34
|
+
"comment": "Creates Cost matrix. This matrix contains the transportation costs, or the cost per mile",
|
|
35
|
+
"value": [
|
|
36
|
+
[ 4, 4, 10, 3, 4, 9, 10, 9, 3, 10, 5, 10, 9, 10, 5, 8, 9, 8 ],
|
|
37
|
+
[ 7, 1, 7, 4, 6, 7, 7, 1, 4, 4, 10, 1, 7, 5, 8, 3, 3, 1 ],
|
|
38
|
+
[ 10, 10, 4, 10, 3, 2, 3, 8, 3, 7, 1, 5, 5, 6, 1, 8, 3, 8 ],
|
|
39
|
+
[ 7, 1, 1, 1, 10, 1, 7, 6, 6, 2, 5, 5, 7, 9, 6, 3, 3, 5 ],
|
|
40
|
+
[ 4, 10, 2, 1, 7, 8, 1, 2, 4, 5, 9, 2, 8, 7, 2, 8, 5, 3 ],
|
|
41
|
+
[ 3, 7, 4, 10, 8, 10, 9, 9, 6, 8, 9, 5, 5, 6, 1, 4, 9, 5 ],
|
|
42
|
+
[ 2, 7, 10, 10, 4, 10, 6, 8, 6, 6, 6, 8, 2, 3, 6, 9, 7, 5 ],
|
|
43
|
+
[ 1, 7, 10, 1, 7, 3, 1, 10, 10, 6, 2, 9, 1, 6, 5, 8, 6, 5 ],
|
|
44
|
+
[ 10, 7, 4, 1, 1, 1, 8, 4, 4, 3, 2, 4, 6, 6, 8, 3, 6, 6 ],
|
|
45
|
+
[ 4, 7, 1, 3, 3, 1, 3, 3, 5, 9, 9, 2, 6, 8, 2, 4, 3, 6 ],
|
|
46
|
+
[ 4, 1, 1, 2, 1, 4, 6, 8, 2, 4, 2, 5, 5, 8, 7, 4, 6, 9 ],
|
|
47
|
+
[ 7, 4, 1, 3, 10, 3, 1, 5, 2, 5, 1, 5, 6, 6, 3, 9, 9, 3 ],
|
|
48
|
+
[ 4, 7, 1, 10, 3, 8, 2, 9, 9, 6, 6, 9, 7, 7, 9, 1, 3, 10 ],
|
|
49
|
+
[ 6, 4, 8, 1, 2, 3, 4, 9, 9, 2, 6, 2, 5, 7, 8, 10, 10, 2 ]
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"FixedCost": {
|
|
53
|
+
"comment": "Creates FixedCost matrix. This matrix contains the fixed charge cost.",
|
|
54
|
+
"value": [
|
|
55
|
+
[ 202.0, 222.0, 100.0, 174.0, 116.0, 253.0, 252.0, 113.0, 261.0, 240.0, 106.0, 146.0, 76.0, 169.0, 247.0, 194.0, 208.0, 242.0 ],
|
|
56
|
+
[ 190.0, 158.0, 243.0, 175.0, 191.0, 243.0, 162.0, 251.0, 248.0, 213.0, 123.0, 65.0, 73.0, 246.0, 181.0, 132.0, 91.0, 264.0 ],
|
|
57
|
+
[ 229.0, 112.0, 107.0, 193.0, 214.0, 120.0, 154.0, 150.0, 94.0, 74.0, 104.0, 152.0, 94.0, 258.0, 264.0, 88.0, 262.0, 220.0 ],
|
|
58
|
+
[ 190.0, 198.0, 130.0, 118.0, 135.0, 91.0, 243.0, 258.0, 98.0, 78.0, 188.0, 129.0, 162.0, 208.0, 110.0, 186.0, 262.0, 223.0 ],
|
|
59
|
+
[ 154.0, 217.0, 156.0, 91.0, 233.0, 191.0, 172.0, 157.0, 202.0, 212.0, 169.0, 173.0, 150.0, 96.0, 210.0, 194.0, 106.0, 221.0 ],
|
|
60
|
+
[ 141.0, 149.0, 234.0, 230.0, 126.0, 113.0, 101.0, 240.0, 138.0, 87.0, 242.0, 189.0, 93.0, 204.0, 184.0, 176.0, 148.0, 140.0 ],
|
|
61
|
+
[ 131.0, 256.0, 147.0, 252.0, 107.0, 112.0, 165.0, 255.0, 71.0, 244.0, 192.0, 168.0, 250.0, 132.0, 177.0, 195.0, 98.0, 105.0 ],
|
|
62
|
+
[ 211.0, 85.0, 124.0, 171.0, 139.0, 115.0, 65.0, 253.0, 217.0, 178.0, 186.0, 87.0, 119.0, 137.0, 82.0, 208.0, 205.0, 223.0 ],
|
|
63
|
+
[ 147.0, 149.0, 214.0, 105.0, 132.0, 131.0, 202.0, 213.0, 81.0, 234.0, 226.0, 202.0, 138.0, 245.0, 148.0, 209.0, 177.0, 152.0 ],
|
|
64
|
+
[ 249.0, 126.0, 145.0, 235.0, 234.0, 92.0, 201.0, 142.0, 106.0, 113.0, 134.0, 90.0, 138.0, 114.0, 239.0, 222.0, 262.0, 205.0 ],
|
|
65
|
+
[ 95.0, 251.0, 145.0, 131.0, 130.0, 222.0, 192.0, 179.0, 183.0, 234.0, 196.0, 106.0, 200.0, 147.0, 72.0, 176.0, 231.0, 160.0 ],
|
|
66
|
+
[ 109.0, 234.0, 78.0, 115.0, 136.0, 221.0, 252.0, 129.0, 80.0, 94.0, 65.0, 177.0, 258.0, 137.0, 185.0, 242.0, 181.0, 132.0 ],
|
|
67
|
+
[ 107.0, 233.0, 91.0, 112.0, 261.0, 150.0, 119.0, 102.0, 207.0, 138.0, 71.0, 122.0, 125.0, 166.0, 168.0, 144.0, 174.0, 241.0 ],
|
|
68
|
+
[ 191.0, 154.0, 101.0, 66.0, 156.0, 128.0, 234.0, 75.0, 86.0, 210.0, 231.0, 79.0, 105.0, 166.0, 147.0, 171.0, 241.0, 80.0 ]
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"formulas": {
|
|
73
|
+
"comment": "A new matrix is created using the MATOP function by applying two operators, oper1 and oper2, MATOP(A, oper1, oper2, B); For each k: MATOP[x, y] = MATOP[x, y] oper2 (A[x, k] oper1 B[k, y]). For more information on this function, see https://www.solver.com/risk-solver-help/psi-function-help/matrices/matop.",
|
|
74
|
+
"xup": {
|
|
75
|
+
"dimensions": [ "rows", "cols" ],
|
|
76
|
+
"formula": "MATOP(Supply, 'min', '+', transpose(Demand))"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"variables": {
|
|
80
|
+
"comment": "This model includes two variable blocks, x and y. The x variable array contains 252 continuous variables. The y variable array contains 252 binary (0,1) variables.",
|
|
81
|
+
"x": {
|
|
82
|
+
"comment": "Creates x double array to hold 252 variables (14 * 18). All vars have been given an initial value of 0 using 'value' and a lower bound of 0, using 'lower'. The final variable values will be returned in the results due to the presence of the 'finalValue' keyword.",
|
|
83
|
+
"dimensions": [ "rows", "cols" ],
|
|
84
|
+
"value": 0,
|
|
85
|
+
"lower": 0,
|
|
86
|
+
"finalValue": []
|
|
87
|
+
},
|
|
88
|
+
"y": {
|
|
89
|
+
"comment": "Creates y double array to hold 252 more variables (14 * 18). All vars have been given an initial value of 0 using 'value', a lower bound of 0, using 'lower' and an upper bound of 1 using 'upper'. The 'type' property specifies that variables in this array must be integer, or binary variables, taking on values of either 0 or 1. The final variable values will be returned in the results due to the presence of the 'finalValue' keyword. The 'fix' constraint will ensure that if the corresponding x variable is nonzero, the corresponding y variable will be forced to 1, (i.e. if x(1,1) is > 0, y(1,1) = 1. ",
|
|
90
|
+
"dimensions": [ "rows", "cols" ],
|
|
91
|
+
"value": 0,
|
|
92
|
+
"lower": 0,
|
|
93
|
+
"upper": 1,
|
|
94
|
+
"type": "int",
|
|
95
|
+
"finalValue": []
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"constraints": {
|
|
99
|
+
"comment": "Contains 18 + 14 + 252 = 284 constraints.",
|
|
100
|
+
"con1": {
|
|
101
|
+
"comment": "Generates Demand constraints: Adds up the continuous variable values by row and sets each formula equal to the appropriate demand value (i.e. x(1,1) + x(2,1) + x(3,1) + ... x(18,1) = 6 where 6 is Demand[1].",
|
|
102
|
+
"dimensions": [ "cols" ],
|
|
103
|
+
"formula": "transpose(ROWOP(x, '+'))",
|
|
104
|
+
"equal": "Demand"
|
|
105
|
+
},
|
|
106
|
+
"con2": {
|
|
107
|
+
"comment": "Generates Supply constraints: Adds up the continuous variable values by column and sets each formula equal to the appropriate supply value (i.e. x(1,1) + x(2,1) + x(3,1) + ... x(18,1) = 21 where 21 is Supply[1].",
|
|
108
|
+
"dimensions": [ "rows" ],
|
|
109
|
+
"formula": "COLOP(x, '+')",
|
|
110
|
+
"equal": "Supply"
|
|
111
|
+
},
|
|
112
|
+
"fix": {
|
|
113
|
+
"comment": "Creates the fixed charge constraint that forces the y variables to 1 when the corresponding x variable i nonzero. This type of constraint is otherwise known as a fixed-charge constraint because it applies a fixed cost if a truck route is selected.",
|
|
114
|
+
"dimensions": [ "rows", "cols" ],
|
|
115
|
+
"formula": "xup * y - x",
|
|
116
|
+
"lower": 0
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"objective": {
|
|
120
|
+
"obj": {
|
|
121
|
+
"comment": "The objective minimizes the transportation costs by adding the sumproduct of the Fixed Cost matrix and the y matrix with the sumproduct of the Cost matrix and the x matrix.",
|
|
122
|
+
"type": "minimize",
|
|
123
|
+
"formula": "sumproduct(FixedCost, y) + sumproduct(Cost, x)",
|
|
124
|
+
"finalValue": []
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "AirlineHubExample",
|
|
3
|
+
"modelDescription": "Airline Hub Nonlinear RASON Optimization Example: Finds the hub location that minimizes the overall distance to 6 different airports. This example uses the distance formula to determine the distance between the projected hub and each of the 6 airports, SQRT((x1 - x0) + (y1 - y0)) The objective returns the coordinates of the prospective location.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"engineSettings": {
|
|
6
|
+
"engine": "GRG Nonlinear"
|
|
7
|
+
},
|
|
8
|
+
"variables": {
|
|
9
|
+
"comment": "3 variables: x, y and z. x and y are the (x, y) coordinates of the proposed hub location. z is an artificial variable that will be minimized in the objective. The initial value of each variable is set to 1 using the value property and the final values will be returned in the result due to the presence of the keyword, finalValue.",
|
|
10
|
+
"x": {
|
|
11
|
+
"value": 1.0,
|
|
12
|
+
"finalValue": []
|
|
13
|
+
},
|
|
14
|
+
"y": {
|
|
15
|
+
"value": 1.0,
|
|
16
|
+
"finalValue": []
|
|
17
|
+
},
|
|
18
|
+
"z": {
|
|
19
|
+
"value": 1.0,
|
|
20
|
+
"finalValue": []
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"constraints": {
|
|
24
|
+
"comment": "Each constraint calculates the distance between the proposed hub and each of the 6 airports. Originally, each constraint would be of the form SQRT((x1 - x0) + (y1 - y0)) <= z where z is the artificial variable. When z is minimized in the objective, it has a 'squashing' effect that pushes the distance formula to be as small as possible, thereby moving the (x,y) coordinates to such a place that minimizes the distance between the hub and all 6 airports. (To convert the constraint to standard form, z is subtracted from both sides of the equation, leaving SQRT((x1 - x0) + (y1 - y0)) - z <= 0.)",
|
|
25
|
+
"c1": {
|
|
26
|
+
"comment": "Minimize the distance between the proposed hub and airport 1.",
|
|
27
|
+
"formula": "sqrt((x - 1)^2 + (y - 4)^2) - z",
|
|
28
|
+
"upper": 0
|
|
29
|
+
},
|
|
30
|
+
"c2": {
|
|
31
|
+
"comment": "Minimize the distance between the proposed hub and airport 2.",
|
|
32
|
+
"formula": "sqrt((x - 0.5)^2 + (y - 3)^2) - z",
|
|
33
|
+
"upper": 0
|
|
34
|
+
},
|
|
35
|
+
"c3": {
|
|
36
|
+
"comment": "Minimize the distance between the proposed hub and airport 3.",
|
|
37
|
+
"formula": "sqrt((x - 2)^2 + (y - 4)^2) - z",
|
|
38
|
+
"upper": 0
|
|
39
|
+
},
|
|
40
|
+
"c4": {
|
|
41
|
+
"comment": "Minimize the distance between the proposed hub and airport 4.",
|
|
42
|
+
"formula": "sqrt((x - 2)^2 + (y - 2)^2) - z",
|
|
43
|
+
"upper": 0
|
|
44
|
+
},
|
|
45
|
+
"c5": {
|
|
46
|
+
"comment": "Minimize the distance between the proposed hub and airport 5.",
|
|
47
|
+
"formula": "sqrt((x - 2)^2 + (y - 5)^2) - z",
|
|
48
|
+
"upper": 0
|
|
49
|
+
},
|
|
50
|
+
"c6": {
|
|
51
|
+
"comment": "Minimize the distance between the proposed hub and airport 6.",
|
|
52
|
+
"formula": "sqrt((x - 0.5)^2 + (y - 6)^2) - z",
|
|
53
|
+
"upper": 0
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"objective": {
|
|
57
|
+
"comment": "Minimize the artificial variable z. This minimization 'squashes' all six of the distance formulas. The resulting (x,y) coordinate will be the coordinate that minimizes the distance between the hub and all six airports.",
|
|
58
|
+
"obj": {
|
|
59
|
+
"formula": "z",
|
|
60
|
+
"type": "minimize",
|
|
61
|
+
"finalValue": []
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "AirlineHub2Example",
|
|
3
|
+
"modelDescription": "Airline Hub 2 RASON Nonlinear Optimization Example: Same problem as AirlineHubExample but this example uses block constraints. (Recall that this RASON example finds the minimum distance between a proposed airline hub location and several regional cities.) This model still finds the location that minimizes the overall distance to 6 different airports",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "As with AirlineHubExample, there are 3 variables in the model: x, y and z. x and y are the (x, y) coordinates of the proposed hub location. z is an artificial variable that will be minimized in the objective. The initial value of each variable is set to 1 using the value property and the final values will be returned in the result due to the presence of the keyword, finalValue.",
|
|
7
|
+
|
|
8
|
+
"x": {
|
|
9
|
+
"value": 1.0,
|
|
10
|
+
"finalValue": []
|
|
11
|
+
},
|
|
12
|
+
"y": {
|
|
13
|
+
"value": 1.0,
|
|
14
|
+
"finalValue": []
|
|
15
|
+
},
|
|
16
|
+
"z": {
|
|
17
|
+
"value": 1.0,
|
|
18
|
+
"finalValue": []
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"data": {
|
|
22
|
+
"comment": "The data section holds the x and y coordinates of each of the 6 airports. Supplying the x and y coordinates in two arrays allows all 6 constraints to be entered as a constraint block. See 'constraints' section below. In this example, the size of the arrays are inferred by the number of values passed to each array.",
|
|
23
|
+
"dx": {
|
|
24
|
+
"comment": "These are the x coordinates of each of the 6 airports.",
|
|
25
|
+
"value": [ 1, 0.5, 2, 2, 2, 0.5 ]
|
|
26
|
+
},
|
|
27
|
+
"dy": {
|
|
28
|
+
"comment": "These are the y coordinates of each of the 6 airports.",
|
|
29
|
+
"value": [ 4, 3, 4, 2, 5, 6 ]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"constraints": {
|
|
33
|
+
"comment": "In AirlineHubExample, each constraint was entered separately. In this example, all six constraints are entered at once. This was made possible by the x and y coordinates being supplied via two arrays, dx and dy. Recall from the original AirlineHubExample, that each constraint calculates the distance between the proposed hub and each of the 6 airports. Originally, each constraint would be of the form SQRT((x1 - x0) + (y1 - y0)) <= z where z is the artificial variable. When z is minimized in the objective, it has a 'squashing' effect that pushes the distance formula to be as small as possible, thereby moving the (x,y) coordinates to such a place that minimizes the distance between the hub and all 6 airports. (To convert the constraint to standard form, z is subtracted from both sides of the equation, leaving SQRT((x1 - x0) + (y1 - y0)) - z <= 0.) Notice that the 'dimensions' propety is used to explicitly create the array of size 6.",
|
|
34
|
+
"c": {
|
|
35
|
+
"dimensions": [ 6 ],
|
|
36
|
+
"formula": "sqrt((x - dx)^2 + (y - dy)^2) - z",
|
|
37
|
+
"upper": 0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"objective": {
|
|
41
|
+
"obj": {
|
|
42
|
+
"comment": "Minimize the artificial variable z. This minimization 'squashes' all six of the distance formulas. The resulting (x,y) coordinate will be the coordinate that minimizes the distance between the hub and all six airports.",
|
|
43
|
+
"formula": "z",
|
|
44
|
+
"type": "minimize",
|
|
45
|
+
"finalValue": []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "AirlineHub3Example",
|
|
3
|
+
"modelDescription": "Airline Hub 3 RASON Nonlinear Optimization Example: Same problem as AirlineHubExample and AirlineHub2Example but this example specifies the dimension directly for the data and constraint arrays. (Recall that these two RASON examples find the minimum distance between a proposed airline hub location and several regional cities.) This model still finds the location that minimizes the overall distance to 6 different airports",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "As with AirlineHubExample, there are 3 variables in the model: x, y and z. x and y are the (x, y) coordinates of the proposed hub location. z is an artificial variable that will be minimized in the objective. The initial value of each variable is set to 1 using the value property and the final values will be returned in the result due to the presence of the keyword, finalValue. This section remains unchanged from the previous example, AirlineHub2Example.",
|
|
7
|
+
"x": {
|
|
8
|
+
"value": 1.0,
|
|
9
|
+
"finalValue": []
|
|
10
|
+
},
|
|
11
|
+
"y": {
|
|
12
|
+
"value": 1.0,
|
|
13
|
+
"finalValue": []
|
|
14
|
+
},
|
|
15
|
+
"z": {
|
|
16
|
+
"value": 1.0,
|
|
17
|
+
"finalValue": []
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"data": {
|
|
21
|
+
"comment": "The data section holds the x and y coordinates of each of the 6 airports. Supplying the x and y coordinates in two arrays allows all 6 constraints to be entered as a constraint block. See 'constraints' section below. In this example, the array dimensions are explicitly set using the dimensions property.",
|
|
22
|
+
"dx": {
|
|
23
|
+
"dimensions": [ 6 ],
|
|
24
|
+
"value": [ 1, 0.5, 2, 2, 2, 0.5 ]
|
|
25
|
+
},
|
|
26
|
+
"dy": {
|
|
27
|
+
"dimensions": [ 6 ],
|
|
28
|
+
"value": [ 4, 3, 4, 2, 5, 6 ]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"constraints": {
|
|
32
|
+
"comment": "The only difference for this section compared with AirlineHub2Example, is that in this example, the finalValue keyword is present which means that the final value of each constraint will be returned in the results.",
|
|
33
|
+
"c": {
|
|
34
|
+
"dimensions": [ 6 ],
|
|
35
|
+
"formula": "sqrt((x - dx)^2 + (y - dy)^2) - z",
|
|
36
|
+
"upper": 0,
|
|
37
|
+
"finalValue": []
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"objective": {
|
|
41
|
+
"comment": "Minimize the artificial variable z. This minimization 'squashes' all six of the distance formulas. The resulting (x,y) coordinate will be the coordinate that minimizes the distance between the hub and all six airports. This section remains unchanged from the previous example, AirlineHub2Example.",
|
|
42
|
+
"obj": {
|
|
43
|
+
"formula": "z",
|
|
44
|
+
"type": "minimize",
|
|
45
|
+
"finalValue": []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|