Highway
Highway
Bases: EnvType
This class represents the Highway environment.
__init__(algo=Algo.DQN, algo_param={'policy': 'MlpPolicy', 'policy_kwargs': dict(net_arch=[256, 256]), 'learning_rate': 0.0005, 'buffer_size': 15000, 'learning_starts': 200, 'batch_size': 32, 'gamma': 0.8, 'train_freq': 1, 'gradient_steps': 1, 'target_update_interval': 50, 'verbose': 0, 'tensorboard_log': 'model/highway_dqn/'}, prompt={'Goal': 'Control the ego vehicle to reach a high speed without collision.', 'Observation Space': 'features include:\n - presence: Indicates whether a vehicle is present (1 if present, 0 otherwise).\n - x: Longitudinal position of the vehicle.\n - y: Lateral position of the vehicle.\n - vx: Longitudinal velocity of the vehicle.\n - vy: Lateral velocity of the vehicle.\nEvery vehicle has a line in the matrix. Number are normalized.\nObservation looks like this for 4 vehicles with the ego vehicle.\nObservation:\n[[ 1. 0.8738351 0.33333334 0.3125 0. ]\n[ 1. 0.11421007 0.33333334 -0.04992021 0. ]\n[ 1. 0.24808374 0. -0.02311555 0. ]\n[ 1. 0.35202843 0.33333334 -0.08297566 0. ]\n[ 1. 0.47324142 0.33333334 -0.03491976 0. ]]\nYou have multiple action such as :\nEach action is typically represented as an integer:\n0: Keep Lane\n1: Slow Down\n2: Speed Up\n3: Change Lane Left\n4: Change Lane Right\n'})
Initializes the Highway environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
algo
|
Algo
|
The algorithm to use. Defaults to Algo.DQN. |
DQN
|
algo_param
|
dict
|
The algorithm parameters. Defaults to { "policy": "MlpPolicy", "policy_kwargs": dict(net_arch=[256, 256]), "learning_rate": 5e-4, "buffer_size": 15000, "learning_starts": 200, "batch_size": 32, "gamma": 0.8, "train_freq": 1, "gradient_steps": 1, "target_update_interval": 50, "verbose": 0, "tensorboard_log": "model/highway_dqn/", |
{'policy': 'MlpPolicy', 'policy_kwargs': dict(net_arch=[256, 256]), 'learning_rate': 0.0005, 'buffer_size': 15000, 'learning_starts': 200, 'batch_size': 32, 'gamma': 0.8, 'train_freq': 1, 'gradient_steps': 1, 'target_update_interval': 50, 'verbose': 0, 'tensorboard_log': 'model/highway_dqn/'}
|
prompt
|
dict | str
|
The prompt to display. Defaults to { "Goal": "Control the ego vehicle to reach a high speed without collision.", [..] |
{'Goal': 'Control the ego vehicle to reach a high speed without collision.', 'Observation Space': 'features include:\n - presence: Indicates whether a vehicle is present (1 if present, 0 otherwise).\n - x: Longitudinal position of the vehicle.\n - y: Lateral position of the vehicle.\n - vx: Longitudinal velocity of the vehicle.\n - vy: Lateral velocity of the vehicle.\nEvery vehicle has a line in the matrix. Number are normalized.\nObservation looks like this for 4 vehicles with the ego vehicle.\nObservation:\n[[ 1. 0.8738351 0.33333334 0.3125 0. ]\n[ 1. 0.11421007 0.33333334 -0.04992021 0. ]\n[ 1. 0.24808374 0. -0.02311555 0. ]\n[ 1. 0.35202843 0.33333334 -0.08297566 0. ]\n[ 1. 0.47324142 0.33333334 -0.03491976 0. ]]\nYou have multiple action such as :\nEach action is typically represented as an integer:\n0: Keep Lane\n1: Slow Down\n2: Speed Up\n3: Change Lane Left\n4: Change Lane Right\n'}
|
__repr__()
Représentation of the Highway environment.
Returns:
Name | Type | Description |
---|---|---|
str |
The representation of the Highway environment. |
objective_metric(states)
function to calculate the objective metric
Parameters:
Name | Type | Description | Default |
---|---|---|---|
states
|
list
|
The states. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list[dict[str, float]]
|
The objective metric. |
success_func(env, info)
function to check if the simulation is successful or not
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Env
|
The environment. |
required |
info
|
dict
|
The info dictionary. |
required |