Team Ai
Apppublic

ichi-goat7/cloud-kitchen-env

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

๐Ÿณ Cloud Kitchen Scheduling Environment (OpenEnv)

๐Ÿš€ Overview

This project implements a real-world reinforcement learning environment simulating a cloud kitchen operation.

An AI agent must intelligently schedule incoming food orders to limited cooking slots (stoves), while managing:

  • โ€”โฑ๏ธ Cooking time
  • โ€”๐Ÿ“ฆ Order deadlines
  • โ€”๐Ÿ”ฅ Limited kitchen resources
  • โ€”๐Ÿ’ฐ Revenue optimization

The goal is to maximize total reward by completing high-value orders on time while avoiding inefficiencies.


๐Ÿง  Environment Design

The environment follows a standard OpenEnv-style API implemented as a FastAPI app.

Core Endpoints

  • โ€”POST /reset โ†’ Initializes the environment and returns the initial observation
  • โ€”POST /step โ†’ Executes an agent action and returns observation, reward, done, info
  • โ€”GET /state โ†’ Returns the current environment state
  • โ€”GET / โ†’ Health check (returns "Cloud Kitchen Env running ๐Ÿš€")

Core Methods (Backend)

  • โ€”reset() โ†’ Initializes environment
  • โ€”step(action) โ†’ Executes agent action
  • โ€”state() โ†’ Returns current observation

๐Ÿ”— Base URL

https://ichi-goat7-cloud-kitchen-env.hf.space


๐Ÿ”„ 1. Reset Environment

Endpoint

POST /reset

Description

Resets the environment to the initial state.

Request

No body required.

Example (PowerShell)

Invoke-RestMethod -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/reset" -Method POST

Example (curl)

curl -X POST https://ichi-goat7-cloud-kitchen-env.hf.space/reset

Response

{ "current_time": 0, "orders": [...], "slots": [...] }


โšก 2. Take a Step

Endpoint

POST /step

Description

Executes one environment step using the provided action.

Request Payload

{ "assignments": [ { "slotid": 1, "orderid": 1 } ] }

Example (PowerShell)

Invoke-RestMethod -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/step" -Method POST -Body '{"assignments":[{"slot_id":1,"order_id":1}]}' -ContentType "application/json"

Example (curl)

curl -X POST https://ichi-goat7-cloud-kitchen-env.hf.space/step \ -H "Content-Type: application/json" \ -d '{"assignments":[{"slotid":1,"orderid":1}]}'

Response

{ "observation": { "current_time": 1, "orders": [...], "slots": [...] }, "reward": 0.0, "done": false, "info": { "events": [] } }


๐Ÿ“Š 3. Get Current State

Endpoint

GET /state

Description

Returns the current environment state without modifying it.

Example (PowerShell)

Invoke-RestMethod ` -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/state"

Example (curl)

curl https://ichi-goat7-cloud-kitchen-env.hf.space/state

Response

{ "current_time": 0, "orders": [...], "slots": [...] }

โœ… Action Format Summary

{ "assignments": [ { "slotid": int, "orderid": int } ] }


๐Ÿ Example Workflow

  1. 1.POST /reset
  2. 2.POST /step (assign orders)
  3. 3.Repeat /step until "done": true

๐Ÿ“ฅ Observation Space

Each step returns:

  • โ€”current_time โ†’ Current timestep
  • โ€”orders โ†’ List of pending orders
  • โ€”slots โ†’ Current cooking slot status

๐ŸŽฎ Action Space

The agent provides assignments of order_id โ†’ slot_id

Example

python
Action(assignments=[
    Assignment(slot_id=1, order_id=2)
])

๐Ÿ”„ Design Note

Initially, the environment supported explicit manual assignment of orders to slots.

In the current version, the baseline agent automates this process using a scheduling strategy:

  • โ€”When a slot becomes free, the agent automatically selects an order
  • โ€”Orders are chosen based on Earliest Deadline First (EDF)

๐Ÿ‘‰ This reflects a more realistic system where decisions are made dynamically rather than manually.


๐ŸŽฏ Motivation

Unlike toy problems or games, this environment models a real operational challenge faced by cloud kitchens:

"How do you prioritize and schedule orders when resources are limited and deadlines matter?"

This introduces real-world complexities like:

  • โ€”Trade-offs between speed vs value
  • โ€”Resource contention (limited slots)
  • โ€”Time-sensitive decision making

๐Ÿ† Reward Function

The reward system reflects operational efficiency:

โœ… Positive Rewards

  • โ€”Full reward โ†’ Order completed before deadline
  • โ€”Partial reward โ†’ Order completed slightly late

โŒ Penalties

  • โ€”Late completion โ†’ Reduced or negative reward
  • โ€”Idle cooking slot โ†’ Penalty (unused resource)

๐Ÿ‘‰ This encourages the agent to keep slots busy and prioritize timely deliveries


๐Ÿ“Š Tasks & Difficulty Levels

We define 3 tasks with increasing difficulty:

TaskDescription
๐ŸŸข EasySufficient resources, relaxed constraints
๐ŸŸก MediumTighter deadlines, fewer slots
๐Ÿ”ด HardHigh pressure, extra orders, strict deadlines

Interpretation

  • โ€”Agent performs well in simple settings
  • โ€”Performance drops under constraints
  • โ€”Demonstrates increasing task complexity

โœ… Key Features

  • โ€”โœ” Real-world task (cloud kitchen scheduling)
  • โ€”โœ” OpenEnv-compatible API
  • โ€”โœ” Typed models using Pydantic
  • โ€”โœ” Multi-task evaluation system
  • โ€”โœ” Continuous reward shaping
  • โ€”โœ” Reproducible baseline results
  • โ€”โœ” Dockerized for deployment

โš™๏ธ Setup Instructions

1. Clone Repository

bash
git clone https://github.com/KumoDrift/CLoudKitchenEnv-pytorch-hackathon
cd cloud-kitchen-env

2. Install Dependencies

bash
pip install -r requirements.txt

โ–ถ๏ธ Run Inference

bash
python inference.py

๐Ÿณ Docker Support

Build and run:

bash
docker build -t cloud-kitchen-env .
docker run -p 7860:7860 cloud-kitchen-env

๐Ÿ‘จโ€๐Ÿ’ป Author

KumoDrift Cloud Kitchen RL Environment Project