@frontlinesystems/rason-mcp-server 2026.5.1 → 2026.5.3
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 -35
- package/examples/EXAMPLES_REFERENCE.md +128 -128
- package/examples/{optimization → Optimization}/Conic/AirlineHubConic.json +111 -111
- package/examples/{optimization → Optimization}/Conic/AirlineHubConic2.json +108 -108
- package/examples/{optimization → Optimization}/Conic/AirlineHubConic3.json +111 -111
- package/examples/{optimization → Optimization}/Conic/AirlineHubConic4.json +99 -99
- package/examples/{optimization → Optimization}/Conic/AirlineHubConic5.json +101 -101
- package/examples/{optimization → Optimization}/DataBinding/ProductMixCsv.json +81 -81
- package/examples/{optimization → Optimization}/DataBinding/ProductMixCsv4.json +96 -96
- package/examples/{optimization → Optimization}/DataBinding/ProductMixExcel.json +73 -73
- package/examples/{optimization → Optimization}/DataBinding/ProductMixExcel1.json +86 -86
- package/examples/{optimization → Optimization}/DataBinding/ProductMixExcel11.json +108 -108
- package/examples/{optimization → Optimization}/DataBinding/ProductMixExcel2.json +77 -77
- package/examples/{optimization → Optimization}/DataBinding/ProductMixTab.json +89 -89
- package/examples/{optimization → Optimization}/DataBinding/ProductMixTab1.json +73 -73
- package/examples/{optimization → Optimization}/DataBinding/ProductMixTab2.json +77 -77
- package/examples/{optimization → Optimization}/Linear/Inventory.json +199 -199
- package/examples/{optimization → Optimization}/Linear/Matop.json +119 -119
- package/examples/{optimization → Optimization}/Linear/ProductMix.json +97 -97
- package/examples/{optimization → Optimization}/Linear/ProductMix2.json +72 -72
- package/examples/{optimization → Optimization}/Linear/ProductMix3.json +49 -49
- package/examples/{optimization → Optimization}/Linear/ProductMix4.json +56 -56
- package/examples/{optimization → Optimization}/Linear/ProductMixCsv1.json +106 -106
- package/examples/{optimization → Optimization}/Linear/ProductMixCsv2.json +106 -106
- package/examples/{optimization → Optimization}/Linear/ProductMixSQL11.json +82 -82
- package/examples/{optimization → Optimization}/Linear/Rowop.json +126 -126
- package/examples/{optimization → Optimization}/NonLinear/AirlineHub.json +63 -63
- package/examples/{optimization → Optimization}/NonLinear/AirlineHub2.json +47 -47
- package/examples/{optimization → Optimization}/NonLinear/AirlineHub3.json +47 -47
- package/examples/{optimization → Optimization}/NonSmooth/Inventory2.json +159 -159
- package/examples/{optimization → Optimization}/Quadratic/PortfolioOpt.json +55 -55
- package/examples/{optimization → Optimization}/Quadratic/PortfolioOpt2.json +65 -65
- package/examples/{optimization → Optimization}/WithUncertainty/GasCompanyChance.json +78 -78
- package/examples/{optimization → Optimization}/WithUncertainty/GasCompanyRecourse.json +78 -78
- package/examples/{optimization → Optimization}/WithUncertainty/ProjectSelect.json +77 -77
- package/examples/{optimization → Optimization}/WithUncertainty/ProjectSelect2.json +81 -81
- package/examples/{optimization → Optimization}/WithUncertainty/ProjectSelect3.json +84 -84
- package/examples/{optimization → Optimization}/WithUncertainty/ProjectSelect4.json +74 -74
- package/examples/{simulation → Simulation}/CandyStoreSalesUsingSIP.json +147 -147
- package/examples/{simulation → Simulation}/CollegeFundGrowth1.json +423 -423
- package/examples/{simulation → Simulation}/CollegeFundGrowth1SIPModel.json +27 -27
- package/examples/{simulation → Simulation}/CollegeFundGrowth2.json +415 -415
- package/examples/{simulation → Simulation}/CollegeFundGrowthSIP.json +401 -401
- package/examples/{simulation → Simulation}/GBMSimulationModel.json +236 -236
- package/examples/{simulation → Simulation}/YieldManagement(Sim).json +69 -69
- package/examples/{simulation → Simulation}/YieldManagement2(Sim).json +72 -72
- package/examples/calculation/DMNExamples/DMN Box Fun with typeDef result.json +53 -53
- package/examples/calculation/DMNExamples/DMN Context example.json +69 -69
- package/examples/calculation/DMNExamples/DMN DT with typeDef result.json +43 -43
- package/examples/calculation/DMNExamples/FEEL Date Time example.json +28 -28
- package/examples/calculation/DMNExamples/FEEL For iteration example.json +66 -66
- package/examples/calculation/DMNExamples/FEEL For with two indices.json +15 -15
- package/examples/calculation/DMNExamples/FEEL For with typeDef result.json +88 -88
- package/examples/calculation/DMNExamples/FEEL If Then Else example.json +25 -25
- package/examples/calculation/DMNExamples/FEEL List example.json +37 -37
- package/examples/calculation/DMNExamples/FEEL List operator.json +17 -17
- package/examples/calculation/DMNExamples/FEEL List with typeDef collection.json +36 -36
- package/examples/calculation/DMNExamples/FEEL Some or Every example.json +65 -65
- package/examples/calculation/DecisionTables/DT Datasource example.json +52 -52
- package/examples/calculation/DecisionTables/DT Date and Time examples.json +91 -91
- package/examples/calculation/DecisionTables/DT Expression example.json +32 -32
- package/examples/calculation/DecisionTables/DT Hit Policy examples.json +136 -136
- package/examples/calculation/DecisionTables/DT Loan Recommend model.json +81 -81
- package/examples/calculation/DecisionTables/DT Loan Strategy Model and Predictive CSV-XML.json +218 -218
- package/examples/calculation/DecisionTables/DT Loan Strategy model and Datasource.json +286 -286
- package/examples/calculation/DecisionTables/DT Loan Strategy model and Predictive.json +203 -203
- package/examples/calculation/DecisionTables/DT Loan Strategy model by scratch.json +214 -214
- package/examples/calculation/DecisionTables/DT Output Order example.json +39 -39
- package/examples/calculation/DecisionTables/DT Unique example.json +38 -38
- package/examples/calculation/TypeDefinitions/TypeDefCF.json +64 -64
- package/examples/calculation/TypeDefinitions/TypeDefDT.json +57 -57
- package/examples/datamining/AffinityAnalysis/AssociationRules.json +51 -51
- package/examples/datamining/Classification/DecisionTree.json +90 -90
- package/examples/datamining/Classification/DiscriminantAnalysis.json +81 -81
- package/examples/datamining/Classification/Ensembles/Bagging.json +66 -66
- package/examples/datamining/Classification/Ensembles/Boosting.json +67 -67
- package/examples/datamining/Classification/Ensembles/RandomTrees.json +91 -91
- package/examples/datamining/Classification/FindBestModel.json +86 -86
- package/examples/datamining/Classification/LogisticRegression.json +82 -82
- package/examples/datamining/Classification/NaiveBayes.json +78 -78
- package/examples/datamining/Classification/NearestNeighbors.json +84 -84
- package/examples/datamining/Classification/NeuralNetwork.json +92 -92
- package/examples/datamining/Clustering/Hierarchical.json +54 -54
- package/examples/datamining/Clustering/KMeans.json +71 -71
- package/examples/datamining/DataSources/DelimitedFile.json +49 -49
- package/examples/datamining/DataSources/JSONFile.json +49 -49
- package/examples/datamining/DataSources/MSAccessDatabase.json +49 -49
- package/examples/datamining/DataSources/MSExcelTable.json +50 -50
- package/examples/datamining/DataSources/MSSQLDatabase.json +49 -49
- package/examples/datamining/DataSources/ODATATable.json +49 -49
- package/examples/datamining/DataSources/ODBCDatabase.json +49 -49
- package/examples/datamining/FeatureSelection/LinearWrapping.json +53 -53
- package/examples/datamining/FeatureSelection/LogisticWrapping.json +56 -56
- package/examples/datamining/FeatureSelection/Univariate.json +78 -78
- package/examples/datamining/Regression/DecisionTree.json +82 -82
- package/examples/datamining/Regression/Ensembles/Bagging.json +62 -62
- package/examples/datamining/Regression/Ensembles/Boosting.json +62 -62
- package/examples/datamining/Regression/Ensembles/RandomTrees.json +78 -78
- package/examples/datamining/Regression/FindBestModel.json +86 -86
- package/examples/datamining/Regression/LinearRegression.json +124 -124
- package/examples/datamining/Regression/NearestNeighbors.json +77 -77
- package/examples/datamining/Regression/NeuralNetwork.json +82 -82
- package/examples/datamining/Scoring/JSONClassifier.json +62 -62
- package/examples/datamining/Scoring/JSONClassifierNN.json +62 -62
- package/examples/datamining/Scoring/JSONClusterizer.json +37 -37
- package/examples/datamining/Scoring/JSONForecaster.json +49 -49
- package/examples/datamining/Scoring/JSONLinearRegression.json +56 -56
- package/examples/datamining/Scoring/JSONPCA.json +41 -41
- package/examples/datamining/Scoring/JSONRegressor.json +56 -56
- package/examples/datamining/Scoring/JSONTransformer.json +38 -38
- package/examples/datamining/Scoring/PMMLClassifier.json +42 -42
- package/examples/datamining/Scoring/PMMLForecaster.json +43 -43
- package/examples/datamining/Scoring/PMMLRegressor.json +38 -38
- package/examples/datamining/Scoring/PMMLTransformer.json +38 -38
- package/examples/datamining/Simulation/LinearRegressionSimulation.json +117 -117
- package/examples/datamining/Simulation/SyntheticDataGeneration.json +108 -108
- package/examples/datamining/Simulation/pmml-risk-scoring.json +62 -62
- package/examples/datamining/Summarizer/Summarization.json +54 -54
- package/examples/datamining/TextMining/LatentSemanticAnalysis.json +51 -51
- package/examples/datamining/TextMining/TfIdf-FileData.json +65 -65
- package/examples/datamining/TextMining/TfIdf-InlineData.json +55 -55
- package/examples/datamining/TimeSeries/AddHoltWinters.json +79 -79
- package/examples/datamining/TimeSeries/Arima.json +74 -74
- package/examples/datamining/TimeSeries/DoubleExponential.json +65 -65
- package/examples/datamining/TimeSeries/Exponential.json +64 -64
- package/examples/datamining/TimeSeries/LagAnalysis.json +48 -48
- package/examples/datamining/TimeSeries/MovingAverage.json +65 -65
- package/examples/datamining/TimeSeries/MulHoltWinters.json +65 -65
- package/examples/datamining/TimeSeries/NoTrendHoltWinters.json +65 -65
- package/examples/datamining/Transformation/Binning.json +69 -69
- package/examples/datamining/Transformation/CanonicalVariateAnalysis.json +47 -47
- package/examples/datamining/Transformation/CategoryReduction.json +51 -51
- package/examples/datamining/Transformation/Factorization.json +50 -50
- package/examples/datamining/Transformation/MissingDataHandling.json +83 -83
- package/examples/datamining/Transformation/OneHotEncoding-DataInline.json +54 -54
- package/examples/datamining/Transformation/OneHotEncoding-DatainFile.json +48 -48
- package/examples/datamining/Transformation/PartitionTimeSeries.json +48 -48
- package/examples/datamining/Transformation/Partitioning-DF.json +72 -72
- package/examples/datamining/Transformation/Partitioning.json +46 -46
- package/examples/datamining/Transformation/PartitioningWithOversampling-DF.json +65 -65
- package/examples/datamining/Transformation/PartitioningWithOversampling.json +44 -44
- package/examples/datamining/Transformation/PrincipalComponentsAnalysis.json +52 -52
- package/examples/datamining/Transformation/Rescaling.json +67 -67
- package/examples/datamining/Transformation/Sampling.json +43 -43
- package/examples/datamining/Transformation/StratifiedSampling.json +46 -46
- package/examples/flow/SQLServerTransform.json +260 -260
- package/examples/flow/dm-calc-pipeline.json +277 -277
- package/examples/flow/dm-pipeline-simulation.json +113 -113
- package/examples/flow/opt-sim-pipeline.json +159 -159
- package/examples/flow/sim-dm-pipeline.json +106 -106
- package/examples/flow/sim-sim-pipeline.json +136 -136
- package/examples/index.json +4678 -4678
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/DataFiltering/ListwithFilter.json +52 -52
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/ProductMix5.json +57 -57
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/compoundWhileStatement.json +35 -35
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/ifThenElseStatement.json +33 -33
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/nestedLoop.json +25 -25
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/ParallelArray.json +47 -47
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/indexedArray.json +69 -69
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/nonParallelArray.json +49 -49
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/sumAggregateExample.json +337 -337
- package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/tsp.json +61 -61
- package/examples/rason-features/BoxIterators/Box_Fun_Loop_Iter_Sim_RASON.json +190 -190
- package/examples/rason-features/BoxIterators/Box_Fun_Loop_Sim_RASON.json +75 -75
- package/examples/rason-features/BoxIterators/Box_Fun_Sim_RASON.json +108 -108
- package/examples/rason-features/BoxIterators/Box_Iter_SIM_RASON.json +68 -68
- package/examples/rason-features/BoxIterators/Box_Iterator_Calc_Loop.json +183 -183
- package/examples/rason-features/BoxIterators/Box_Iterator_with_typeDef_partial.json +79 -79
- package/examples/rason-features/BoxLambdaExamples/BoxFunOptimize.json +154 -154
- package/examples/rason-features/BoxLambdaExamples/BoxFunSimulate.json +118 -118
- package/examples/rason-features/BoxLambdaExamples/LambdaFunOptimize.json +142 -142
- package/examples/rason-features/BoxLambdaExamples/LambdaFunSimulate.json +81 -81
- package/examples/rason-features/ReferenceGuide/RGFirehouseLocation.json +69 -69
- package/examples/rason-features/ReferenceGuide/RGFirehouseLocationConic.json +113 -113
- package/examples/rason-features/ReferenceGuide/RGProductMixCsv1.json +107 -107
- package/examples/rason-features/ReferenceGuide/RGProductMixExcel11.json +117 -117
- package/examples/rason-features/ReferenceGuide/RGProductMixSQL11.json +108 -108
- package/examples/rason-features/UserGuide/UGAirlineHubCSV.json +67 -67
- package/examples/rason-features/UserGuide/UGForecast.json +50 -50
- package/examples/rason-features/UserGuide/UGProductMix1.json +48 -48
- package/examples/rason-features/UserGuide/UGProductMix2.json +48 -48
- package/examples/rason-features/UserGuide/UGProductMixTab1.json +67 -67
- package/examples/rason-features/UserGuide/UGProductMixTab2.json +76 -76
- package/examples/rason-features/UserGuide/UGProductMixTab3.json +66 -66
- package/examples/rason-features/UserGuide/UGProductMixTab4.json +70 -70
- package/examples/rason-features/UserGuide/UGProductMixTab5.json +67 -67
- package/examples/rason-features/UserGuide/UGProjectSelect0.json +91 -91
- package/examples/rason-features/UserGuide/UGProjectSelect1.json +74 -74
- package/examples/rason-features/UserGuide/UGProjectSelect2.json +74 -74
- package/examples/rason-features/UserGuide/UGYieldManagement1.json +61 -61
- package/examples/rason-features/UserGuide/UGYieldManagement2.json +61 -61
- package/examples/rason-features/UserGuide/UGYieldManagement3.json +63 -63
- package/out/index.cjs +1 -1
- package/package.json +3 -2
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
{
|
|
2
|
-
"modelName": "Inventory2Example",
|
|
3
|
-
"modelDescription": "Inventory2 Nonsmooth RASON Optimization Example: This example uses the same model as used in the Inventory example (under Examples -- Optimization -- Linear Optimizations) without the use of automatic transformation. Recall that this example minimizes the inventory ordering and holding costs while ensuring there is enough inventory on hand to meet demand over a number of time periods, as well as with maintaining minimum inventory levels for each product. As a result the nonsmooth engine, the Optquest Engine, will be used to solve the model. Note that nonsmooth models are much harder to solve and typically result in a slower solve time. Set transformationNonSmooth to True, below, to automatically transform the model into a linear model with a faster solve time.",
|
|
4
|
-
"modelType": "optimization",
|
|
5
|
-
"modelSettings": {
|
|
6
|
-
"comment": "Set transformationNonSmooth to True to automatically transform the model into a linear model with a faster solve time.",
|
|
7
|
-
"transformNonSmooth": false
|
|
8
|
-
},
|
|
9
|
-
"variables": {
|
|
10
|
-
"comment": "In the original model, Inventory.json, all 9 variables were created separately. In this example, three variable blocks are created, x, y and z, representing the amount of product to be purchased in each time period. Note that each variable is specified to be an integer with an upper bound of 500 and a lower bound of 0. Since the keyword finalValue is present, all variable final values will be returned in the result. ",
|
|
11
|
-
"x": {
|
|
12
|
-
"comment": "xi = the amount of product 1 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
13
|
-
"dimensions": [ 3 ],
|
|
14
|
-
"type": "int",
|
|
15
|
-
"upper": 500,
|
|
16
|
-
"lower": 0,
|
|
17
|
-
"finalValue": []
|
|
18
|
-
},
|
|
19
|
-
"y": {
|
|
20
|
-
"comment": "yi = the amount of product 2 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
21
|
-
"dimensions": [ 3 ],
|
|
22
|
-
"type": "int",
|
|
23
|
-
"upper": 500,
|
|
24
|
-
"lower": [ 0, 0, 0 ],
|
|
25
|
-
"finalValue": []
|
|
26
|
-
},
|
|
27
|
-
"z": {
|
|
28
|
-
"comment": "zi = the amount of product 3 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
29
|
-
"dimensions": [ 3 ],
|
|
30
|
-
"type": "int",
|
|
31
|
-
"upper": 500,
|
|
32
|
-
"lower": 0,
|
|
33
|
-
"finalValue": []
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"formulas": {
|
|
37
|
-
"comment": "Formulas calculating Inventory for each product in each time period. Initial Inventory for all products in period 1 is 0. Calculate inventory using the following formula: Initial inventory + production in period 1 - demand in period 1 + production in period 2 - demand in period 2 + production in period 3 - demand in period 3.",
|
|
38
|
-
"ix1": {
|
|
39
|
-
"comment": "Inventory for product 1 after period 1. 0 = no demand for product 1 in period 1.",
|
|
40
|
-
"formula": "x[1]-0"
|
|
41
|
-
},
|
|
42
|
-
"iy1": {
|
|
43
|
-
"comment": "Inventory for product 2 after period 1. 50 = demand for product 2 in period 1.",
|
|
44
|
-
"formula": "y[1] - 50"
|
|
45
|
-
},
|
|
46
|
-
"iz1": {
|
|
47
|
-
"comment": "Inventory for product 3 after period 1. 0 = no demand for product 3 in period 1.",
|
|
48
|
-
"formula": "z[1] - 0"
|
|
49
|
-
},
|
|
50
|
-
"ix2": {
|
|
51
|
-
"comment": "Inventory for product 1 after period 2. 20 = demand for product 1 in period 2.",
|
|
52
|
-
"formula": "ix1 + x[2] - 20"
|
|
53
|
-
},
|
|
54
|
-
"iy2": {
|
|
55
|
-
"comment": "Inventory for product 2 after period 2. 0 = no demand for product 1 in period 2.",
|
|
56
|
-
"formula": "iy1 + y[2] - 0"
|
|
57
|
-
},
|
|
58
|
-
"iz2": {
|
|
59
|
-
"comment": "Inventory for product 3 after period 2. 100 = demand for product 1 in period 2.",
|
|
60
|
-
"formula": "iz1 + z[2] - 100"
|
|
61
|
-
},
|
|
62
|
-
"ix3": {
|
|
63
|
-
"comment": "Inventory for product 1 after period 3. 0 = no demand for product 1 in period 3.",
|
|
64
|
-
"formula": "ix2 + x[3] - 0"
|
|
65
|
-
},
|
|
66
|
-
"iy3": {
|
|
67
|
-
"comment": "Inventory for product 2 after period 3. 50 = demand for product 1 in period 3.",
|
|
68
|
-
"formula": "iy2 + y[3] - 50"
|
|
69
|
-
},
|
|
70
|
-
"iz3": {
|
|
71
|
-
"comment": "Inventory for product 3 after period 3. 0 = no demand for product 1 in period 3.",
|
|
72
|
-
"formula": "iz2 + z[3] - 0"
|
|
73
|
-
},
|
|
74
|
-
"px": {
|
|
75
|
-
"comment": "If x1, x2 or x3 are nonzero, px[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
76
|
-
"dimensions": [ 3 ],
|
|
77
|
-
"formula": "if(x > 0, 1, 0)"
|
|
78
|
-
},
|
|
79
|
-
"py": {
|
|
80
|
-
"comment": "If y1, y2 or y3 are nonzero, py[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
81
|
-
"dimensions": [ 3 ],
|
|
82
|
-
"formula": "if(y > 0, 1, 0)"
|
|
83
|
-
},
|
|
84
|
-
"pz": {
|
|
85
|
-
"comment": "If z1, z2 or z3 are nonzero, pz[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
86
|
-
"dimensions": [ 3 ],
|
|
87
|
-
"formula": "if(z > 0, 1, 0)"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"constraints": {
|
|
91
|
-
"c1": {
|
|
92
|
-
"comment": "Ending inventory for product 1 in period 1.",
|
|
93
|
-
"formula": "ix1",
|
|
94
|
-
"lower": 0,
|
|
95
|
-
"finalValue": []
|
|
96
|
-
},
|
|
97
|
-
"c2": {
|
|
98
|
-
"comment": "Ending inventory for product 2 in period 1.",
|
|
99
|
-
"formula": "iy1",
|
|
100
|
-
"lower": 0,
|
|
101
|
-
"finalValue": []
|
|
102
|
-
},
|
|
103
|
-
"c3": {
|
|
104
|
-
"comment": "Ending inventory for product 3 in period 1.",
|
|
105
|
-
"formula": "iz1",
|
|
106
|
-
"lower": 0,
|
|
107
|
-
"finalValue": []
|
|
108
|
-
},
|
|
109
|
-
"c4": {
|
|
110
|
-
"comment": "Ending inventory for product 1 in period 2.",
|
|
111
|
-
"formula": "ix2",
|
|
112
|
-
"lower": 0,
|
|
113
|
-
"finalValue": []
|
|
114
|
-
},
|
|
115
|
-
"c5": {
|
|
116
|
-
"comment": "Ending inventory for product 2 in period 2.",
|
|
117
|
-
"formula": "iy2",
|
|
118
|
-
"lower": 20,
|
|
119
|
-
"finalValue": []
|
|
120
|
-
},
|
|
121
|
-
"c6": {
|
|
122
|
-
"comment": "Ending inventory for product 3 in period 2.",
|
|
123
|
-
"formula": "iz2",
|
|
124
|
-
"lower": 0,
|
|
125
|
-
"finalValue": []
|
|
126
|
-
},
|
|
127
|
-
"c7": {
|
|
128
|
-
"comment": "Ending inventory for product 1 in period 3.",
|
|
129
|
-
"formula": "ix3",
|
|
130
|
-
"lower": 50,
|
|
131
|
-
"finalValue": []
|
|
132
|
-
},
|
|
133
|
-
"c8": {
|
|
134
|
-
"comment": "Ending inventory for product 2 in period 3.",
|
|
135
|
-
"formula": "iy3",
|
|
136
|
-
"lower": 20,
|
|
137
|
-
"finalValue": []
|
|
138
|
-
},
|
|
139
|
-
"c9": {
|
|
140
|
-
"comment": "Ending inventory for product 3 in period 3.",
|
|
141
|
-
"formula": "iz3",
|
|
142
|
-
"lower": 100,
|
|
143
|
-
"finalValue": []
|
|
144
|
-
},
|
|
145
|
-
"c10": {
|
|
146
|
-
"comment": "Creates 3 constraints: Maximum purchased products in periods 1,2,3 must not exceed 150.",
|
|
147
|
-
"dimensions": [ 3 ],
|
|
148
|
-
"formula": "x + y + z",
|
|
149
|
-
"upper": 150,
|
|
150
|
-
"finalValue": []
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"objective": {
|
|
154
|
-
"comment": "objective function minimizes the ordering cost per time period p1 - 500, p2 - 400 and p3 - 300 plus the holding cost per product (10) held over in inventory. ",
|
|
155
|
-
"name": "obj",
|
|
156
|
-
"type": "minimize",
|
|
157
|
-
"finalValue": [],
|
|
158
|
-
"formula": "500*sum(px) + 400*sum(py) + 300*sum(pz) + 10*(ix1+ix2+ix3+iy1+iy2+iy3+iz1+iz2+iz3)"
|
|
159
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"modelName": "Inventory2Example",
|
|
3
|
+
"modelDescription": "Inventory2 Nonsmooth RASON Optimization Example: This example uses the same model as used in the Inventory example (under Examples -- Optimization -- Linear Optimizations) without the use of automatic transformation. Recall that this example minimizes the inventory ordering and holding costs while ensuring there is enough inventory on hand to meet demand over a number of time periods, as well as with maintaining minimum inventory levels for each product. As a result the nonsmooth engine, the Optquest Engine, will be used to solve the model. Note that nonsmooth models are much harder to solve and typically result in a slower solve time. Set transformationNonSmooth to True, below, to automatically transform the model into a linear model with a faster solve time.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"modelSettings": {
|
|
6
|
+
"comment": "Set transformationNonSmooth to True to automatically transform the model into a linear model with a faster solve time.",
|
|
7
|
+
"transformNonSmooth": false
|
|
8
|
+
},
|
|
9
|
+
"variables": {
|
|
10
|
+
"comment": "In the original model, Inventory.json, all 9 variables were created separately. In this example, three variable blocks are created, x, y and z, representing the amount of product to be purchased in each time period. Note that each variable is specified to be an integer with an upper bound of 500 and a lower bound of 0. Since the keyword finalValue is present, all variable final values will be returned in the result. ",
|
|
11
|
+
"x": {
|
|
12
|
+
"comment": "xi = the amount of product 1 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
13
|
+
"dimensions": [ 3 ],
|
|
14
|
+
"type": "int",
|
|
15
|
+
"upper": 500,
|
|
16
|
+
"lower": 0,
|
|
17
|
+
"finalValue": []
|
|
18
|
+
},
|
|
19
|
+
"y": {
|
|
20
|
+
"comment": "yi = the amount of product 2 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
21
|
+
"dimensions": [ 3 ],
|
|
22
|
+
"type": "int",
|
|
23
|
+
"upper": 500,
|
|
24
|
+
"lower": [ 0, 0, 0 ],
|
|
25
|
+
"finalValue": []
|
|
26
|
+
},
|
|
27
|
+
"z": {
|
|
28
|
+
"comment": "zi = the amount of product 3 to purchase in time period i = 1,2,3. Variables have been given a lower bound of 0 and an upper bound of 500. The final variable value will appear in the result due to the property, 'finalValue'.",
|
|
29
|
+
"dimensions": [ 3 ],
|
|
30
|
+
"type": "int",
|
|
31
|
+
"upper": 500,
|
|
32
|
+
"lower": 0,
|
|
33
|
+
"finalValue": []
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"formulas": {
|
|
37
|
+
"comment": "Formulas calculating Inventory for each product in each time period. Initial Inventory for all products in period 1 is 0. Calculate inventory using the following formula: Initial inventory + production in period 1 - demand in period 1 + production in period 2 - demand in period 2 + production in period 3 - demand in period 3.",
|
|
38
|
+
"ix1": {
|
|
39
|
+
"comment": "Inventory for product 1 after period 1. 0 = no demand for product 1 in period 1.",
|
|
40
|
+
"formula": "x[1]-0"
|
|
41
|
+
},
|
|
42
|
+
"iy1": {
|
|
43
|
+
"comment": "Inventory for product 2 after period 1. 50 = demand for product 2 in period 1.",
|
|
44
|
+
"formula": "y[1] - 50"
|
|
45
|
+
},
|
|
46
|
+
"iz1": {
|
|
47
|
+
"comment": "Inventory for product 3 after period 1. 0 = no demand for product 3 in period 1.",
|
|
48
|
+
"formula": "z[1] - 0"
|
|
49
|
+
},
|
|
50
|
+
"ix2": {
|
|
51
|
+
"comment": "Inventory for product 1 after period 2. 20 = demand for product 1 in period 2.",
|
|
52
|
+
"formula": "ix1 + x[2] - 20"
|
|
53
|
+
},
|
|
54
|
+
"iy2": {
|
|
55
|
+
"comment": "Inventory for product 2 after period 2. 0 = no demand for product 1 in period 2.",
|
|
56
|
+
"formula": "iy1 + y[2] - 0"
|
|
57
|
+
},
|
|
58
|
+
"iz2": {
|
|
59
|
+
"comment": "Inventory for product 3 after period 2. 100 = demand for product 1 in period 2.",
|
|
60
|
+
"formula": "iz1 + z[2] - 100"
|
|
61
|
+
},
|
|
62
|
+
"ix3": {
|
|
63
|
+
"comment": "Inventory for product 1 after period 3. 0 = no demand for product 1 in period 3.",
|
|
64
|
+
"formula": "ix2 + x[3] - 0"
|
|
65
|
+
},
|
|
66
|
+
"iy3": {
|
|
67
|
+
"comment": "Inventory for product 2 after period 3. 50 = demand for product 1 in period 3.",
|
|
68
|
+
"formula": "iy2 + y[3] - 50"
|
|
69
|
+
},
|
|
70
|
+
"iz3": {
|
|
71
|
+
"comment": "Inventory for product 3 after period 3. 0 = no demand for product 1 in period 3.",
|
|
72
|
+
"formula": "iz2 + z[3] - 0"
|
|
73
|
+
},
|
|
74
|
+
"px": {
|
|
75
|
+
"comment": "If x1, x2 or x3 are nonzero, px[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
76
|
+
"dimensions": [ 3 ],
|
|
77
|
+
"formula": "if(x > 0, 1, 0)"
|
|
78
|
+
},
|
|
79
|
+
"py": {
|
|
80
|
+
"comment": "If y1, y2 or y3 are nonzero, py[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
81
|
+
"dimensions": [ 3 ],
|
|
82
|
+
"formula": "if(y > 0, 1, 0)"
|
|
83
|
+
},
|
|
84
|
+
"pz": {
|
|
85
|
+
"comment": "If z1, z2 or z3 are nonzero, pz[i] = 1. This indicates if any product was purchased (1) or not (0)",
|
|
86
|
+
"dimensions": [ 3 ],
|
|
87
|
+
"formula": "if(z > 0, 1, 0)"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"constraints": {
|
|
91
|
+
"c1": {
|
|
92
|
+
"comment": "Ending inventory for product 1 in period 1.",
|
|
93
|
+
"formula": "ix1",
|
|
94
|
+
"lower": 0,
|
|
95
|
+
"finalValue": []
|
|
96
|
+
},
|
|
97
|
+
"c2": {
|
|
98
|
+
"comment": "Ending inventory for product 2 in period 1.",
|
|
99
|
+
"formula": "iy1",
|
|
100
|
+
"lower": 0,
|
|
101
|
+
"finalValue": []
|
|
102
|
+
},
|
|
103
|
+
"c3": {
|
|
104
|
+
"comment": "Ending inventory for product 3 in period 1.",
|
|
105
|
+
"formula": "iz1",
|
|
106
|
+
"lower": 0,
|
|
107
|
+
"finalValue": []
|
|
108
|
+
},
|
|
109
|
+
"c4": {
|
|
110
|
+
"comment": "Ending inventory for product 1 in period 2.",
|
|
111
|
+
"formula": "ix2",
|
|
112
|
+
"lower": 0,
|
|
113
|
+
"finalValue": []
|
|
114
|
+
},
|
|
115
|
+
"c5": {
|
|
116
|
+
"comment": "Ending inventory for product 2 in period 2.",
|
|
117
|
+
"formula": "iy2",
|
|
118
|
+
"lower": 20,
|
|
119
|
+
"finalValue": []
|
|
120
|
+
},
|
|
121
|
+
"c6": {
|
|
122
|
+
"comment": "Ending inventory for product 3 in period 2.",
|
|
123
|
+
"formula": "iz2",
|
|
124
|
+
"lower": 0,
|
|
125
|
+
"finalValue": []
|
|
126
|
+
},
|
|
127
|
+
"c7": {
|
|
128
|
+
"comment": "Ending inventory for product 1 in period 3.",
|
|
129
|
+
"formula": "ix3",
|
|
130
|
+
"lower": 50,
|
|
131
|
+
"finalValue": []
|
|
132
|
+
},
|
|
133
|
+
"c8": {
|
|
134
|
+
"comment": "Ending inventory for product 2 in period 3.",
|
|
135
|
+
"formula": "iy3",
|
|
136
|
+
"lower": 20,
|
|
137
|
+
"finalValue": []
|
|
138
|
+
},
|
|
139
|
+
"c9": {
|
|
140
|
+
"comment": "Ending inventory for product 3 in period 3.",
|
|
141
|
+
"formula": "iz3",
|
|
142
|
+
"lower": 100,
|
|
143
|
+
"finalValue": []
|
|
144
|
+
},
|
|
145
|
+
"c10": {
|
|
146
|
+
"comment": "Creates 3 constraints: Maximum purchased products in periods 1,2,3 must not exceed 150.",
|
|
147
|
+
"dimensions": [ 3 ],
|
|
148
|
+
"formula": "x + y + z",
|
|
149
|
+
"upper": 150,
|
|
150
|
+
"finalValue": []
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"objective": {
|
|
154
|
+
"comment": "objective function minimizes the ordering cost per time period p1 - 500, p2 - 400 and p3 - 300 plus the holding cost per product (10) held over in inventory. ",
|
|
155
|
+
"name": "obj",
|
|
156
|
+
"type": "minimize",
|
|
157
|
+
"finalValue": [],
|
|
158
|
+
"formula": "500*sum(px) + 400*sum(py) + 300*sum(pz) + 10*(ix1+ix2+ix3+iy1+iy2+iy3+iz1+iz2+iz3)"
|
|
159
|
+
}
|
|
160
160
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"modelName": "PortfolioOptExample",
|
|
3
|
-
"modelDescription": "Quadratic (QP) RASON example: This model finds the optimal allocation of funds to stocks that minimizes the portfolio risk, measured by portfolio Variance (a quadratic function), computed via a custom QUADPRODUCT function. This quadratic programming (QP) model can be solved with the GRG Nonlinear Solver, or more efficiently with the LP/Quadratic Solver or the SOCP Barrier Solver.",
|
|
4
|
-
"modelType": "optimization",
|
|
5
|
-
"variables": {
|
|
6
|
-
"comment": "The variables in the x array are the percentage allocations of the funds to invest in each stock. All variables must have a lower bound of 0 (lower: 0) to ensure no stocks are allocated a negative amount.",
|
|
7
|
-
"x": {
|
|
8
|
-
"comment": "x[i] = the amt to be invested in each stock.",
|
|
9
|
-
"value": [ 0.2, 0.2, 0.2, 0.2, 0.2 ],
|
|
10
|
-
"lower": 0,
|
|
11
|
-
"finalValue": []
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"data": {
|
|
15
|
-
"comment": "The data section (optional) can be used to setup constant arrays or generate formulas to be utilized in the constraints and objective.",
|
|
16
|
-
"lin_term": {
|
|
17
|
-
"comment": "The QUADPRODUCT function in the objective computes the portfolio variance, which is defined by RASON Decision Services. This function can be used to compute any 'quadratic form' such as xTQx + cx. In this example, the elements of the matrix 'cov' are the covariances of returns or pairs of stocks, and the elements of the vector lin_term, which are all zero. You could instead compute the portfolio variance using a series of Excel formulas using multiplication and addition, but it is more convenient to use the QUADPRODUCT function.",
|
|
18
|
-
"value": [ 0, 0, 0, 0, 0 ]
|
|
19
|
-
},
|
|
20
|
-
"stock": {
|
|
21
|
-
"comment": "This array holds the expected returns for the 5 stocks.",
|
|
22
|
-
"value": [ 0.07, 0.08, 0.095, 0.065, 0.14 ]
|
|
23
|
-
},
|
|
24
|
-
"cov": {
|
|
25
|
-
"comment": "This matrix holds the covariances between all 5 stocks.",
|
|
26
|
-
"value": [
|
|
27
|
-
[ 0.025, 0.001, 0.01, -0.005, 0.01 ],
|
|
28
|
-
[ 0.001, 0.04, -0.001, 0.012, -0.0085 ],
|
|
29
|
-
[ 0.01, -0.001, 0.012, 0.0065, 0.0075 ],
|
|
30
|
-
[ -0.005, 0.012, 0.0065, 0.08, 0.01 ],
|
|
31
|
-
[ 0.01, -0.0085, 0.0075, 0.01, 0.07 ]
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"constraints": {
|
|
36
|
-
"comment": "There are 3 constraints in this portfolio optimization model.",
|
|
37
|
-
"total": {
|
|
38
|
-
"comment": "This constraint ensures that the total amount of funds is invested by ensuring that the sum of the variables is equal to 1.",
|
|
39
|
-
"formula": "sum(x)",
|
|
40
|
-
"equal": 1
|
|
41
|
-
},
|
|
42
|
-
"return": {
|
|
43
|
-
"comment": "This constraint takes the sumproduct between the variable x array and the expected stock returns and ensures that the total return is greater than 9.5%.",
|
|
44
|
-
"formula": "sumproduct(x, stock)",
|
|
45
|
-
"lower": 0.095
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"objective": {
|
|
49
|
-
"variance": {
|
|
50
|
-
"comment": "The objective minimizes the variance of the portfolio given the QUADPRODUCT function. See the comment in the data section for more information on this function.",
|
|
51
|
-
"type": "minimize",
|
|
52
|
-
"formula": "quadproduct(x, lin_term, cov)",
|
|
53
|
-
"finalValue": []
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"modelName": "PortfolioOptExample",
|
|
3
|
+
"modelDescription": "Quadratic (QP) RASON example: This model finds the optimal allocation of funds to stocks that minimizes the portfolio risk, measured by portfolio Variance (a quadratic function), computed via a custom QUADPRODUCT function. This quadratic programming (QP) model can be solved with the GRG Nonlinear Solver, or more efficiently with the LP/Quadratic Solver or the SOCP Barrier Solver.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "The variables in the x array are the percentage allocations of the funds to invest in each stock. All variables must have a lower bound of 0 (lower: 0) to ensure no stocks are allocated a negative amount.",
|
|
7
|
+
"x": {
|
|
8
|
+
"comment": "x[i] = the amt to be invested in each stock.",
|
|
9
|
+
"value": [ 0.2, 0.2, 0.2, 0.2, 0.2 ],
|
|
10
|
+
"lower": 0,
|
|
11
|
+
"finalValue": []
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"data": {
|
|
15
|
+
"comment": "The data section (optional) can be used to setup constant arrays or generate formulas to be utilized in the constraints and objective.",
|
|
16
|
+
"lin_term": {
|
|
17
|
+
"comment": "The QUADPRODUCT function in the objective computes the portfolio variance, which is defined by RASON Decision Services. This function can be used to compute any 'quadratic form' such as xTQx + cx. In this example, the elements of the matrix 'cov' are the covariances of returns or pairs of stocks, and the elements of the vector lin_term, which are all zero. You could instead compute the portfolio variance using a series of Excel formulas using multiplication and addition, but it is more convenient to use the QUADPRODUCT function.",
|
|
18
|
+
"value": [ 0, 0, 0, 0, 0 ]
|
|
19
|
+
},
|
|
20
|
+
"stock": {
|
|
21
|
+
"comment": "This array holds the expected returns for the 5 stocks.",
|
|
22
|
+
"value": [ 0.07, 0.08, 0.095, 0.065, 0.14 ]
|
|
23
|
+
},
|
|
24
|
+
"cov": {
|
|
25
|
+
"comment": "This matrix holds the covariances between all 5 stocks.",
|
|
26
|
+
"value": [
|
|
27
|
+
[ 0.025, 0.001, 0.01, -0.005, 0.01 ],
|
|
28
|
+
[ 0.001, 0.04, -0.001, 0.012, -0.0085 ],
|
|
29
|
+
[ 0.01, -0.001, 0.012, 0.0065, 0.0075 ],
|
|
30
|
+
[ -0.005, 0.012, 0.0065, 0.08, 0.01 ],
|
|
31
|
+
[ 0.01, -0.0085, 0.0075, 0.01, 0.07 ]
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"constraints": {
|
|
36
|
+
"comment": "There are 3 constraints in this portfolio optimization model.",
|
|
37
|
+
"total": {
|
|
38
|
+
"comment": "This constraint ensures that the total amount of funds is invested by ensuring that the sum of the variables is equal to 1.",
|
|
39
|
+
"formula": "sum(x)",
|
|
40
|
+
"equal": 1
|
|
41
|
+
},
|
|
42
|
+
"return": {
|
|
43
|
+
"comment": "This constraint takes the sumproduct between the variable x array and the expected stock returns and ensures that the total return is greater than 9.5%.",
|
|
44
|
+
"formula": "sumproduct(x, stock)",
|
|
45
|
+
"lower": 0.095
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"objective": {
|
|
49
|
+
"variance": {
|
|
50
|
+
"comment": "The objective minimizes the variance of the portfolio given the QUADPRODUCT function. See the comment in the data section for more information on this function.",
|
|
51
|
+
"type": "minimize",
|
|
52
|
+
"formula": "quadproduct(x, lin_term, cov)",
|
|
53
|
+
"finalValue": []
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
56
|
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"modelName": "PortfolioOpt2Example",
|
|
3
|
-
"modelDescription": "RASON Portfolio Opt 2 Example with Multiple Optimizations. This is similar to the original PortfolioOpt, a portfolio optimization model, but here we run 2 optimizations, using a different minimum variance value for each solve, using the optimization parameter PsiOptParam. PsiOptParam varies the Desired Return from 9.5% to 10% by setting the number of optimizations to 2 in modelSettings. PsiOptParam is introduced in the Parameters section and then called in the 'return' constraint. In the first optimization, the minimum variance = 9.5% and 10% in the 2nd optimization. The result will contain the final variable and objective function values for each optimization.",
|
|
4
|
-
"modelType": "optimization",
|
|
5
|
-
"modelSettings": {
|
|
6
|
-
"comment": "Set the number of optimizations for the optimization parameter, PsiOptParam, in this section.",
|
|
7
|
-
"numOptimizations": 2
|
|
8
|
-
},
|
|
9
|
-
"variables": {
|
|
10
|
-
"comment": "The variables section remains unchanged from the original Portfolio example. There are still 5 decision variables, all with a lower bound of 0. The final variable values for each optimization will be included in the result since 'finalValue' is present.",
|
|
11
|
-
"x": {
|
|
12
|
-
"comment": "x[i] = the amt to be invested in each stock.",
|
|
13
|
-
"value": [ 0.2, 0.2, 0.2, 0.2, 0.2 ],
|
|
14
|
-
"lower": 0,
|
|
15
|
-
"finalValue": []
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"parameters": {
|
|
19
|
-
"comment": "Since numOptimizations is set to 2 within 'modelSettings', PsiOptParam will vary the 'desired' parameter by 9.5% in the first optimization and 10% in the 2nd optimization. For more information on this function, see https://www.solver.com/risk-solver-help/psi-function-help/optimization/PsiOptParam",
|
|
20
|
-
"desired": {
|
|
21
|
-
"formula": "PsiOptParam(0.095, 0.1)",
|
|
22
|
-
"finalValue": []
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"data": {
|
|
26
|
-
"lin_term": {
|
|
27
|
-
"comment": "The QUADPRODUCT function in the objective computes the portfolio variance, which is defined by RASON Decision Services. This function can be used to compute any 'quadratic form' such as xTQx + cx. In this example, the elements of the matrix 'cov' are the covariances of returns or pairs of stocks, and the elements of the vector lin_term, which are all zero. You could instead compute the portfolio variance using a series of Excel formulas using multiplication and addition, but it is more convenient to use the QUADPRODUCT function.",
|
|
28
|
-
"value": [ 0, 0, 0, 0, 0 ]
|
|
29
|
-
},
|
|
30
|
-
"stock": {
|
|
31
|
-
"comment": "This array holds the expected returns for the 5 stocks.",
|
|
32
|
-
"value": [ 0.07, 0.08, 0.095, 0.065, 0.14 ]
|
|
33
|
-
},
|
|
34
|
-
"cov": {
|
|
35
|
-
"comment": "This matrix holds the covariances between all 5 stocks.",
|
|
36
|
-
"value": [
|
|
37
|
-
[ 0.025, 0.001, 0.01, -0.005, 0.01 ],
|
|
38
|
-
[ 0.001, 0.04, -0.001, 0.012, -0.0085 ],
|
|
39
|
-
[ 0.01, -0.001, 0.012, 0.0065, 0.0075 ],
|
|
40
|
-
[ -0.005, 0.012, 0.0065, 0.08, 0.01 ],
|
|
41
|
-
[ 0.01, -0.0085, 0.0075, 0.01, 0.07 ]
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"constraints": {
|
|
46
|
-
"comment": "There are still 3 constraints in this portfolio optimization model.",
|
|
47
|
-
"total": {
|
|
48
|
-
"comment": "This constraint ensures that the total amount of funds is invested by ensuring that the sum of the variables is equal to 1.",
|
|
49
|
-
"formula": "sum(x)",
|
|
50
|
-
"equal": 1
|
|
51
|
-
},
|
|
52
|
-
"return": {
|
|
53
|
-
"comment": "This constraint takes the sumproduct between the variable x array and the expected stock returns and ensures that the actual return is greater than the desired return. In the 1st optimization, desired = 9.5% and 10% in the 2nd optimization.",
|
|
54
|
-
"formula": "sumproduct(x, stock) - desired",
|
|
55
|
-
"lower": 0
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"objective": {
|
|
59
|
-
"variance": {
|
|
60
|
-
"comment": "The objective minimizes the variance of the portfolio given the QUADPRODUCT function. See the comment in the data section for more information on this function. Both objectives will be listed by Optimization Index in the results.",
|
|
61
|
-
"type": "minimize",
|
|
62
|
-
"formula": "quadproduct(x, lin_term, cov)",
|
|
63
|
-
"finalValue": []
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"modelName": "PortfolioOpt2Example",
|
|
3
|
+
"modelDescription": "RASON Portfolio Opt 2 Example with Multiple Optimizations. This is similar to the original PortfolioOpt, a portfolio optimization model, but here we run 2 optimizations, using a different minimum variance value for each solve, using the optimization parameter PsiOptParam. PsiOptParam varies the Desired Return from 9.5% to 10% by setting the number of optimizations to 2 in modelSettings. PsiOptParam is introduced in the Parameters section and then called in the 'return' constraint. In the first optimization, the minimum variance = 9.5% and 10% in the 2nd optimization. The result will contain the final variable and objective function values for each optimization.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"modelSettings": {
|
|
6
|
+
"comment": "Set the number of optimizations for the optimization parameter, PsiOptParam, in this section.",
|
|
7
|
+
"numOptimizations": 2
|
|
8
|
+
},
|
|
9
|
+
"variables": {
|
|
10
|
+
"comment": "The variables section remains unchanged from the original Portfolio example. There are still 5 decision variables, all with a lower bound of 0. The final variable values for each optimization will be included in the result since 'finalValue' is present.",
|
|
11
|
+
"x": {
|
|
12
|
+
"comment": "x[i] = the amt to be invested in each stock.",
|
|
13
|
+
"value": [ 0.2, 0.2, 0.2, 0.2, 0.2 ],
|
|
14
|
+
"lower": 0,
|
|
15
|
+
"finalValue": []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"parameters": {
|
|
19
|
+
"comment": "Since numOptimizations is set to 2 within 'modelSettings', PsiOptParam will vary the 'desired' parameter by 9.5% in the first optimization and 10% in the 2nd optimization. For more information on this function, see https://www.solver.com/risk-solver-help/psi-function-help/optimization/PsiOptParam",
|
|
20
|
+
"desired": {
|
|
21
|
+
"formula": "PsiOptParam(0.095, 0.1)",
|
|
22
|
+
"finalValue": []
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"data": {
|
|
26
|
+
"lin_term": {
|
|
27
|
+
"comment": "The QUADPRODUCT function in the objective computes the portfolio variance, which is defined by RASON Decision Services. This function can be used to compute any 'quadratic form' such as xTQx + cx. In this example, the elements of the matrix 'cov' are the covariances of returns or pairs of stocks, and the elements of the vector lin_term, which are all zero. You could instead compute the portfolio variance using a series of Excel formulas using multiplication and addition, but it is more convenient to use the QUADPRODUCT function.",
|
|
28
|
+
"value": [ 0, 0, 0, 0, 0 ]
|
|
29
|
+
},
|
|
30
|
+
"stock": {
|
|
31
|
+
"comment": "This array holds the expected returns for the 5 stocks.",
|
|
32
|
+
"value": [ 0.07, 0.08, 0.095, 0.065, 0.14 ]
|
|
33
|
+
},
|
|
34
|
+
"cov": {
|
|
35
|
+
"comment": "This matrix holds the covariances between all 5 stocks.",
|
|
36
|
+
"value": [
|
|
37
|
+
[ 0.025, 0.001, 0.01, -0.005, 0.01 ],
|
|
38
|
+
[ 0.001, 0.04, -0.001, 0.012, -0.0085 ],
|
|
39
|
+
[ 0.01, -0.001, 0.012, 0.0065, 0.0075 ],
|
|
40
|
+
[ -0.005, 0.012, 0.0065, 0.08, 0.01 ],
|
|
41
|
+
[ 0.01, -0.0085, 0.0075, 0.01, 0.07 ]
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"constraints": {
|
|
46
|
+
"comment": "There are still 3 constraints in this portfolio optimization model.",
|
|
47
|
+
"total": {
|
|
48
|
+
"comment": "This constraint ensures that the total amount of funds is invested by ensuring that the sum of the variables is equal to 1.",
|
|
49
|
+
"formula": "sum(x)",
|
|
50
|
+
"equal": 1
|
|
51
|
+
},
|
|
52
|
+
"return": {
|
|
53
|
+
"comment": "This constraint takes the sumproduct between the variable x array and the expected stock returns and ensures that the actual return is greater than the desired return. In the 1st optimization, desired = 9.5% and 10% in the 2nd optimization.",
|
|
54
|
+
"formula": "sumproduct(x, stock) - desired",
|
|
55
|
+
"lower": 0
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"objective": {
|
|
59
|
+
"variance": {
|
|
60
|
+
"comment": "The objective minimizes the variance of the portfolio given the QUADPRODUCT function. See the comment in the data section for more information on this function. Both objectives will be listed by Optimization Index in the results.",
|
|
61
|
+
"type": "minimize",
|
|
62
|
+
"formula": "quadproduct(x, lin_term, cov)",
|
|
63
|
+
"finalValue": []
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
66
|
}
|