|
63 | 63 | #define CONTROL_AGENTS 1 |
64 | 64 | #define CONTROL_WOSAC 2 |
65 | 65 | #define CONTROL_SDC_ONLY 3 |
| 66 | +#define CONTROL_NONE 4 // All agents follow log trajectories; policy output is ignored |
66 | 67 |
|
67 | 68 | // Simulation modes |
68 | 69 | #define SIMULATION_GIGAFLOW 0 |
@@ -3218,7 +3219,7 @@ void set_active_agents(Drive *env) { |
3218 | 3219 | } |
3219 | 3220 |
|
3220 | 3221 | // In REPLAY mode, determine which agents to control |
3221 | | - bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY); |
| 3222 | + bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY || env->control_mode == CONTROL_NONE); |
3222 | 3223 | // In log-replay mode, no cap on actors |
3223 | 3224 | int max_agents = is_log_replay ? env->num_total_agents : env->num_max_agents; |
3224 | 3225 |
|
@@ -3307,7 +3308,7 @@ void move_expert(Drive *env, float *actions, int agent_idx) { |
3307 | 3308 | return; |
3308 | 3309 | } |
3309 | 3310 |
|
3310 | | - bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY); |
| 3311 | + bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY || env->control_mode == CONTROL_NONE); |
3311 | 3312 |
|
3312 | 3313 | Agent *agent = &env->agents[agent_idx]; |
3313 | 3314 | int t = env->timestep; |
@@ -5076,13 +5077,16 @@ void c_step(Drive *env) { |
5076 | 5077 | int expert_idx = env->expert_static_agent_indices[i]; |
5077 | 5078 | move_expert(env, env->actions, expert_idx); |
5078 | 5079 | } |
5079 | | - // Move active agents with policy actions |
| 5080 | + // Move active agents with policy actions (or expert log if CONTROL_NONE) |
5080 | 5081 | for (int i = 0; i < env->active_agent_count; i++) { |
5081 | 5082 | env->logs[i].score = 0.0f; |
5082 | 5083 | env->logs[i].episode_length += 1; |
5083 | 5084 | int agent_idx = env->active_agent_indices[i]; |
5084 | | - move_dynamics(env, i, agent_idx); |
5085 | | - // move_expert(env, env->actions, agent_idx); |
| 5085 | + if (env->control_mode == CONTROL_NONE) { |
| 5086 | + move_expert(env, env->actions, agent_idx); |
| 5087 | + } else { |
| 5088 | + move_dynamics(env, i, agent_idx); |
| 5089 | + } |
5086 | 5090 | } |
5087 | 5091 |
|
5088 | 5092 | // -> 2. Compute metrics and rewards |
|
0 commit comments