-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reset, loading vehicles, equal spacing
- Loading branch information
Showing
48 changed files
with
351 additions
and
9,592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,49 @@ | ||
import logging | ||
|
||
from cistar.envs.velocity import SimpleVelocityEnvironment | ||
from cistar.core.exp import SumoExperiment | ||
from rllab.envs.base import Env | ||
|
||
from cistar.generators.loop import CircleGenerator | ||
|
||
from cistar.envs.velocity import SimpleVelocityEnvironment | ||
from cistar.scenarios.loop.gen import CircleGenerator | ||
from cistar.scenarios.loop.loop_scenario import LoopScenario | ||
logging.basicConfig(level=logging.WARNING) | ||
|
||
num_cars = 4 | ||
|
||
num_rl = 4 | ||
num_cars = 10 | ||
num_rl = 5 | ||
|
||
sumo_params = {"port": 8873} | ||
|
||
def constant_vel(**kwargs): | ||
return 15 | ||
sumo_binary = "sumo-gui" | ||
|
||
type_controllers = {"rl": None} | ||
|
||
type_counts = {"rl": num_rl} | ||
type_params = {"rl": (num_rl, None), "slow": (5, constant_vel)} | ||
|
||
env_params = {"target_velocity": 25} | ||
|
||
initial_config = {} | ||
|
||
net_params = {"length": 200, "lanes": 1, "speed_limit":35, "resolution": 40, "net_path":"debug/net/"} | ||
|
||
type_list=["rl"] | ||
cfg_params = {"type_list": ["rl"], "start_time": 0, "end_time":3000, "cfg_path":"debug/cfg/", "num_cars":num_cars, "type_counts":{"rl": 4}, "use_flows":True, "period":"1"} | ||
|
||
scenario = LoopScenario("test-exp", num_cars, type_params, cfg_params, net_params, generator_class=CircleGenerator) | ||
|
||
##data path needs to be relative to cfg location | ||
cfg_params = {"type_list": ["rl"], "start_time": 0, "num_cars":num_cars, "end_time":3000, "cfg_path":"debug/cfg/", "type_counts":type_counts, "use_flows":True, "period":"1"} | ||
|
||
leah_sumo_params = {"port": 8873}#, "cfg":"/Users/kanaad/code/research/learning-traffic/sumo/learning-traffic/cistar-dev/debug/cfg/test-exp-200m1l.sumo.cfg"} | ||
leah_sumo_params = {"port": 8873} | ||
|
||
exp = SumoExperiment("test-exp", SimpleVelocityEnvironment, env_params, num_cars, num_rl, type_controllers, sumo_binary, leah_sumo_params, initial_config, CircleGenerator, net_params, cfg_params) | ||
exp = SumoExperiment(SimpleVelocityEnvironment, env_params, sumo_binary, sumo_params, scenario) | ||
|
||
logging.info("Experiment Set Up complete") | ||
|
||
for _ in range(50): | ||
exp.env.step([25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) | ||
exp.env.step([25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) | ||
exp.env.reset() | ||
for _ in range(20): | ||
exp.env.step([15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) | ||
exp.env.step( | ||
[25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, | ||
25, 25, 25, 25]) | ||
exp.env.reset() | ||
for _ in range(10): | ||
exp.env.step([25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) | ||
|
||
# print("resetting state") | ||
# exp.env.reset() | ||
# print("state reset") | ||
# for _ in range(20): | ||
# exp.env.step([0,0,0,0]) | ||
# print("resetting state") | ||
# exp.env.reset() | ||
# print("state reset") | ||
# for _ in range(10): | ||
# exp.env.step([20,20,20,20]) | ||
# for _ in range(30): | ||
# exp.env.step([25, 25, 25, 25]) | ||
# print("resetting state") | ||
# exp.env.reset() | ||
exp.env.step( | ||
[15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, | ||
15, 15, 15, 15]) | ||
|
||
exp.env.terminate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.