|
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 |
@@ -3220,7 +3221,7 @@ void set_active_agents(Drive *env) { |
3220 | 3221 | } |
3221 | 3222 |
|
3222 | 3223 | // In REPLAY mode, determine which agents to control |
3223 | | - bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY); |
| 3224 | + bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY || env->control_mode == CONTROL_NONE); |
3224 | 3225 | // In log-replay mode, no cap on actors |
3225 | 3226 | int max_agents = is_log_replay ? env->num_total_agents : env->num_max_agents; |
3226 | 3227 |
|
@@ -3309,7 +3310,7 @@ void move_expert(Drive *env, float *actions, int agent_idx) { |
3309 | 3310 | return; |
3310 | 3311 | } |
3311 | 3312 |
|
3312 | | - bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY); |
| 3313 | + bool is_log_replay = (env->control_mode == CONTROL_SDC_ONLY || env->control_mode == CONTROL_NONE); |
3313 | 3314 |
|
3314 | 3315 | Agent *agent = &env->agents[agent_idx]; |
3315 | 3316 | int t = env->timestep; |
@@ -5078,13 +5079,16 @@ void c_step(Drive *env) { |
5078 | 5079 | int expert_idx = env->expert_static_agent_indices[i]; |
5079 | 5080 | move_expert(env, env->actions, expert_idx); |
5080 | 5081 | } |
5081 | | - // Move active agents with policy actions |
| 5082 | + // Move active agents with policy actions (or expert log if CONTROL_NONE) |
5082 | 5083 | for (int i = 0; i < env->active_agent_count; i++) { |
5083 | 5084 | env->logs[i].score = 0.0f; |
5084 | 5085 | env->logs[i].episode_length += 1; |
5085 | 5086 | int agent_idx = env->active_agent_indices[i]; |
5086 | | - move_dynamics(env, i, agent_idx); |
5087 | | - // move_expert(env, env->actions, agent_idx); |
| 5087 | + if (env->control_mode == CONTROL_NONE) { |
| 5088 | + move_expert(env, env->actions, agent_idx); |
| 5089 | + } else { |
| 5090 | + move_dynamics(env, i, agent_idx); |
| 5091 | + } |
5088 | 5092 | } |
5089 | 5093 |
|
5090 | 5094 | // -> 2. Compute metrics and rewards |
|
0 commit comments