Kalaivani-g/NEW_RL_ENVIRONMENT
0
๐๏ธ 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
pip install -r requirements.txtโถ๏ธ Run the Environment
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
