42.2 Resource Contraint/Queue Model

This section introduces a synchronized patient simulation model in which patients compete for a limited resource. In this model, the limited resource is access to treatment. When one or more Treatment "spots" is available, a patient can begin treatment. While that person is holding that treatment spot, no other patient can take it.

Parallel trials are required for this model so that patients can compete for this resource in every cycle.

Open the Healthcare tutorial example tree, Parallel Trials - Queue - GlobalTracker.trex. The model structure is a Markov decision model with two strategies: one with 2 resources available (Treatment Resources 2) and one with 3 resources available (Treatment Resources 3). The strategies use the same Markov model structure via cloning.

The Markov model includes health states:

  • Healthy

  • Sick - waiting for treatment

  • In treatment - holding resources

  • Recovered

  • Dead

The limited resource is held within the In Treatment... state. Only a few patients can be in that state during any cycle. In both the Healthy and the Sick... states, there are transitions/events where a patient/ requests a Treatment resource, but not all patients can get the limited resource.

The figure below shows the structure of the model (with Comments and Variable/Markov Info hidden via Tree Preferences).

Note the two transitions where a trial requires treatment and wants access to the limited treatment resource.

  • Healthy > Get sick, Need Treatment

  • Sick, Waiting for Treatment > Is Treatment Available

When a patient/trial reaches one of these transitions, its next step depends on whether a resource is available, which in turn depends on whether all of the limited resources are in use by other patients. Trials will generally be split into these categories relative to the resource:

  1. Trials who hold the resource

  2. Trials who want to hold the resource

  3. Trials who do not need the resource

Imagine 10 trials want the resource, but there are only 2 resources available. Only 2 of the trials will get the resource in that cycle, and the other 8 will have to wait, creating a queue of patients waiting for the resource. When one of the 2 trials holding the resource releases it, another trial currently waiting for that resource will get it.

The two Stop nodes in the patient pathways represent that queue. The Stop node forces a trial to wait mid-cycle for other trials to potentially release the resource. Let's examine how trials are processed when run in parallel with Stop nodes.

  1. Trial set begins.

  2. Start cycle.

    1. Run pre-cycle script.

    2. Run all trials in numerical order for this cycle until each trial reaches either a Terminal node or a Stop node.

    3. Run stop-cycle script.

    4. Finish cycle for each trial held at a Stop node until they all reach a Terminal node.

    5. Run post-cycle script.

  3. Repeat Step 2 for all cycles.

  4. Trial set is complete.

  5. Generate reports by trial and by trial set.

Note that a trial who already has a resource will not wait at a Stop node. Instead he/she will continue through a patient pathway to a Terminal node. Along the way, the trial may or may not release the resource.

Other trials who do not need a resource will also continue through a patient pathway to a Terminal node. However, those trials who reach a Stop node will not immediately continue to the end of the cycle. Instead, they will wait until other trials finish the cycle. Finally, all the trials waiting for the resource will run from the Stop node to a terminal node to complete the cycle.

Pre-cycle, mid-cycle and post-cycle scripts facilitate complex logic within the model. These will be discussed later.

The figure below shows the first Stop node in the model which is in the Healthy state. This represents one of two Stop nodes in the model that both control access to the same treatment resource.

When it is time to continue on from the Stop node, all resources that will be released this cycle have been released. Trials will be given the resource until there are no more resources available.

The Stop node then functions like a Logic node, with logical expressions under its branches. Those logical expressions will drive the next step in the patient pathway. In this model, the logical expressions reference a Global Tracker to determine if there is a resource available. The expression GlobaltrkGet("gt_AvailableResources") > 0 will only be true if there is a resource available, sending the trial to the In Treatment, Holding Resource health state.

We will discuss Global Trackers in the next Section.