Skip to content

Commit

Permalink
Initial intersection zoo integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Suarez committed Jan 15, 2025
1 parent 48647b5 commit bc8c25f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 3 additions & 1 deletion config/intersection_zoo.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[base]
package = intersection_zoo
vec = multiprocessing
env_name = sumo

[train]
total_timesteps = 500_000
total_timesteps = 50_000_000
num_workers = 8
num_envs = 8
env_batch_size = 8
14 changes: 6 additions & 8 deletions pufferlib/environments/intersection_zoo/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from pathlib import Path

import numpy as np
from env.config import IntersectionZooEnvConfig
from env.task_context import PathTaskContext
from env.environment import IntersectionZooEnv
from sumo.constants import REGULAR
from intersection_zoo import IntersectionZooEnvConfig, PathTaskContext, IntersectionZooPZEnv
from intersection_zoo.sumo.constants import REGULAR

import pufferlib.emulation
import pufferlib.environments
Expand All @@ -18,9 +16,9 @@
def env_creator(name='intersection_zoo'):
return functools.partial(make, name=name)

def make(name, penetration=0.33, temperature_humidity=68_46, render_mode='rgb_array', buf=None):
def make(name, data='salt-lake-city', penetration=0.33, temperature_humidity='68_46', render_mode='rgb_array', buf=None):
tasks = PathTaskContext(
dir='temp',
dir=Path(data),
single_approach=True,
penetration_rate=penetration,
temperature_humidity=temperature_humidity,
Expand All @@ -29,13 +27,13 @@ def make(name, penetration=0.33, temperature_humidity=68_46, render_mode='rgb_ar

env_conf = IntersectionZooEnvConfig(
task_context=tasks.sample_task(),
working_dir='temp',
working_dir=Path('temp'),
moves_emissions_models=[temperature_humidity],
fleet_reward_ratio=1,
visualize_sumo=False,
)

# Create the environment
env = IntersectionZooEnv({"intersectionzoo_env_config": env_conf})
env = IntersectionZooPZEnv({"intersectionzoo_env_config": env_conf})

return pufferlib.emulation.PettingZooPufferEnv(env=env, buf=buf)

0 comments on commit bc8c25f

Please sign in to comment.