@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,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "BoxFunctionSimulation",
|
|
3
|
+
"modelType": "simulation",
|
|
4
|
+
"modelDescription": "Simulation model containing a box function that calculates the predicted daily price of a stock. In the original example, GBM Simulation Example, the daily predicted stock price is calculated using a typical formula entered into the 'formulas' section. In this example, the predicted daily stock price is calculated using a custom, reusable Box Function. Box Functions are an easy, reliable method to replicate formulas in a RASON model. For more information on Box Functions, see Defining Custom Functions on the Help tab. ",
|
|
5
|
+
"boxFunctions": {
|
|
6
|
+
"comment": "Use a box function to create a custom, reusable function which can be called to calculate intermediary formulas, constraints or the objective. Box functions are a reliable way to calculate a formula that is called many times in a model. There is one box function in this model, funDailyPrice.",
|
|
7
|
+
"funDailyPrice": {
|
|
8
|
+
"comment": "The name of the box function is 'funDailyPrice'. The 'inputs' property (required) lists the input parameter to the function. The 'inputTypes' property (optional) gives the type of each input. In this example, both input parameters must be numbers. The property 'language' (required) can only be 'Excel' or 'FEEL'. This property determines what syntax is used in the box function. The property 'resultType' specifies the type of the result. In this case, the function will return a number. The body of the function is where the intermediary formula calculations are performed. The names, 'formula1', 'formula2' and 'formula3' are the users choice. The property 'result' (required) calculates the result of the function. The result can accept formulas calculated within the 'body' of the function.",
|
|
9
|
+
"inputs": [ "PrevClose", "NormDist" ],
|
|
10
|
+
"inputTypes": [ "number", "number" ],
|
|
11
|
+
"language": "EXCEL",
|
|
12
|
+
"resultType": "number",
|
|
13
|
+
"body": {
|
|
14
|
+
"formula1": {
|
|
15
|
+
"formula": "Volatility*SQRT(1/NumDays)*NormDist"
|
|
16
|
+
},
|
|
17
|
+
"formula2": {
|
|
18
|
+
"formula": "EXP((AppRate-Volatility^2*0.5)*(1/NumDays))"
|
|
19
|
+
},
|
|
20
|
+
"formula3": {
|
|
21
|
+
"formula": "PrevClose"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"result": "PrevClose*(Formula2 + formula1)"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"uncertainVariables": {
|
|
28
|
+
"comment": "These are the uncertain variables in the model. There are 5 total uncertain functions.",
|
|
29
|
+
"NormDist1": {
|
|
30
|
+
"formula": "PsiNormal(0,1)"
|
|
31
|
+
},
|
|
32
|
+
"NormDist2": {
|
|
33
|
+
"formula": "PsiNormal(0,1)"
|
|
34
|
+
},
|
|
35
|
+
"NormDist3": {
|
|
36
|
+
"formula": "PsiNormal(0,1)"
|
|
37
|
+
},
|
|
38
|
+
"NormDist4": {
|
|
39
|
+
"formula": "PsiNormal(0,1)"
|
|
40
|
+
},
|
|
41
|
+
"NormDist5": {
|
|
42
|
+
"formula": "PsiNormal(0,1)"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"data": {
|
|
46
|
+
"comment": "Use the 'data' section to organize constant parameters in the model: volatility parameter, number of days (NumDays), appreciation rate (AppRate) and the first closing price(FirstClose).",
|
|
47
|
+
"Volatility": {
|
|
48
|
+
"value": 0.09486,
|
|
49
|
+
"binding": "get",
|
|
50
|
+
"comment": "vol"
|
|
51
|
+
},
|
|
52
|
+
"NumDays": {
|
|
53
|
+
"value": 100,
|
|
54
|
+
"binding": "get",
|
|
55
|
+
"comment": "numdays"
|
|
56
|
+
},
|
|
57
|
+
"AppRate": {
|
|
58
|
+
"value": 0.0234992098,
|
|
59
|
+
"binding": "get",
|
|
60
|
+
"comment": "apprate"
|
|
61
|
+
},
|
|
62
|
+
"FirstClose": {
|
|
63
|
+
"value": 20.33,
|
|
64
|
+
"binding": "get",
|
|
65
|
+
"comment": "firstclose"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"formulas": {
|
|
69
|
+
"comment": "Use the 'formulas' section to calculate intermediary formulas. The results of which can be used to calculate constraints and the objective. Each of the DailyPrice formula calls the funDailyPrice box function to calculate the predicted daily stock price. ",
|
|
70
|
+
"DailyPrice1": {
|
|
71
|
+
"formula": "funDailyPrice(FirstClose,NormDist1)"
|
|
72
|
+
},
|
|
73
|
+
"DailyPrice2": {
|
|
74
|
+
"formula": "funDailyPrice(DailyPrice1,NormDist2)"
|
|
75
|
+
},
|
|
76
|
+
"DailyPrice3": {
|
|
77
|
+
"formula": "funDailyPrice(DailyPrice2,NormDist3)"
|
|
78
|
+
},
|
|
79
|
+
"DailyPrice4": {
|
|
80
|
+
"formula": "funDailyPrice(DailyPrice3,NormDist4)"
|
|
81
|
+
},
|
|
82
|
+
"DailyPrice5": {
|
|
83
|
+
"formula": "funDailyPrice(DailyPrice4,NormDist5)"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"uncertainFunctions": {
|
|
87
|
+
"comment": "All uncertain functions must be entered into the 'uncertainFunctions' section. ",
|
|
88
|
+
"ExpDailyPrice1": {
|
|
89
|
+
"comment": "This uncertain function calls the funDailyPrice box function to calculate the 1st day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
90
|
+
"formula": "funDailyPrice(FirstClose,NormDist1)",
|
|
91
|
+
"trials": [],
|
|
92
|
+
"mean": []
|
|
93
|
+
},
|
|
94
|
+
"ExpDailyPrice2": {
|
|
95
|
+
"comment": "This uncertain function calls the funDailyPrice box function to calculate the 2nd day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
96
|
+
"formula": "DailyPrice2",
|
|
97
|
+
"trials": [],
|
|
98
|
+
"mean": []
|
|
99
|
+
},
|
|
100
|
+
"ExpDailyPrice3": {
|
|
101
|
+
"comment": "This uncertain function calls the funDailyPrice box function to calculate the 3rd day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
102
|
+
"formula": "DailyPrice3",
|
|
103
|
+
"trials": [],
|
|
104
|
+
"mean": []
|
|
105
|
+
},
|
|
106
|
+
"ExpDailyPrice4": {
|
|
107
|
+
"comment": "This uncertain function calls the funDailyPrice box function to calculate the 4th day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
108
|
+
"formula": "DailyPrice4",
|
|
109
|
+
"trials": [],
|
|
110
|
+
"mean": []
|
|
111
|
+
},
|
|
112
|
+
"ExpDailyPrice5": {
|
|
113
|
+
"comment": "This uncertain function calls the funDailyPrice box function to calculate the 5th day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
114
|
+
"formula": "DailyPrice5",
|
|
115
|
+
"trials": [],
|
|
116
|
+
"mean": []
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "LambdaFunOptimize",
|
|
3
|
+
"modelDescription": "In this example, a LAMBDA Excel functon is used to create a custom, reusable function that can be called mulitiple times to calculate the distance between a proposed airline hub and 6 regional airports. Notice that the decision varaibles, constraints and the objective function have not changed from the original AirlineHub example under Examples - Optimization - Nonlinear.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"engineSettings": {
|
|
6
|
+
"comment": "Select the GRG nonlinear engine to solve the nonlinear model. Setting 'scaling' to -1 turns off scaling.",
|
|
7
|
+
"engine": "GRG Nonlinear",
|
|
8
|
+
"scaling": -1
|
|
9
|
+
},
|
|
10
|
+
"boxFunctions": {
|
|
11
|
+
"comment": "Use the 'boxFunctions' section to add either a box function or a lambda function to the RASON model. A LAMBDA function can be used to create custom, reusable functions which can be invoked in a RASON model, much like a box function.",
|
|
12
|
+
"DistanceFormula": {
|
|
13
|
+
"comment": "This custom LAMBDA function calculates the distance between two points. In this example, this function will be called to calculate the distance between the proposed hub and each of th 6 regional airports.",
|
|
14
|
+
"result": "LAMBDA(xone,xtwo,yone,ytwo,SQRT((xtwo-xone)^2+(ytwo-yone)^2))"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"variables": {
|
|
18
|
+
"comment": "The 'variables' section holds all the decision variables in the optimization model. There are three.",
|
|
19
|
+
"e13:f13": {
|
|
20
|
+
"comment": "The first two variables represent the x,y coordinates of the proposed airline hub.",
|
|
21
|
+
"value": 1,
|
|
22
|
+
"finalValue": []
|
|
23
|
+
},
|
|
24
|
+
"g20": {
|
|
25
|
+
"comment": "The third variable is an artificial variable that, when minimized in the objective, will have a squashing effect on the distance formula. In the final solution, this variable's value will equal the maximum constraint value.",
|
|
26
|
+
"value": 1,
|
|
27
|
+
"finalValue": []
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"data": {
|
|
31
|
+
"comment": "Use the 'data' section to organize constant data parameters.",
|
|
32
|
+
"e14": {
|
|
33
|
+
"comment": "The x coordinate of the 1st regional airport.",
|
|
34
|
+
"value": 6
|
|
35
|
+
},
|
|
36
|
+
"f14": {
|
|
37
|
+
"comment": "The x coordinate of the 1st regional airport.",
|
|
38
|
+
"value": 2
|
|
39
|
+
},
|
|
40
|
+
"e15": {
|
|
41
|
+
"comment": "The x coordinate of the 2nd regional airport.",
|
|
42
|
+
"value": 5
|
|
43
|
+
},
|
|
44
|
+
"f15": {
|
|
45
|
+
"comment": "The y coordinate of the 2nd regional airport.",
|
|
46
|
+
"value": 5
|
|
47
|
+
},
|
|
48
|
+
"e16": {
|
|
49
|
+
"comment": "The x coordinate of the 3rd regional airport.",
|
|
50
|
+
"value": 4
|
|
51
|
+
},
|
|
52
|
+
"f16": {
|
|
53
|
+
"comment": "The y coordinate of the 3rd regional airport.",
|
|
54
|
+
"value": 8
|
|
55
|
+
},
|
|
56
|
+
"e17": {
|
|
57
|
+
"comment": "The x coordinate of the 4th regional airport.",
|
|
58
|
+
"value": 3
|
|
59
|
+
},
|
|
60
|
+
"f17": {
|
|
61
|
+
"comment": "The y coordinate of the 4th regional airport.",
|
|
62
|
+
"value": 4
|
|
63
|
+
},
|
|
64
|
+
"e18": {
|
|
65
|
+
"comment": "The x coordinate of the 5th regional airport.",
|
|
66
|
+
"value": 3
|
|
67
|
+
},
|
|
68
|
+
"f18": {
|
|
69
|
+
"comment": "The y coordinate of the 5th regional airport.",
|
|
70
|
+
"value": 3
|
|
71
|
+
},
|
|
72
|
+
"e19": {
|
|
73
|
+
"comment": "The x coordinate of the 6th regional airport.",
|
|
74
|
+
"value": 1
|
|
75
|
+
},
|
|
76
|
+
"f19": {
|
|
77
|
+
"comment": "The y coordinate of the 6th regional airport.",
|
|
78
|
+
"value": 2
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"formulas": {
|
|
82
|
+
"comment": "Use the 'formulas' section to calcualte intermediary formulas which can then be used to calculate constraints or the objective.",
|
|
83
|
+
"g14": {
|
|
84
|
+
"comment": "The first constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 1st regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 1st regional airport in cells D14 and F14.",
|
|
85
|
+
"formula": "DistanceFormula($E$13,E14,$F$13,F14)"
|
|
86
|
+
},
|
|
87
|
+
"g15": {
|
|
88
|
+
"comment": "The second constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 2nd regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 2nd regional airport in cells D15 and F15.",
|
|
89
|
+
"formula": "DistanceFormula($E$13,E15,$F$13,F15)"
|
|
90
|
+
},
|
|
91
|
+
"g16": {
|
|
92
|
+
"comment": "The third constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 3rd regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 3rd regional airport in cells D16 and F16.",
|
|
93
|
+
"formula": "DistanceFormula($E$13,E16,$F$13,F16)"
|
|
94
|
+
},
|
|
95
|
+
"g17": {
|
|
96
|
+
"comment": "The fourth constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 4th regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 4th regional airport in cells D17 and F17.",
|
|
97
|
+
"formula": "DistanceFormula($E$13,E17,$F$13,F17)"
|
|
98
|
+
},
|
|
99
|
+
"g18": {
|
|
100
|
+
"comment": "The fifth constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 5th regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 5th regional airport in cells D18 and F18.",
|
|
101
|
+
"formula": "DistanceFormula($E$13,E18,$F$13,F18)"
|
|
102
|
+
},
|
|
103
|
+
"g19": {
|
|
104
|
+
"comment": "The sixth constraint calls the Lambda function, DistanceFormula, to calculate the distance between the proposed hub location and the 6th regional airport by passing the x and y coordiantes of the proposed hub (the decision variable values), E13 and F13, and the x and y coordinates of the 6th regional airport in cells D19 and F19.",
|
|
105
|
+
"formula": "DistanceFormula($E$13,E19,$F$13,F19)"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"constraints": {
|
|
109
|
+
"comment": "Sets the artificial variable, G20, to constraint the distance calculation for each regional airport. In the final solution, cell G20 will be equal to the maximum constraint value or MAX(G14, G15, G16, G17, G18, G19). ",
|
|
110
|
+
"airport1con": {
|
|
111
|
+
"formula": "g14 - g20",
|
|
112
|
+
"upper": 0
|
|
113
|
+
},
|
|
114
|
+
"airport2con": {
|
|
115
|
+
"formula": "g15 - g20",
|
|
116
|
+
"upper": 0
|
|
117
|
+
},
|
|
118
|
+
"airport3con": {
|
|
119
|
+
"formula": "g16 - g20",
|
|
120
|
+
"upper": 0
|
|
121
|
+
},
|
|
122
|
+
"airport4con": {
|
|
123
|
+
"formula": "g17 - g20",
|
|
124
|
+
"upper": 0
|
|
125
|
+
},
|
|
126
|
+
"airport5con": {
|
|
127
|
+
"formula": "g18 - g20",
|
|
128
|
+
"upper": 0
|
|
129
|
+
},
|
|
130
|
+
"airport6con": {
|
|
131
|
+
"formula": "g19 - g20",
|
|
132
|
+
"upper": 0
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"objective": {
|
|
136
|
+
"comment": "Minimizes the artifical variable, G20. This creates a squashing effect on the distance calculations. In the final solution, cell G20 will be equal to the maximum constraint value or MAX(G14, G15, G16, G17, G18, G19). ",
|
|
137
|
+
"objective": {
|
|
138
|
+
"formula": "g20",
|
|
139
|
+
"type": "min",
|
|
140
|
+
"finalValue": []
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comment": "Simulation Model with Lambda Function",
|
|
3
|
+
"modelName": "LambdaFunSimulate",
|
|
4
|
+
"modelDescription": "In this example, a LAMBDA Excel functon is used to create a custom, reusable function that can be called mulitiple times to calculate the predicted daily stock price. Notice that the decision varaibles, constraints and the objective function have not changed from the original GBM Simulation Model under Examples - Simulation.",
|
|
5
|
+
"modelType": "simulation",
|
|
6
|
+
"boxFunctions": {
|
|
7
|
+
"comment": "Use the 'boxFunctions' section to add either a box function or a lambda function to the RASON model. A LAMBDA function can be used to create custom, reusable functions which can be invoked in a RASON model, much like a box function.",
|
|
8
|
+
"PredDailyPrice": {
|
|
9
|
+
"comment": "In this example, the lambda function will be called to calculate the daily predicted stock price.",
|
|
10
|
+
"result": "LAMBDA(Volatility,NumofDays,NormDist,Appreciation,Previous,Previous*(Volatility*SQRT(1/NumofDays)*NormDist+ EXP((Appreciation-Volatility^2*0.5)*(1/NumofDays))))"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"uncertainVariables": {
|
|
14
|
+
"comment": "These are the uncertain variables in the model. There are 5 total uncertain functions.",
|
|
15
|
+
"NormDist1": {
|
|
16
|
+
"formula": "PsiNormal(0,1)"
|
|
17
|
+
},
|
|
18
|
+
"NormDist2": {
|
|
19
|
+
"formula": "PsiNormal(0,1)"
|
|
20
|
+
},
|
|
21
|
+
"NormDist3": {
|
|
22
|
+
"formula": "PsiNormal(0,1)"
|
|
23
|
+
},
|
|
24
|
+
"NormDist4": {
|
|
25
|
+
"formula": "PsiNormal(0,1)"
|
|
26
|
+
},
|
|
27
|
+
"NormDist5": {
|
|
28
|
+
"formula": "PsiNormal(0,1)"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"data": {
|
|
32
|
+
"comment": "Use the 'data' section to organize constant parameters in the model: volatility parameter, number of days (NumDays), appreciation rate (AppRate) and the first closing price(FirstClose).",
|
|
33
|
+
"FirstClose": {
|
|
34
|
+
"value": 20.33
|
|
35
|
+
},
|
|
36
|
+
"Volatility": {
|
|
37
|
+
"value": 0.09486,
|
|
38
|
+
"comment": "volatility"
|
|
39
|
+
},
|
|
40
|
+
"NumofDays": {
|
|
41
|
+
"value": 100,
|
|
42
|
+
"comment": "numofdays"
|
|
43
|
+
},
|
|
44
|
+
"Appreciation": {
|
|
45
|
+
"value": 0.0234992098,
|
|
46
|
+
"comment": "appreciation"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"uncertainFunctions": {
|
|
50
|
+
"comment": "All uncertain functions must be entered into the 'uncertainFunctions' section. ",
|
|
51
|
+
"DayOne": {
|
|
52
|
+
"comment": "This uncertain function calls the predDailyPrice lambda function to calculate the 1st day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
53
|
+
"formula": "PredDailyPrice(Volatility,NumofDays,NormDist1,Appreciation,FirstClose)",
|
|
54
|
+
"mean": [],
|
|
55
|
+
"trials": []
|
|
56
|
+
},
|
|
57
|
+
"DayTwo": {
|
|
58
|
+
"comment": "This uncertain function calls the predDailyPrice lambda function to calculate the 2nd day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
59
|
+
"formula": "PredDailyPrice(Volatility,NumofDays,NormDist2,Appreciation,DayOne)",
|
|
60
|
+
"mean": [],
|
|
61
|
+
"trials": []
|
|
62
|
+
},
|
|
63
|
+
"DayThree": {
|
|
64
|
+
"comment": "This uncertain function calls the predDailyPrice lambda function to calculate the 3rd day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
65
|
+
"formula": "PredDailyPrice(Volatility,NumofDays,NormDist3,Appreciation,DayTwo)",
|
|
66
|
+
"mean": [],
|
|
67
|
+
"trials": []
|
|
68
|
+
},
|
|
69
|
+
"DayFour": {
|
|
70
|
+
"comment": "This uncertain function calls the predDailyPrice lambda function to calculate the 4th day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
71
|
+
"formula": "PredDailyPrice(Volatility,NumofDays,NormDist4,Appreciation,DayThree)",
|
|
72
|
+
"mean": [],
|
|
73
|
+
"trials": []
|
|
74
|
+
},
|
|
75
|
+
"DayFive": {
|
|
76
|
+
"comment": "This uncertain function calls the predDailyPrice lambda function to calculate the 5th day's predicted daily stock price. All 1000 trial values and the mean of the function will be returned in the result.",
|
|
77
|
+
"formula": "PredDailyPrice(Volatility,NumofDays,NormDist5,Appreciation,DayFour)",
|
|
78
|
+
"mean": [],
|
|
79
|
+
"trials": []
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "RGFirehouseLocation",
|
|
3
|
+
"modelDescription": "RASON Conic Optimization Example: Example of solving a nonlinear Optimization Model with Cone Constraints. The goal of this example is to find a location, given by x and y coordinates, of a proposed firehouse that minimizes the maximum distance between the firehouse and six cities in the region.",
|
|
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
|
+
"variables": {
|
|
10
|
+
"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.",
|
|
11
|
+
"x": {
|
|
12
|
+
"comment": "The x coordinate of the proposed firehouse location.",
|
|
13
|
+
"value": 1.0,
|
|
14
|
+
"finalValue": []
|
|
15
|
+
},
|
|
16
|
+
"y": {
|
|
17
|
+
"comment": "The y coordinate of the proposed firehouse location.",
|
|
18
|
+
"value": 1.0,
|
|
19
|
+
"finalValue": []
|
|
20
|
+
},
|
|
21
|
+
"z": {
|
|
22
|
+
"comment": "The z variable that will be minimized in the objective function.",
|
|
23
|
+
"value": 1.0,
|
|
24
|
+
"finalValue": []
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"constraints": {
|
|
28
|
+
"comment": "The constraints calculate the distance between the proposed firehouse location and each of the six cities using the the Pythagorean Theorem (SQRT ((Xc – X )^2 + (Yc – Y) ^2)), which is a nonlinear function of the variables.",
|
|
29
|
+
"c1": {
|
|
30
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 1.",
|
|
31
|
+
"formula": "sqrt((x - 1)^2 + (y - 4)^2) - z",
|
|
32
|
+
"upper": 0
|
|
33
|
+
},
|
|
34
|
+
"c2": {
|
|
35
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 2.",
|
|
36
|
+
"formula": "sqrt((x - 0.5)^2 + (y - 3)^2) - z",
|
|
37
|
+
"upper": 0
|
|
38
|
+
},
|
|
39
|
+
"c3": {
|
|
40
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 3.",
|
|
41
|
+
"formula": "sqrt((x - 2)^2 + (y - 4)^2) - z",
|
|
42
|
+
"upper": 0
|
|
43
|
+
},
|
|
44
|
+
"c4": {
|
|
45
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 4.",
|
|
46
|
+
"formula": "sqrt((x - 2)^2 + (y - 2)^2) - z",
|
|
47
|
+
"upper": 0
|
|
48
|
+
},
|
|
49
|
+
"c5": {
|
|
50
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 5.",
|
|
51
|
+
"formula": "sqrt((x - 2)^2 + (y - 5)^2) - z",
|
|
52
|
+
"upper": 0
|
|
53
|
+
},
|
|
54
|
+
"c6": {
|
|
55
|
+
"comment": "Calculates the distance between the proposed firehouse location and city 6.",
|
|
56
|
+
"formula": "sqrt((x - 0.5)^2 + (y - 6)^2) - z",
|
|
57
|
+
"upper": 0
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"objective": {
|
|
61
|
+
"comment": "The objective function minimizes the z variable creating a squashing effect that pushes the distances between the proposed firehouse location and the distance between each city to be as small as possible.",
|
|
62
|
+
"obj": {
|
|
63
|
+
"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 objective function and the z variable will be equal.",
|
|
64
|
+
"formula": "z",
|
|
65
|
+
"type": "minimize",
|
|
66
|
+
"finalValue": []
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "RGFirehouseLocationConic",
|
|
3
|
+
"modelDescription": "RASON Conic Optimization Example: Example of solving a Conic Optimization Model. The goal of this example is the same for the RGFirehouseLocation example, to find a location, given by x and y coordinates, of a proposed firehouse that minimizes the maximum distance between the firehouse and six cities in the region. The difference between this example and the RGFirehouseLocation example is that this example replaces the 6 nonlinear constraints (calculating the distances betwen the proposed firehouse location and each city) with a 6 conic constraints. Since the model is now a conic optimization model, the SOCP Barrier engine can be used. ",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"engineSettings": {
|
|
6
|
+
"comment": "Since the model is now a conic optimization model, the SOCP Barrier engine can be used to solve the model. Note: In RASON, you can solve any type of model containing conic constraints. There is no need to select a specific engine within engineSettings. If the model is diagnosed as 'SOCP', then the model will be solved using an engine that supports conic constraints. Currently, the three engines that support conic constraints are: 'SOCP Barrier', 'Gurobi Solver' and 'Mosek Solver'.",
|
|
7
|
+
"engine": "SOCP Barrier"
|
|
8
|
+
},
|
|
9
|
+
"variables": {
|
|
10
|
+
"comment": "The variables for this conic formulation contains the three original variables: x and y, which will hold the final x,y coordinate values for the proposed firehouse and z, the variale to be minimized in the objective function. 18 new variables in the f, g and h arrays, are required for the 6 conic constraints. Each member of the f, g, and h variable blocks must (for example f[1], g[1], and h[1]) belong to a second order cone constraint which can be rewritten as f[1] > = SQRT (SUMSQ(g[1]; h[1])). ",
|
|
11
|
+
"x": {
|
|
12
|
+
"comment": "The x variable will hold the final x coordinate of the proposed firehouse.",
|
|
13
|
+
"value": 1.0,
|
|
14
|
+
"finalValue": []
|
|
15
|
+
},
|
|
16
|
+
"y": {
|
|
17
|
+
"comment": "The y variable will hold the final y coordinate of the proposed firehouse.",
|
|
18
|
+
"value": 1.0,
|
|
19
|
+
"finalValue": []
|
|
20
|
+
},
|
|
21
|
+
"z": {
|
|
22
|
+
"comment": "The z variable will be minimized in the objective.",
|
|
23
|
+
"value": 1.0,
|
|
24
|
+
"finalValue": []
|
|
25
|
+
},
|
|
26
|
+
"f": {
|
|
27
|
+
"comment": "The f block of variables will be forced by the dx block of constraints to equal the distance between the x coordinate of the proposed firehouse and the x coordinate of each city.",
|
|
28
|
+
"dimensions": [ 6 ],
|
|
29
|
+
"value": 1.0,
|
|
30
|
+
"finalValue": []
|
|
31
|
+
},
|
|
32
|
+
"g": {
|
|
33
|
+
"comment": "The g block of variables will be forced by the dy block of constraints to equal the distance between the y coordinate of the proposed firehouse and the y coordinate of each city.",
|
|
34
|
+
"dimensions": [ 6 ],
|
|
35
|
+
"value": 1.0
|
|
36
|
+
},
|
|
37
|
+
"h": {
|
|
38
|
+
"comment": "The h block of variables will be driven by the dz block of constraints to be less than or equal to z, the variable to be minimized in the objective function.",
|
|
39
|
+
"dimensions": [ 6 ],
|
|
40
|
+
"value": 1.0
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"data": {
|
|
44
|
+
"comment": "The x and y coordinates of each of the 6 cities to be served by the firehouse are given in the corx and cory arrays, respectively. In the RGFirehouseLocation example, these coordinates were supplied in the constraint formulas.",
|
|
45
|
+
"corx": {
|
|
46
|
+
"comment": "x coordinates of the each of the 6 cities.",
|
|
47
|
+
"dimensions": [ 6 ],
|
|
48
|
+
"value": [ 1, 0.5, 2, 2, 2, 0.5 ]
|
|
49
|
+
},
|
|
50
|
+
"cory": {
|
|
51
|
+
"comment": "y coordinates of the each of the 6 cities.",
|
|
52
|
+
"dimensions": [ 6 ],
|
|
53
|
+
"value": [ 4, 3, 4, 2, 5, 6 ]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"constraints": {
|
|
57
|
+
"dx": {
|
|
58
|
+
"comment": "This constraint calculates the differences between the X coordinates of the hub and each city set equal to the new variables in the g block.",
|
|
59
|
+
"dimensions": [ 6 ],
|
|
60
|
+
"formula": "corx - x - g",
|
|
61
|
+
"equal": 0
|
|
62
|
+
},
|
|
63
|
+
"dy": {
|
|
64
|
+
"comment": "This constraint calculates the differences between the Y coordinates of the hub and each city set equal to the new variables in the h block.",
|
|
65
|
+
"dimensions": [ 6 ],
|
|
66
|
+
"formula": "cory - y - h",
|
|
67
|
+
"equal": 0
|
|
68
|
+
},
|
|
69
|
+
"dz": {
|
|
70
|
+
"comment": "The effect of this constraint, coupled with the minimization of the Z variable, results in the Z variable being set equal to the maximum value in the F variable block, in the final solution.",
|
|
71
|
+
"dimensions": [ 6 ],
|
|
72
|
+
"formula": "f - z",
|
|
73
|
+
"upper": 0
|
|
74
|
+
},
|
|
75
|
+
"cone1": {
|
|
76
|
+
"comment": "Each set of the f, g, and h variables must belong to a second order cone constraint which can be rewritten as F >= SQRT(SUMSQ(G,H)), in this constraint specifically: F[1] >= SQRT(SUMSQ(G[1],H[1])). These 6 conic constraints replace the nonlinear distance calculation in the previous RGFirehouseLocation example.",
|
|
77
|
+
"value": "f[1], g[1], h[1]",
|
|
78
|
+
"type": "cone"
|
|
79
|
+
},
|
|
80
|
+
"cone2": {
|
|
81
|
+
"comment": "F[2] >= SQRT(SUMSQ(G[2],H[2]))",
|
|
82
|
+
"value": "f[2], g[2], h[2]",
|
|
83
|
+
"type": "cone"
|
|
84
|
+
},
|
|
85
|
+
"cone3": {
|
|
86
|
+
"comment": "F[3] >= SQRT(SUMSQ(G[3],H[3]))",
|
|
87
|
+
"value": "f[3], g[3], h[3]",
|
|
88
|
+
"type": "cone"
|
|
89
|
+
},
|
|
90
|
+
"cone4": {
|
|
91
|
+
"comment": "F[4] >= SQRT(SUMSQ(G[4],H[4]))",
|
|
92
|
+
"value": "f[4], g[4], h[4]",
|
|
93
|
+
"type": "cone"
|
|
94
|
+
},
|
|
95
|
+
"cone5": {
|
|
96
|
+
"comment": "F[5] >= SQRT(SUMSQ(G[5],H[5]))",
|
|
97
|
+
"value": "f[5], g[5], h[5]",
|
|
98
|
+
"type": "cone"
|
|
99
|
+
},
|
|
100
|
+
"cone6": {
|
|
101
|
+
"comment": "F[6] >= SQRT(SUMSQ(G[6],H[6]))",
|
|
102
|
+
"value": "f[6], g[6], h[6]",
|
|
103
|
+
"type": "cone"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"objective": {
|
|
107
|
+
"obj": {
|
|
108
|
+
"comment": "Minimizing the z variable in the objective function will push the maximum distance between the proposed firehouse location and each city to the lowest possible value guaranteeing that the firehouse is as close as possible to each of the six cities. ",
|
|
109
|
+
"formula": "z",
|
|
110
|
+
"type": "minimize",
|
|
111
|
+
"finalValue": []
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "RGProductMixCsv1",
|
|
3
|
+
"modelDescription": "RASON Conic Optimization Example: Illustrates binding to a CSV File. In this example, initial variable values are first imported from the CSV file ResultVarsInit.txt and, after the model is solved, the final variable values are saved back to that same CSV file. The final constraint values are saved to ResultFcns.txt and the final objective value is saved to ResultObj.txt. Both ResultFcns.txt and ResultObj.txt will be created once the model is solved. (Click Download RASON Examples icon to download all source files. To attach the files to the example, click Choose Files, navigate to the location of the saved files, select ProductMixParts.txt, ProductMixInventory.txt, ProductMixProfits.txt and ResultVarsInit.txt and click Open. Then POST the model by clicking the POST icon, then solve the model by clicking the down arrow next to the Play icon and selecting Solve.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"datasources": {
|
|
6
|
+
"comment": "Imports data from outside datasources.",
|
|
7
|
+
"parts_data": {
|
|
8
|
+
"comment": "Imports the parts data.",
|
|
9
|
+
"type": "csv",
|
|
10
|
+
"connection": "ProductMixParts.txt",
|
|
11
|
+
"indexCols": [ "parts", "prods" ],
|
|
12
|
+
"valueCols": [ "qty" ],
|
|
13
|
+
"direction": "import"
|
|
14
|
+
},
|
|
15
|
+
"invent_data": {
|
|
16
|
+
"comment": "Imports the inventory data.",
|
|
17
|
+
"type": "csv",
|
|
18
|
+
"connection": "ProductMixInventory.txt",
|
|
19
|
+
"indexCols": [ "parts" ],
|
|
20
|
+
"valueCols": [ "inventory" ],
|
|
21
|
+
"direction": "import"
|
|
22
|
+
},
|
|
23
|
+
"profit_data": {
|
|
24
|
+
"comment": "Imports the profit per unit data.",
|
|
25
|
+
"type": "csv",
|
|
26
|
+
"connection": "ProductMixProfits.txt",
|
|
27
|
+
"indexCols": [ "prods" ],
|
|
28
|
+
"valueCols": [ "profits" ],
|
|
29
|
+
"direction": "import"
|
|
30
|
+
},
|
|
31
|
+
"vars_data": {
|
|
32
|
+
"comment": "The vars_data data source performs a dual function by first importing the decision variable initial values from the CSV file ResultVarsInit.txt 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 ('csv') while the second property, connection, specifies the file name within quotes ('ResultVarsInit.txt'). The third and fourth properties (indexCols and valueCols) are required for importing the initial variable values. The third property, indexCols specifies the dimension(s) (or column(s)) to be imported and the fourth property, valueCols, specifies the values to be imported. Within variables, a block of decision variables x is bound to the vars_data data source using the binding property. Since only one output property is passed within the x definition, finalValue:[], a single column containing the final values of the decision variables will be appended to ResultVarsInit.txt. The last property, direction: 'import/export', stipulates that the contents of the file will be 'imported' (for initial variable values) and then the final variable values will be 'exported', hence the setting '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": "The fcns_data datasource exports the final constraint values to the TXT file, ResultFcns.txt. The first property, type, specifies the type of file where the data is being imported/exported. In this example, the file is a CSV file. The second property, connection, specifies the file name within quotes ('ResultFcns.txt') while the third property assigns the direction of the file as 'export'. The binding property within the c constraint definition binds the constraint block to the fcns_data data source. The user must specify which results he/she would like exported. In this example, only one output property is passed, finalValue:[]. 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 on the Help tab.",
|
|
41
|
+
"type": "csv",
|
|
42
|
+
"connection": "ResultFcns.txt",
|
|
43
|
+
"direction": "export"
|
|
44
|
+
},
|
|
45
|
+
"obj_data": {
|
|
46
|
+
"comment": "The obj_data datasource exports the final objective value to the TXT file, ResultObj.txt. The first property, type, specifies the file type ('CSV') while the second property, connection, specifies the file name ('ResultObj.txt')and the third, direction, specifies that the file will be exported. Within objective, the total objective function is bound to the obj_data data source. The only output property passed within the objective definition is finalValue:[]. As a result, only the final objective function value will be exported to ResultObj.txt. For a complete list of results that may be written to a writeable data source, see the objective section discussion in the RASON Reference Guide.",
|
|
47
|
+
"type": "csv",
|
|
48
|
+
"connection": "ResultObj.txt",
|
|
49
|
+
"direction": "export"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"data": {
|
|
53
|
+
"comment": "Binds the datasources to data component.",
|
|
54
|
+
"parts2": {
|
|
55
|
+
"comment": "Binds the values in the qty column in the parts_data datasource to parts2 data component.",
|
|
56
|
+
"binding": "parts_data",
|
|
57
|
+
"valueCol": "qty"
|
|
58
|
+
},
|
|
59
|
+
"invent": {
|
|
60
|
+
"comment": "Binds the values in the inventory column in the invent_data datasource to invent data component.",
|
|
61
|
+
"binding": "invent_data",
|
|
62
|
+
"valueCol": "inventory"
|
|
63
|
+
},
|
|
64
|
+
"profit": {
|
|
65
|
+
"comment": "Binds the values in the profits column in the profit_data datasource to profit data component.",
|
|
66
|
+
"binding": "profit_data",
|
|
67
|
+
"valueCol": "profits"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"formulas": {
|
|
71
|
+
"comment": "Use this section to calculate intermediate formulas to be used within the constraints and objective sections.",
|
|
72
|
+
"piv_parts": {
|
|
73
|
+
"comment": "Calculates the amount of parts used to produce all three products.",
|
|
74
|
+
"formula": "PIVOT(parts2, { 'prods' }, { 'parts' })"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"variables": {
|
|
78
|
+
"comment": "Decision Variables",
|
|
79
|
+
"x": {
|
|
80
|
+
"comment": "The amount of products to produce, x[1] = TVs, x[2] = Stereos, x[3] = Speakers",
|
|
81
|
+
"binding": "vars_data",
|
|
82
|
+
"valueCol": "initials",
|
|
83
|
+
"lower": 0,
|
|
84
|
+
"finalValue": []
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"constraints": {
|
|
88
|
+
"comment": "Constraints",
|
|
89
|
+
"c": {
|
|
90
|
+
"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.",
|
|
91
|
+
"dimensions": [ "parts" ],
|
|
92
|
+
"binding": "fcns_data",
|
|
93
|
+
"formula": "MMULT(piv_parts, x)",
|
|
94
|
+
"upper": "invent",
|
|
95
|
+
"finalValue": []
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"objective": {
|
|
99
|
+
"comment": "objective function",
|
|
100
|
+
"total": {
|
|
101
|
+
"comment": "Calculates the profit by multiplying the profit per unit of each product by the final variable values.",
|
|
102
|
+
"binding": "obj_data",
|
|
103
|
+
"formula": "sumproduct(x, profit)",
|
|
104
|
+
"type": "maximize",
|
|
105
|
+
"finalValue": []
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|