@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
package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/DataFiltering/ListwithFilter.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "ListwithFilter",
|
|
3
|
+
"modelDescription": "Example illustrating how to filter a table (list).",
|
|
4
|
+
"modelType": "calculation",
|
|
5
|
+
"typeDefs": {
|
|
6
|
+
"comment": "This section defines custom data structures used in the model.",
|
|
7
|
+
"tLoanList": {
|
|
8
|
+
"comment": "A custom type named tLoanList, defined using FEEL language. This is a collection of items. The names of the fields (all of type number) are: principal, rate and termMonths. ",
|
|
9
|
+
"language": "FEEL",
|
|
10
|
+
"isCollection": true,
|
|
11
|
+
"components": [ "principal", "rate", "termMonths" ],
|
|
12
|
+
"types": [ "number", "number", "number" ]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"data": {
|
|
16
|
+
"comment": "Data provided in this section. The 'binding: get'' field indicates this data can be accessed from outside the model environment.",
|
|
17
|
+
"arr": {
|
|
18
|
+
"value": [ 0, 1, 2, 3, 4, 5 ],
|
|
19
|
+
"binding": "get"
|
|
20
|
+
},
|
|
21
|
+
"list": {
|
|
22
|
+
"type": "tLoanList",
|
|
23
|
+
"value": [
|
|
24
|
+
[ 600000, 0.0275, 360 ],
|
|
25
|
+
[ 300000, 0.03, 360 ]
|
|
26
|
+
],
|
|
27
|
+
"binding": "get"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"formulas": {
|
|
31
|
+
"comment": "Defines computed fields using expressions or FEEL formulas.",
|
|
32
|
+
"resExc": {
|
|
33
|
+
"comment": "Filters arr to include only even numbers greater than 0",
|
|
34
|
+
"formula": "arr[AND(item > 0, ISEVEN(item))]",
|
|
35
|
+
"finalValue": []
|
|
36
|
+
},
|
|
37
|
+
"resFeel": {
|
|
38
|
+
"comment": "Same logic as above, but using FEEL syntax instead of expression syntax.",
|
|
39
|
+
"feelFormula": "arr[item > 0 and even(item)]",
|
|
40
|
+
"finalValue": []
|
|
41
|
+
},
|
|
42
|
+
"selExc": {
|
|
43
|
+
"comment": "Filters the list of loans to only include those with a rate less than 3%.",
|
|
44
|
+
"formula": "list[rate < 0.03]",
|
|
45
|
+
"finalValue": []
|
|
46
|
+
},
|
|
47
|
+
"selFeel": {
|
|
48
|
+
"comment": "Same logic as above, but using FEEL syntax instead of expression syntax.",
|
|
49
|
+
"feelFormula": "list[rate < 0.03]",
|
|
50
|
+
"finalValue": []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "ProductMix5",
|
|
3
|
+
"modelDescription": "Solves the product mix example using constraints defined with a for statement and indexed arrays.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"x": {
|
|
7
|
+
"comment": "Decision variables: quantity produced of each product (one variable per product). Lower bound of 0 for each variable. Final values are requested in the solution.",
|
|
8
|
+
"lower": [ 0, 0, 0 ],
|
|
9
|
+
"finalValue": []
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"data": {
|
|
13
|
+
"profits": {
|
|
14
|
+
"comment": "Profit per unit for each product. $75 for TVS, $50 for stereos and $35 for speakers. The binding:get property allows these values to be changed outside of the model environment. Values will be available in the solution.",
|
|
15
|
+
"dimensions": [ 3 ],
|
|
16
|
+
"value": [ 75, 50, 35 ],
|
|
17
|
+
"binding": "get",
|
|
18
|
+
"finalValue": []
|
|
19
|
+
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
"parts": {
|
|
23
|
+
"comment": "Parts usage matrix: parts[p,i] = units of part p required to produce product i",
|
|
24
|
+
"dimensions": [ 5, 3 ],
|
|
25
|
+
"value": [
|
|
26
|
+
[ 1, 1, 0 ],
|
|
27
|
+
[ 1, 0, 0 ],
|
|
28
|
+
[ 2, 2, 1 ],
|
|
29
|
+
[ 1, 1, 0 ],
|
|
30
|
+
[ 2, 1, 1 ]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"inventory": {
|
|
35
|
+
"comment": "Available inventory for each part (one value per part)",
|
|
36
|
+
"value": [ 450, 250, 800, 450, 600 ]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
"constraints": {
|
|
41
|
+
"comment": "Create one inventory constraint for each part",
|
|
42
|
+
"for(p in 1..5)": {
|
|
43
|
+
"comment": "Total usage of part p across all products cannot exceed available inventory",
|
|
44
|
+
"cons[p]": {
|
|
45
|
+
"formula": "sumproduct(parts[p,], transpose(x))",
|
|
46
|
+
"upper": "inventory"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"objective": {
|
|
51
|
+
"comment": "Maximize total profit across all products",
|
|
52
|
+
"total": {
|
|
53
|
+
"formula": "sumproduct(x, profits)",
|
|
54
|
+
"type": "maximize",
|
|
55
|
+
"finalValue": []
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/compoundWhileStatement.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "compoundWhileStatement",
|
|
3
|
+
"modelDescription": "example of compound and while statements",
|
|
4
|
+
"modelType": "calculation",
|
|
5
|
+
"data": {
|
|
6
|
+
"f": {
|
|
7
|
+
"dimensions": [ 5 ],
|
|
8
|
+
"value": 0
|
|
9
|
+
},
|
|
10
|
+
"i": {
|
|
11
|
+
"value": 1
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"formulas": {
|
|
15
|
+
"compound": {
|
|
16
|
+
"i": {
|
|
17
|
+
"value": 1,
|
|
18
|
+
"comment": "need to reset it in case of multiple calculation"
|
|
19
|
+
},
|
|
20
|
+
"while(i <= 5)": {
|
|
21
|
+
"sum(j in 1..i)": {
|
|
22
|
+
"s": {
|
|
23
|
+
"formula": "j"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"f[i]": {
|
|
27
|
+
"formula": "s",
|
|
28
|
+
"finalValue": []
|
|
29
|
+
},
|
|
30
|
+
"i": {
|
|
31
|
+
"formula": "i + 1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/examples/rason-features/Arrays_Loops_Tables/ArrayExamples/Loops/ifThenElseStatement.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "ifThenElseStatement",
|
|
3
|
+
"modelDescription": "example of if-then-else statement",
|
|
4
|
+
"modelType": "calculation",
|
|
5
|
+
"data": {
|
|
6
|
+
"comment": "Creates array with 5 entries (indexed 1..5). Initial value for all elements = 0.",
|
|
7
|
+
"f": {
|
|
8
|
+
"dimensions": [ 5 ],
|
|
9
|
+
"value": 0
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
"formulas": {
|
|
14
|
+
"comment": "Loops over i = 1, 2, 3, 4, 5",
|
|
15
|
+
"loop(i in 1..5)": {
|
|
16
|
+
"comment": "If i is greater than 1, compute f[i] based on previous entry",
|
|
17
|
+
"if(i > 1)": {
|
|
18
|
+
"comment": "Take the previous element f[i-1] and add i",
|
|
19
|
+
"f[i]": {
|
|
20
|
+
"formula": "f[i-1] + i",
|
|
21
|
+
"finalValue": []
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"else": {
|
|
26
|
+
"comment": "Otherwise (i == 1), initialize the first element",
|
|
27
|
+
"f[i]": {
|
|
28
|
+
"comment": "Set f[1] = 1",
|
|
29
|
+
"value": 1
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "nestedLoops",
|
|
3
|
+
"modelDescription": "Example of a nested loop",
|
|
4
|
+
"modelType": "calculation",
|
|
5
|
+
"data": {
|
|
6
|
+
"comment": "Creates array with 5 entries (indexed 1..5). Initial value for all elements = 0.",
|
|
7
|
+
"f": {
|
|
8
|
+
"dimensions": [ 5 ],
|
|
9
|
+
"value": 0
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"formulas": {
|
|
13
|
+
"comment": "Creates loop that generates a running total and assigns total to variable, f[i].",
|
|
14
|
+
"loop(i in 1..5)": {
|
|
15
|
+
"sum(j in 1..i)": {
|
|
16
|
+
"s": {
|
|
17
|
+
"formula": "j"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"f[i]": {
|
|
21
|
+
"formula": "s",
|
|
22
|
+
"finalValue": []
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "AirlineHub2Example",
|
|
3
|
+
"modelDescription": "This example is identical to Airline Hub 2 RASON Nonlinear Optimization Example. This example showcases how to use an array to formulate multiple constraints at once.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"comment": "There are 3 variables in the model: x, y and z. x and y are the (x, y) coordinates of the proposed hub location. z is an artificial variable that will be minimized in the objective. The initial value of each variable is set to 1 using the value property and the final values will be returned in the result due to the presence of the keyword, finalValue.",
|
|
7
|
+
|
|
8
|
+
"x": {
|
|
9
|
+
"value": 1.0,
|
|
10
|
+
"finalValue": []
|
|
11
|
+
},
|
|
12
|
+
"y": {
|
|
13
|
+
"value": 1.0,
|
|
14
|
+
"finalValue": []
|
|
15
|
+
},
|
|
16
|
+
"z": {
|
|
17
|
+
"value": 1.0,
|
|
18
|
+
"finalValue": []
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"data": {
|
|
22
|
+
"comment": "The data section holds the x and y coordinates of each of the 6 airports. Supplying the x and y coordinates in two arrays allows all 6 constraints to be entered as a constraint block. See 'constraints' section below. In this example, the size of the arrays are inferred by the number of values passed to each array.",
|
|
23
|
+
"dx": {
|
|
24
|
+
"comment": "These are the x coordinates of each of the 6 airports.",
|
|
25
|
+
"value": [ 1, 0.5, 2, 2, 2, 0.5 ]
|
|
26
|
+
},
|
|
27
|
+
"dy": {
|
|
28
|
+
"comment": "These are the y coordinates of each of the 6 airports.",
|
|
29
|
+
"value": [ 4, 3, 4, 2, 5, 6 ]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"constraints": {
|
|
33
|
+
"comment": "In this example, all six constraints are entered at once. This was made possible by the x and y coordinates being supplied via two arrays, dx and dy. Each constraint calculates the distance between the proposed hub and each of the 6 airports. Each constraint is of the form SQRT((x1 - x0) + (y1 - y0)) <= z where z is the artificial variable. When z is minimized in the objective, it has a 'squashing' effect that pushes the distance formula to be as small as possible, thereby moving the (x,y) coordinates to such a place that minimizes the distance between the hub and all 6 airports. (To convert the constraint to standard form, z is subtracted from both sides of the equation, leaving SQRT((x1 - x0) + (y1 - y0)) - z <= 0.) Notice that the 'dimensions' propety is used to explicitly create the array of size 6.",
|
|
34
|
+
"distance": {
|
|
35
|
+
"dimensions": [ 6 ],
|
|
36
|
+
"formula": "sqrt((x - dx)^2 + (y - dy)^2) - z",
|
|
37
|
+
"upper": 0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"objective": {
|
|
41
|
+
"obj": {
|
|
42
|
+
"comment": "Minimize the artificial variable z. This minimization 'squashes' all six of the distance formulas. The resulting (x,y) coordinate will be the coordinate that minimizes the distance between the hub and all six airports.",
|
|
43
|
+
"formula": "z",
|
|
44
|
+
"type": "minimize",
|
|
45
|
+
"finalValue": []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "indexedArray",
|
|
3
|
+
"modelDescription": "Solves the product mix example problem. However, in this example, the constraints are created using a 'for' statement, an indexed array. For more information on this example, see RASON Examples -- Example Models Discussed in RASON User Guide -- UGProductMixTab4.json.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"indexSets": {
|
|
6
|
+
"part": {
|
|
7
|
+
"value": [ "chas", "tube", "cone", "psup", "elec" ]
|
|
8
|
+
},
|
|
9
|
+
"prod": {
|
|
10
|
+
"value": [ "tv", "stereo", "speaker" ]
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"data": {
|
|
14
|
+
"parts": {
|
|
15
|
+
"indexCols": [ "part", "prod" ],
|
|
16
|
+
"value": [
|
|
17
|
+
[ "chas", "tv", 1 ],
|
|
18
|
+
[ "elec", "stereo", 1 ],
|
|
19
|
+
[ "tube", "tv", 1 ],
|
|
20
|
+
[ "cone", "tv", 2 ],
|
|
21
|
+
[ "cone", "stereo", 2 ],
|
|
22
|
+
[ "chas", "stereo", 1 ],
|
|
23
|
+
[ "cone", "speaker", 1 ],
|
|
24
|
+
[ "psup", "tv", 1 ],
|
|
25
|
+
[ "psup", "stereo", 1 ],
|
|
26
|
+
[ "elec", "tv", 2 ],
|
|
27
|
+
[ "elec", "speaker", 1 ]
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"profits": {
|
|
31
|
+
"dimensions": [ "prod" ],
|
|
32
|
+
"value": [ 75, 50, 35 ]
|
|
33
|
+
},
|
|
34
|
+
"inventory": {
|
|
35
|
+
"comment": "inventory values by part",
|
|
36
|
+
"indexCols": [ "part" ],
|
|
37
|
+
"value": [
|
|
38
|
+
[ "chas", 450 ],
|
|
39
|
+
[ "tube", 250 ],
|
|
40
|
+
[ "cone", 800 ],
|
|
41
|
+
[ "psup", 450 ],
|
|
42
|
+
[ "elec", 600 ]
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"variables": {
|
|
47
|
+
"x": {
|
|
48
|
+
"dimensions": [ "prod" ],
|
|
49
|
+
"value": 0,
|
|
50
|
+
"lower": 0,
|
|
51
|
+
"finalValue": []
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"constraints": {
|
|
55
|
+
"comment": "Constraints created using indexed array formula, a declarative construct used to assign attributes across an indexed array.",
|
|
56
|
+
"for(p in 'part')": {
|
|
57
|
+
"cons[p]": {
|
|
58
|
+
"formula": "sumproduct(parts[p, ], x) - inventory[p]",
|
|
59
|
+
"upper": 0
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"objective": {
|
|
64
|
+
"total": {
|
|
65
|
+
"formula": "sumproduct(x, profits)",
|
|
66
|
+
"type": "maximize",
|
|
67
|
+
"finalValue": []
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelName": "nonParallelArrayExample",
|
|
3
|
+
"modelDescription": "This example is identical to the ProductMix4 .json example under RASON Examples-Optimization-LinearExamples. It is included here to showcase the non-parallel array 'num_used' in the 'constraints' section, below.",
|
|
4
|
+
"modelType": "optimization",
|
|
5
|
+
"variables": {
|
|
6
|
+
"x": {
|
|
7
|
+
"dimensions": [ 3 ],
|
|
8
|
+
"value": 0,
|
|
9
|
+
"lower": 0,
|
|
10
|
+
"finalValue": []
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"data": {
|
|
14
|
+
"profits": {
|
|
15
|
+
"dimensions": [ 3 ],
|
|
16
|
+
"value": [ 75, 50, 35 ],
|
|
17
|
+
"binding": "get",
|
|
18
|
+
"finalValue": []
|
|
19
|
+
},
|
|
20
|
+
"parts": {
|
|
21
|
+
"dimensions": [ 5, 3 ],
|
|
22
|
+
"value": [
|
|
23
|
+
[ 1, 1, 0 ],
|
|
24
|
+
[ 1, 0, 0 ],
|
|
25
|
+
[ 2, 2, 1 ],
|
|
26
|
+
[ 1, 1, 0 ],
|
|
27
|
+
[ 2, 1, 1 ]
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"inventory": {
|
|
31
|
+
"value": [ 450, 250, 800, 450, 600 ]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"constraints": {
|
|
35
|
+
"comment": "5 constraints are created in this section.",
|
|
36
|
+
"num_used": {
|
|
37
|
+
"comment": "This type of array formula is evaluated only once as a single operation. The MMULT function is evaluated as one function call that internally performs a matrix–vector multiplication and returns an array of size 5. The resulting multi-dimensional output is then assigned to the array variable num_used, which is defined as a one-dimensional vertical array of length 5. Since this formula appears in the constraints section, the solver automatically generates one constraint for each element of the resulting array.",
|
|
38
|
+
"dimensions": [ 5 ],
|
|
39
|
+
"formula": "MMULT(parts, x)",
|
|
40
|
+
"upper": "inventory"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"objective": {
|
|
44
|
+
"total": {
|
|
45
|
+
"formula": "sumproduct(x, profits)",
|
|
46
|
+
"type": "maximize",
|
|
47
|
+
"finalValue": []
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|