A Simulation Example Model
Below is a simple Monte Carlo simulation / risk analysis model that determines the optimal number of tickets to sell in an upcoming flight. The example takes into account "no-shows" as well as compensation fees if the flight sells out. The uncertainVariables section defines one uncertain (random) variable (no_shows which uses a PsiLogNormal distribution to model the amount of customers who will not show up for a flight), and the uncertainFunctions section defines one uncertain function (revenue). Our goal is to find the expected mean (or average) revenue.
{
modelName: "ExampleSimulation",
modelType: "simulation",
modelSettings : { numSimulations: 1, numTrials: 1000, randomSeed: 1 },
data : {
price: { value: 200 },
capacity: { value: 100 },
sold: { value: 110 },
refund_no_shows: { value: 0.5 },
refund_overbook: { value: 1.25 }
},
uncertainVariables : {
no_shows: { formula: "PsiLogNormal(0.1*sold, 0.06*sold)", mean: [] }
},
formulas : {
show_ups: { formula: "sold - Round(no_shows, 0)" },
overbook: { formula: "Max(0, show_ups - capacity)" }
},
uncertainFunctions : {
revenue: { formula: "price* (sold - refund_no_shows * ROUND(no_shows,0) - refund_overbook - overbook)", mean: [] }
}
}
By default, the JSON result of evaluating this model contains a set of summary statistics for the output "revenue", across all Monte Carlo trials.
{
"status": {
"code": 0,
"id": "2590+ExampleSimulation+2020-01-02-07-30-10-477802",
"codeText": "Solver has completed the simulation."
},
"uncertainFunctions": {
"revenue": {
"mean": 20286.4}
},
"uncertainVariables": {
"no_shows": {
"mean": 10.9922}
}
}
Back to An Optimization Example
|