for veh_id in self.sorted_ids]
// divide the values by the maximum attainable speed
normalized_vel = np.array(vel) / max_speed
normalized_pos = []
for i in range(len(pos)):
if edge[i] == 0:
// positions of vehicles in the ring are divided by the length
// of the ring
normalized_pos.append(pos[i])
elif edge[i] == 1:
// positions of vehicles in the merge are divided by the length
// of the merge
normalized_pos.append(pos[i])
state = np.array([normalized_vel, normalized_pos, edge, is_rl]).T
return state
def sort_by_position(self):
See parent class
After Change
positions on the edge, for each vehicle.
vel = self.vehicles.get_speed(self.sorted_ids)
pos = [self.get_x_by_id(veh_id) for veh_id in self.sorted_ids]
// is_rl = [int(veh_id in self.rl_ids) for veh_id in self.sorted_ids]
// // normalize the speed