CoolFace
Apppublic

Kalaivani-g/NEW_RL_ENVIRONMENT

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

๐ŸŽŸ๏ธ Ticket Booking RL Environment (OpenEnv)

๐Ÿš€ Overview

This project implements a Reinforcement Learning (RL) environment for a ticket booking system using the OpenEnv framework.

The environment simulates real-world challenges such as:

  • โ€”Limited seat allocation
  • โ€”Payment failures
  • โ€”Waitlist handling
  • โ€”Cancellation & reallocation
  • โ€”Priority-based booking

๐ŸŽฏ Objectives

  • โ€”Design a realistic RL environment
  • โ€”Ensure correct runtime behavior
  • โ€”Follow OpenEnv interface standards
  • โ€”Provide clear grading logic
  • โ€”Enable interpretable agent decisions

๐Ÿง  Features

โœ… Core Booking Logic

  • โ€”Seat allocation under constraints
  • โ€”Waitlist system
  • โ€”Partial seat allocation
  • โ€”Cancellation & reallocation

๐Ÿ’ณ Payment Handling

  • โ€”Payment success / failure
  • โ€”Retry payment
  • โ€”Refund handling
  • โ€”Edge case: payment deducted but failed

๐Ÿ”ฅ Intelligence Layer

  • โ€”Priority-based allocation
  • โ€”Smart agent decision making
  • โ€”Handles conflicting requests

โญ Explainability (Important)

Each step includes a reason field:

reason=Seats allocated successfully
reason=Payment retried successfully
reason=Already in waitlist

๐Ÿ—๏ธ Project Structure

ticket_env/
โ”‚
โ”œโ”€โ”€ env.py
โ”œโ”€โ”€ grader.py
โ”œโ”€โ”€ inference.py
โ”œโ”€โ”€ openenv.yaml
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”‚
โ””โ”€โ”€ tasks/
    โ”œโ”€โ”€ easy.py
    โ”œโ”€โ”€ medium.py
    โ”œโ”€โ”€ hard.py

โš™๏ธ Installation

bash
pip install -r requirements.txt

โ–ถ๏ธ Run the Environment

bash
python inference.py

๐Ÿ“Š Sample Output

[START] task=easy env=ticket_env model=baseline

[STEP] step=1 action={"action_type": "allocate", "user_id": "U1", "seats": 1} reward=0.45 done=false error=null reason=Seats allocated successfully

[STEP] step=2 action={"action_type": "allocate", "user_id": "U2", "seats": 1} reward=0.50 done=false error=null reason=Seats allocated successfully

[STEP] step=3 action={"action_type": "waitlist", "user_id": "U1", "seats": 0} reward=0.20 done=false error=null reason=Already in waitlist

[END] success=true steps=5 score=0.40 rewards=0.45,0.50,0.20,0.20,0.00

๐Ÿงช Tasks

Easy

  • โ€”All users have successful payments
  • โ€”Goal: efficient allocation

Medium

  • โ€”Includes failed payments
  • โ€”Requires retry + allocation strategy

Hard

  • โ€”Multiple users + limited seats
  • โ€”Requires prioritization + smart allocation

๐Ÿ“ˆ Grading Logic

The environment evaluates performance using:

  • โ€”Allocation correctness (40%)
  • โ€”Payment handling (30%)
  • โ€”Efficiency (30%)

Score is normalized between 0 and 1.


๐ŸŒ Demo

๐Ÿ‘‰ Hugging Face Space (UI Demo):

  • โ€”link coming soon *

๐Ÿ’ป GitHub Repository

๐Ÿ‘‰ GitHub link coming soon


๐Ÿง  Tech Stack

  • โ€”Python
  • โ€”OpenEnv
  • โ€”Gradio (for demo UI)

๐Ÿ Conclusion

This project demonstrates:

  • โ€”A fully functional RL environment
  • โ€”Real-world scenario modeling
  • โ€”Clear evaluation metrics
  • โ€”Explainable agent behavior

๐Ÿ™Œ Author

Kalaivani G Kamalee S Abirami M