Skip to main content
AP CSP course

F19 · Topic 3.16

Queue policy simulator

Compare capacity policies under one arrival sequence, report both served and remaining demand, and critique the model before recommending a real change.

1. Predict first

Predict remaining queue for arrivals[3,0,4,1] with capacity 2.

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to experiment
  1. Input 13,0,4,1Waiting
  2. Input 22Waiting

Ready to experiment

Why: Predict the first change, then advance one step.

Try this: Try capacity 0 and an empty arrivals list. Try a busy tick followed by zero arrivals.

2. Build your procedure

Write a simulation loop with arrivals before service. Record remaining queue after each tick, totalserved and peak end-of-tick queue.

Use AP CSP pseudocode, a language you know, or precise plain language. Your code is not executed here. Use the classroom assignment to save your response.

3. Check boundaries

Public worked tests for the fixed model
InputExpectedWhy this case
[3,0,4,1]; capacity2Queues[1,0,2,1]; served 7; peak 2Backlog carries between ticks.
[3,0,4,1]; capacity3Queues[0,0,1,0]; served 8; peak 1Controlled capacity comparison.
[0,0]; capacity2Queues[0,0]; served0No phantom customers.

4. Explain and reflect

Use the output to recommend a policy, then give one limitation that could reverse the real decision.

Model limits: A fixed discrete-time queue with arrivals before service; it does not estimate individual waiting times or actual school staffing needs.

Teacher guidance and scoring