simulation-environments
Operate built-in HighwayEnv Gymnasium environments, registration, reset-step loops, rendering, vectorization, finite-MDP helpers, and multi-agent wrappers.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- simulation-environments
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Operate built-in HighwayEnv Gymnasium environments, registration, reset-step loops, rendering, vectorization, finite-MDP helpers, and multi-agent wrappers.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/environment-workflows.md9.4 KB
- 参考文档references/gymnasium-api.md6.4 KB
- 参考文档references/rendering-vectorization-multi-agent.md7.7 KB
- 参考文档references/troubleshooting.md8.6 KB
- 脚本scripts/smoke_env_rollout.py9.6 KB
03 SKILL.md 正文
Simulation environments
Use this sub-skill when you need to instantiate and operate built-in HighwayEnv Gymnasium environments safely. It covers environment ID selection, registration, gym.make, reset/step/render lifecycles, bounded random rollouts, vectorized environments, RecordVideo, finite-MDP helper methods, and multi-agent wrapper semantics.
Route to this sub-skill for
- Choosing a built-in HighwayEnv environment ID or version.
- Fixing Gymnasium registration/name lookup problems.
- Writing short, safe reset/step loops that handle
terminatedandtruncatedcorrectly. - Updating runtime config through
gym.make(..., config=...),env.unwrapped.config, orreset(options={"config": ...}). - Rendering
rgb_arrayframes, recording short videos, or avoiding display windows. - Vectorizing HighwayEnv environments or creating them in spawned subprocesses.
- Understanding
env.unwrapped.to_finite_mdp(),simplify(),change_vehicles(),set_preferred_lane(), andset_route_at_intersection(). - Using
intersection-multi-agent-*environments andMultiAgentWrapperreturn semantics.
Route elsewhere
- Observation, action, reward, space-shape, and
info["rewards"]details: read../observations-actions-rewards/SKILL.md. - Road networks, lanes, vehicles, dynamics classes, and custom environment implementation: read
../road-vehicle-dynamics/SKILL.md. - RL training loops, Stable-Baselines3 integration, long evaluations, and benchmark reporting: read
../training-and-evaluation/SKILL.md.
References and scripts
- Read references/environment-workflows.md when selecting environment IDs/versions, registering HighwayEnv, applying config updates, or using finite-MDP and environment-copy helpers.
- Read references/gymnasium-api.md when writing production reset/step/close code, handling Gymnasium return values, seeding, spaces,
info, and safe episode loops. - Read references/rendering-vectorization-multi-agent.md when rendering frames, recording videos, vectorizing environments, spawning subprocess workers, or using multi-agent variants.
- Read references/troubleshooting.md when
gym.makecannot find an env, rendering fails or returnsNone, vector/multiprocessing fails, helper methods raise optional-dependency errors, or episodes run unexpectedly long. - Run scripts/smoke_env_rollout.py to verify that an installed HighwayEnv environment can be registered, made, reset, stepped with sampled actions, optionally rendered as
rgb_array, and summarized as JSON.
Minimal operating pattern
import gymnasium as gym
import highway_env
gym.register_envs(highway_env) # harmless when already registered
env = gym.make("highway-v0", config={"duration": 5, "vehicles_count": 10})
try:
obs, info = env.reset(seed=0)
terminated = truncated = False
while not (terminated or truncated):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
finally:
env.close()
Prefer explicit step caps for smoke checks and automation. Some scenarios can run for many decision steps, and lane-keeping-v0 relies on Gymnasium's registration time limit rather than an internal duration termination.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).