|
| 1 | +.. _simulation-methods: |
| 2 | + |
| 3 | +===================== |
| 4 | +Methods of Simulating |
| 5 | +===================== |
| 6 | + |
| 7 | +There are a number of ways to terminate a simulation: |
| 8 | + |
| 9 | +- :ref:`until_maxtime` |
| 10 | +- :ref:`until_maxcustomers` |
| 11 | +- :ref:`until_deadlock` |
| 12 | + |
| 13 | +.. _until_maxtime: |
| 14 | + |
| 15 | +------------------------------- |
| 16 | +:code:`simulate_until_max_time` |
| 17 | +------------------------------- |
| 18 | + |
| 19 | +This method simulates the system from an empty system. The simulation terminates once a certain amount of simulation time has passed. The method takes in a :code:`max_simulation_time`:: |
| 20 | + |
| 21 | + params = { |
| 22 | + 'Arrival_distributions': [['Exponential', 1.0]], |
| 23 | + 'Service_distributions': [['Exponential', 0.5]], |
| 24 | + 'Number_of_servers': [1], |
| 25 | + 'Transition_matrices': [[0.0]], |
| 26 | + 'Queue_capacities': [3] |
| 27 | + } |
| 28 | + N = ciw.create_network(params) |
| 29 | + Q = ciw.Simulation(N) |
| 30 | + |
| 31 | + Q.simulate_until_max_time(100) |
| 32 | + |
| 33 | +Keyword arguments: |
| 34 | + - :code:`max_simulation_time`: REQUIRED. Length of simulation time to run the simulation for. |
| 35 | + - :code:`progress_bar`: OPTIONAL. See :ref:`progress-bars`. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +.. _until_maxcustomers: |
| 40 | + |
| 41 | +------------------------------------ |
| 42 | +:code:`simulate_until_max_customers` |
| 43 | +------------------------------------ |
| 44 | + |
| 45 | +This method simulates the system from an empty system. The simulation terminates once a certain amount of customers passed through. The method takes in a :code:`max_customers`:: |
| 46 | + |
| 47 | + params = { |
| 48 | + 'Arrival_distributions': [['Exponential', 1.0]], |
| 49 | + 'Service_distributions': [['Exponential', 0.5]], |
| 50 | + 'Number_of_servers': [1], |
| 51 | + 'Transition_matrices': [[0.0]], |
| 52 | + 'Queue_capacities': [3] |
| 53 | + } |
| 54 | + N = ciw.create_network(params) |
| 55 | + Q = ciw.Simulation(N) |
| 56 | + |
| 57 | + Q.simulate_until_maxcustomers(20, method='Finish') |
| 58 | + |
| 59 | +There are three methods of simulating for a maximum number of customers, specified by the :code:`method` keyword argument: |
| 60 | + - Finish: Simulates until :code:`max_customers` has reached the Exit Node. |
| 61 | + - Arrive: Simulates until :code:`max_customers` have spawned at the Arrival Node. |
| 62 | + - Accept: Simulates until :code:`max_customers` have been spawned and accepted (not rejected) at the Arrival Node. |
| 63 | + |
| 64 | +Keyword arguments: |
| 65 | + - :code:`max_customers`: REQUIRED. The maximum number of customers. |
| 66 | + - :code:`method`: OPTIONAL. The method which customers are counted. Default method is 'Finish'. |
| 67 | + - :code:`progress_bar`: OPTIONAL. See :ref:`progress-bars`. |
| 68 | + |
| 69 | + |
| 70 | +.. _until_deadlock: |
| 71 | + |
| 72 | +------------------------------- |
| 73 | +:code:`simulate_until_deadlock` |
| 74 | +------------------------------- |
| 75 | + |
| 76 | +Simulated until the system reaches deadlock. Please see: :ref:`deadlock-detection`. |
0 commit comments