Skip to content

Commit

Permalink
New visualization tutorial (#635)
Browse files Browse the repository at this point in the history
* start rewriting tuto5

* new visualization tutorial

* Add example to visualization tutorial

* Print path where emission file is generated

* Add trained ring policy for visualization tutorial

* Display path of CSV emission file generated by --gen-emission

* Rename section

* removed rllab, added updated trained policy
  • Loading branch information
nathanlct authored and AboudyKreidieh committed Oct 15, 2019
1 parent 054d393 commit 4a27159
Show file tree
Hide file tree
Showing 26 changed files with 757 additions and 35 deletions.
4 changes: 4 additions & 0 deletions flow/visualize/visualizer_rllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ def visualizer_rllib(args):
# convert the emission file into a csv file
emission_to_csv(emission_path)

# print the location of the emission csv file
emission_path_csv = emission_path[:-4] + ".csv"
print("\nGenerated emission file at " + emission_path_csv)

# delete the .xml version of the emission file
os.remove(emission_path)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
125 changes: 125 additions & 0 deletions tutorials/data/trained_ring/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"batch_mode": "truncate_episodes",
"callbacks": {
"on_episode_end": null,
"on_episode_start": null,
"on_episode_step": null,
"on_postprocess_traj": null,
"on_sample_end": null,
"on_train_result": null
},
"clip_actions": false,
"clip_param": 0.3,
"clip_rewards": null,
"collect_metrics_timeout": 180,
"compress_observations": false,
"custom_resources_per_worker": {},
"entropy_coeff": 0.0,
"entropy_coeff_schedule": null,
"env": "WaveAttenuationPOEnv-v0",
"env_config": {
"flow_params": "{\n \"env\": {\n \"additional_params\": {\n \"max_accel\": 1,\n \"max_decel\": 1,\n \"ring_length\": [\n 220,\n 270\n ]\n },\n \"clip_actions\": false,\n \"evaluate\": false,\n \"horizon\": 3000,\n \"sims_per_step\": 1,\n \"warmup_steps\": 750\n },\n \"env_name\": \"flow.envs.ring.wave_attenuation.WaveAttenuationPOEnv\",\n \"exp_tag\": \"stabilizing_the_ring\",\n \"initial\": {\n \"additional_params\": {},\n \"bunching\": 0,\n \"edges_distribution\": \"all\",\n \"lanes_distribution\": Infinity,\n \"min_gap\": 0,\n \"perturbation\": 0.0,\n \"shuffle\": false,\n \"spacing\": \"uniform\",\n \"x0\": 0\n },\n \"net\": {\n \"additional_params\": {\n \"lanes\": 1,\n \"length\": 260,\n \"resolution\": 40,\n \"speed_limit\": 30\n },\n \"inflows\": {\n \"_InFlows__flows\": []\n },\n \"osm_path\": null,\n \"template\": null\n },\n \"network\": \"flow.networks.ring.RingNetwork\",\n \"sim\": {\n \"color_vehicles\": true,\n \"emission_path\": null,\n \"lateral_resolution\": null,\n \"no_step_log\": true,\n \"num_clients\": 1,\n \"overtake_right\": false,\n \"port\": null,\n \"print_warnings\": true,\n \"pxpm\": 2,\n \"render\": false,\n \"restart_instance\": false,\n \"save_render\": false,\n \"seed\": null,\n \"show_radius\": false,\n \"sight_radius\": 25,\n \"sim_step\": 0.1,\n \"teleport_time\": -1\n },\n \"simulator\": \"traci\",\n \"veh\": [\n {\n \"acceleration_controller\": [\n \"IDMController\",\n {\n \"noise\": 0.2\n }\n ],\n \"car_following_params\": {\n \"controller_params\": {\n \"accel\": 2.6,\n \"carFollowModel\": \"IDM\",\n \"decel\": 4.5,\n \"impatience\": 0.5,\n \"maxSpeed\": 30,\n \"minGap\": 0,\n \"sigma\": 0.5,\n \"speedDev\": 0.1,\n \"speedFactor\": 1.0,\n \"tau\": 1.0\n },\n \"speed_mode\": 25\n },\n \"initial_speed\": 0,\n \"lane_change_controller\": [\n \"SimLaneChangeController\",\n {}\n ],\n \"lane_change_params\": {\n \"controller_params\": {\n \"laneChangeModel\": \"LC2013\",\n \"lcCooperative\": \"1.0\",\n \"lcKeepRight\": \"1.0\",\n \"lcSpeedGain\": \"1.0\",\n \"lcStrategic\": \"1.0\"\n },\n \"lane_change_mode\": 512\n },\n \"num_vehicles\": 21,\n \"routing_controller\": [\n \"ContinuousRouter\",\n {}\n ],\n \"veh_id\": \"human\"\n },\n {\n \"acceleration_controller\": [\n \"RLController\",\n {}\n ],\n \"car_following_params\": {\n \"controller_params\": {\n \"accel\": 2.6,\n \"carFollowModel\": \"IDM\",\n \"decel\": 4.5,\n \"impatience\": 0.5,\n \"maxSpeed\": 30,\n \"minGap\": 2.5,\n \"sigma\": 0.5,\n \"speedDev\": 0.1,\n \"speedFactor\": 1.0,\n \"tau\": 1.0\n },\n \"speed_mode\": 25\n },\n \"initial_speed\": 0,\n \"lane_change_controller\": [\n \"SimLaneChangeController\",\n {}\n ],\n \"lane_change_params\": {\n \"controller_params\": {\n \"laneChangeModel\": \"LC2013\",\n \"lcCooperative\": \"1.0\",\n \"lcKeepRight\": \"1.0\",\n \"lcSpeedGain\": \"1.0\",\n \"lcStrategic\": \"1.0\"\n },\n \"lane_change_mode\": 512\n },\n \"num_vehicles\": 1,\n \"routing_controller\": [\n \"ContinuousRouter\",\n {}\n ],\n \"veh_id\": \"rl\"\n }\n ]\n}",
"run": "PPO"
},
"evaluation_config": {},
"evaluation_interval": null,
"evaluation_num_episodes": 10,
"gamma": 0.999,
"grad_clip": null,
"horizon": 3000,
"ignore_worker_failures": false,
"input": "sampler",
"input_evaluation": [
"is",
"wis"
],
"kl_coeff": 0.2,
"kl_target": 0.02,
"lambda": 0.97,
"local_tf_session_args": {
"inter_op_parallelism_threads": 8,
"intra_op_parallelism_threads": 8
},
"log_level": "INFO",
"log_sys_usage": true,
"lr": 5e-05,
"lr_schedule": null,
"metrics_smoothing_episodes": 100,
"min_iter_time_s": 0,
"model": {
"conv_activation": "relu",
"conv_filters": null,
"custom_model": null,
"custom_options": {},
"custom_preprocessor": null,
"dim": 84,
"fcnet_activation": "tanh",
"fcnet_hiddens": [
3,
3
],
"framestack": true,
"free_log_std": false,
"grayscale": false,
"lstm_cell_size": 256,
"lstm_use_prev_action_reward": false,
"max_seq_len": 20,
"no_final_linear": false,
"state_shape": null,
"use_lstm": false,
"vf_share_layers": true,
"zero_mean": true
},
"monitor": false,
"multiagent": {
"policies": {},
"policies_to_train": null,
"policy_mapping_fn": null
},
"num_cpus_for_driver": 1,
"num_cpus_per_worker": 1,
"num_envs_per_worker": 1,
"num_gpus": 0,
"num_gpus_per_worker": 0,
"num_sgd_iter": 10,
"num_workers": 2,
"observation_filter": "NoFilter",
"optimizer": {},
"output": null,
"output_compress_columns": [
"obs",
"new_obs"
],
"output_max_file_size": 67108864,
"postprocess_inputs": false,
"preprocessor_pref": "deepmind",
"remote_env_batch_wait_ms": 0,
"remote_worker_envs": false,
"sample_async": false,
"sample_batch_size": 200,
"seed": null,
"sgd_minibatch_size": 128,
"shuffle_buffer_size": 0,
"shuffle_sequences": true,
"simple_optimizer": false,
"soft_horizon": false,
"synchronize_filters": true,
"tf_session_args": {
"allow_soft_placement": true,
"device_count": {
"CPU": 1
},
"gpu_options": {
"allow_growth": true
},
"inter_op_parallelism_threads": 2,
"intra_op_parallelism_threads": 2,
"log_device_placement": false
},
"timesteps_per_iteration": 0,
"train_batch_size": 60000,
"use_gae": true,
"vf_clip_param": 10.0,
"vf_loss_coeff": 1.0,
"vf_share_layers": false
}
Binary file added tutorials/data/trained_ring/params.pkl
Binary file not shown.

0 comments on commit 4a27159

Please sign in to comment.