Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

Multiple Parameterized Simulations

However, what if we could vary a parameter over a range, and run a simulation for each different number of tickets sold and summarize the results? With the RASON Modeling language you can! Make the following changes to UGYieldManagement1.json.

  1. Set numSimulations: 41 within modelSettings. Forty-one simulations will be ran, each with 1,000 trial values.
  2. Remove the constant sold:
    data: {
       "price": { value: 200 }, 
       "capacity": {value: 100 },
       "refund_no_shows": {value: 0.5 },
       "refund_overbook": {value: 1.25 }
    },
  3. Add a parameters section which uses PsiSimParam to automatically modify the value for sold on each simulation starting with 110 and ending with 150. The value that we specify for numSimulations, within modelSettings, determines the incremental value for sold for each simulation. In this example, sold will have a value of 110 on the first simulation, 111 on the second simulation and so on, through 150 on the 41st simulation.

    "parameters": { 
       "sold": { formula: "PsiSimParam(110, 150)", finalValue: [] } 
    },  
  4. Solve either by clicking Simulate in the Desktop IDE or PUT rason.net/api/model/{nameorid} then POST rason.net/api/model/{nameorid}/simulate in the WEB IDE: 41 simulations are completed, each with a different value for sold. The results for the first three simulations are below.

    
    {
      "simulations": [{
        "status": {
          "code": 0,
          "id": "2590+UGYieldManagement1Example+2020-02-11-18-32-41055855",
          "codeText": "Solver has completed the simulation."
        },
        "simulation": 1,
          "parameters": {
            "sold": {
              "finalValue": 110
            }
          },
          "uncertainFunctions": {
            "revenue": {
              "mean": 20445.3,
              "percentiles": [
                [18098.5, 18100, 18250, 18250, 18250, 18250, 18400, 18400,
                  …
                 21700, 21850, 22000, 22300, 22600, 22900, 23353, 24101]
              ],
              "trials": [
                [19300, 19750, 18700, 19750, 22300, 19150, 17950, 18550,
                 …
                 18100, 19900, 20200, 18400, 21850, 21250, 19900]
              ]
            }
          },
          "uncertainVariables": {
            "no_shows": {
             "mean": 10.9922
            }
          }
        },
        {
          "status": {
            "code": 0,
              "id": "2590+UGYieldManagement1Example+2020-02-11-18-32-41-055855",
              "codeText": "Solver has completed the simulation."
            },
            "simulation": 2,
              "parameters": {
                "sold": {
                  "finalValue": 111
                }
              },
              "uncertainFunctions": {
                "revenue": {
                  "mean": 20500.2,
                  "percentiles": [
                    [18098.5, 18100, 18250, 18250, 18250, 18250, 18400, 18400,
                     …
                     21550, 21700, 21850, 22000, 22300, 22600, 22900, 23353, 24101]
                  ],
                  "trials": [
                    [19300, 19750, 18700, 19750, 22300, 19150, 17950, 18550,
                     …
                     22750, 18100, 19900, 20200, 18400, 21850, 21250, 19900]
                    ]
                  }
              },
              "uncertainVariables": {
                "no_shows": {
                  "mean": 11.0921
                }
              }
            },
            {
              "status": {
                "code": 0,
                "id": "2590+UGYieldManagement1Example+2020-02-11-18-32-41-055855",
                "codeText": "Solver has completed the simulation."
              },
              "simulation": 3,
                "parameters": {
                  "sold": {
                    "finalValue": 112
                }
              },
              "uncertainFunctions": {
                "revenue": {
                  "mean": 20543.4,
               "percentiles": [
                 [18098.5, 18100, 18250, 18250, 18250, 18250, 18400,
                  …
                  21850, 22000, 22300, 22600, 22900, 23353, 24101]
                 ],
                 "trials": [
                 [19300, 19750, 18700, 19750, 22300, 19150, 17950,
                  …
                  18100, 19900, 20200, 18400, 21850, 21250, 19900]
                 ]
               }
             },
             "uncertainVariables": {
               "no_shows": {
                 "mean": 11.1921
               }
             }
           },
    

    Since we asked for the finalValue for sold, this value is printed for each simulation, along with the expected value and percentile values.

  5. To see the result for simulation # 5 only, add simulationIndex: 5 to modelSettings as shown below, then update the model and resolve.

    modelSettings: { numSimulations: 41, numTrials: 1000, randomSeed: 1, simulationIndex: 5 },

    The Result will contain information for simulation #5 only.

    
    { 
       "simulations": [{
         "status": {
           "code": 0,
           "id": "2590+UGYieldManagement1Example+2020-02-11-19-24-31-042646",
           "codeText": "Solver has completed the simulation."
         },
         "simulation": 5,
           "parameters": {
            "sold": {
              "finalValue": 114
            }
         },
         "uncertainFunctions": {
           "revenue": {
             "mean": 20597.1,
              "percentiles": [
                 [19299, 19600, 19750, 19750, 19750, 19900, 19900, 19900,
                   …
                  21300, 21300, 21300, 21400, 21400, 21400, 21400]
              ],
              "trials": [
                 [20650, 20950, 20200, 20950, 20400, 20500, 19600, 20200,
                  …
                  20100, 19750, 21100, 21400, 20050, 20600, 20900, 21100]
              ]
           }
         },
         "uncertainVariables": {
           "no_shows": {
             "mean": 11.3919
           }
         }
       }]
     }
    
Back to Changing Parameter Values