Expand description
Simulate a fast food restaurant.
This is an example of how GWR can be used to simulate time-based, event-driven systems. In this case, we choose to simulate a fast- food restaurant with some tills and a kitchen in order understand what might produce the most profitable staffing balance.
This example simulates customers that arrive throughout the day. They decide whether to join the queue, place orders and then wait, collect their food and leave. It tracks costs vs income in order to understand the impact of the staffing decisions on profitability.
§Overview
The code is structured into a library that models a restaurant and two applications that use the library.
The main files in the restaurant model are:
src/lib/customer.rsgenerates demand and tracks customer lifecycles.src/lib/staff.rsmodels till and kitchen workers as concurrent async processes.src/lib/menu.rsdefines order templates, preparation time, and economics.
The two applications using the library are:
- The
sim-restaurantis a command-line application that runs a sweep of staffing configurations in order to determine the most profitable. - The
sim-restaurant-tuiallows the user to explore a single staffing configuration in more detail.
§sim-restaurant
The following command runs the restaurant simulation in order to sweep for
the most profitable staffing configuration. Running with the
--help argument will give full list of available configuration parameters.
cargo run --bin sim-restaurant --release -- --max-till-staff 4 --max-kitchen-staff 5§sim-restaurant-tui
sim-restaurant-tui is useful when you want to explore a single staffing
configuration. For example:
cargo run --bin sim-restaurant-tui --release -- --till-staff 2 --kitchen-staff 3This replays one scenario letting you plot and dynamically explore:
- Till and kitchen queue lengths.
- Busy till and kitchen workers.
- Profit vs costs.
The controls are all detailed in the TUI window itself.