CoolFace
Apppublic

ace3848w34u32y/restaurant-kitchen

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

Restaurant Kitchen Simulator — OpenEnv RL Environment

A restaurant kitchen management simulation for OpenEnv. The agent acts as a kitchen manager — assigning incoming orders to cooking stations, timing preparations, and serving customers before their patience runs out.

Built for the Meta PyTorch OpenEnv Hackathon x Scaler School of Technology — Round 1.

How It Works

The kitchen has 4 stations: grill, fry, prep, and plate. Orders arrive randomly (0-2 per tick) and each order type requires a specific station. The agent needs to:

  1. 1.Assign queued orders to the correct cooking station
  2. 2.Serve orders once they're ready, before customers walk out
  3. 3.Clean dirty stations (each serve adds dirt; dirty stations burn orders)
  4. 4.Balance all of this across a 100-tick shift

Reward Logic

EventReward
Order served+1.0
Customer walked out-1.0
Order burned on dirty station-0.5
Each step-0.01 (discourages idling)

Graders

GraderDescriptionRange
service_rateserved / (served + walked_out)0.0 – 1.0
avg_wait_efficiencyServed / total arrived0.0 – 1.0
station_utilization1.0 - CV of station load0.0 – 1.0
quality_score(served - burned) / served0.0 – 1.0

Quick Start

Local dev

bash
cd restaurant-kitchen
uv sync && uv run server
uvicorn server.app:app --host 0.0.0.0 --port 8000 --reload

Health check:

bash
curl http://localhost:8000/health

Visual simulator UI:

text
http://localhost:8000/sim

Run the training demo

bash
uv run python train.py

This runs 50 episodes each of a random agent and a rule-based (greedy) agent, then compares the results. You should see the rule-based agent significantly outperform random — proof the env has a learnable signal.

Docker

bash
docker build -t restaurant-kitchen:latest -f server/Dockerfile .
docker run -d -p 8000:8000 restaurant-kitchen:latest

Deploy to Hugging Face

bash
openenv push --repo-id username/restaurant-kitchen

After deploy, open:

text
https://<your-space>.hf.space/sim

Action Space

Action TypeParametersDescription
0 (assign)orderid, stationidAssign order to station
1 (serve)order_idServe a ready order
2 (clean)station_idClean a dirty station
3 (cancel)order_idCancel a queued order

Use order_id=-1 to pick the oldest queued order automatically.

Order Types

Order TypeStationCook Time
BurgerGrill (0)3-5 ticks
FriesFry (1)2-3 ticks
SaladPrep (2)1-2 ticks
SteakGrill (0)5-7 ticks
WingsFry (1)3-4 ticks
SandwichPrep (2)2-3 ticks

Architecture

restaurant-kitchen/
├── models.py              # Pydantic: OrderItem, KitchenObservation, KitchenState
├── client.py              # WebSocket client
├── server/
│   ├── environment.py     # Core: reset(), step(), state(), graders
│   ├── app.py             # FastAPI routing
│   └── Dockerfile         # Container config
├── train.py               # Training demo (random vs greedy)
├── openenv.yaml           # Environment manifest
└── pyproject.toml         # Package config

Tech Stack

  • Python 3.11+
  • OpenEnv — RL environment framework
  • Pydantic — Type-safe models
  • FastAPI + Uvicorn — Async WebSocket server
  • Docker

Known Limitations

  • No per-order wait time tracking — the efficiency grader just measures throughput ratio, not actual average wait. Would need a redesign to track timestamps.
  • Single-process simulation — while sessions are isolated and concurrent, all env execution still runs in one server process by default. Horizontal scaling needs multi-replica deployment.
  • Single-agent only — the kitchen runs one agent making all decisions. Real kitchens have multiple chefs.
  • Fixed difficulty — no configurable parameters via openenv.yaml yet. Rush hours, order mix, and patience ranges are hardcoded.
  • HTTP API is stateless — each /reset or /step call creates a fresh environment. Full WebSocket sessions would be needed for multi-step episodes via API.

Future Work

  • [ ] Integrate with TRL's GRPOTrainer for actual RL training
  • [ ] Per-order wait time tracking for finer-grained reward signals
  • [ ] Multi-agent support (separate agents per station)
  • [ ] Configurable difficulty via openenv.yaml
  • [ ] Training with PPO/GRPO

License

MIT — Built for the Meta PyTorch OpenEnv Hackathon 2026.