Skip to content

abitpal/ajushi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F1 Strategy Gymnasium Environment

This repository contains a custom Gymnasium environment that simulates an F1 race strategy problem, allowing an agent to learn pit timing, tire selection, and pace management to minimize total race time.

Reference: we followed Gymnasium's official guide for creating custom environments. See: Gymnasium environment creation tutorial.

Install

Create and activate a Python 3.9+ environment, then install this package in editable mode:

pip install -e .

If you plan to contribute:

pip install -e .[dev]

Environment ID

The environment registers on import as:

f1_gymnasium/F1Strategy-v0

Usage

Quick smoke test to run a short race with random actions:

python examples/run_f1_env.py

Or from Python:

import gymnasium as gym
import f1_gymnasium  # ensures env is registered on import

env = gym.make(
    "f1_gymnasium/F1Strategy-v0",
    render_mode="ansi",
    total_laps=10,
    seed=42,
)
obs, info = env.reset()
done = False
while True:
    action = env.action_space.sample()
    obs, reward, terminated, truncated, info = env.step(action)
    if env.render():
        print(env.render())
    if terminated or truncated:
        break

Environment Design

  • Action space (Discrete 6): stay-normal, stay-push, stay-save, pit-soft, pit-medium, pit-hard
  • Observation: lap, stint_laps, tire_compound, tire_wear, ers, safety_car
  • Reward: negative lap time in seconds (minimize total race time)
  • Stochasticity: safety car / VSC probabilities and lap time noise

Next Steps

  • Tune tire wear and performance parameters
  • Add multi-car interactions and traffic loss models
  • Add weather dynamics and mandatory tire rules
  • Provide vectorized env wrapper for faster training

About

goated ai car racer that can navigate multi-agent environments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors