Skip to content

Commit

Permalink
Merge pull request #607 from flow-project/v0.4.0
Browse files Browse the repository at this point in the history
final 0.4.0 commit
  • Loading branch information
AboudyKreidieh committed Jul 14, 2019
2 parents 5c5a124 + d784996 commit 0cee1b9
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 30 deletions.
5 changes: 4 additions & 1 deletion examples/rllab/stabilizing_the_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from flow.scenarios.loop import LoopScenario
from flow.controllers import RLController, IDMController, ContinuousRouter
from flow.core.params import VehicleParams
from flow.core.params import VehicleParams, SumoCarFollowingParams
from flow.core.params import SumoParams, EnvParams, NetParams, InitialConfig
from rllab.envs.gym_env import GymEnv

Expand All @@ -28,6 +28,9 @@ def run_task(*_):
vehicles.add(
veh_id="idm",
acceleration_controller=(IDMController, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0,
),
routing_controller=(ContinuousRouter, {}),
num_vehicles=21)

Expand Down
5 changes: 4 additions & 1 deletion examples/rllib/stabilizing_the_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from flow.utils.registry import make_create_env
from flow.utils.rllib import FlowParamsEncoder
from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams
from flow.core.params import VehicleParams
from flow.core.params import VehicleParams, SumoCarFollowingParams
from flow.controllers import RLController, IDMController, ContinuousRouter

# time horizon of a single rollout
Expand All @@ -34,6 +34,9 @@
acceleration_controller=(IDMController, {
"noise": 0.2
}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
routing_controller=(ContinuousRouter, {}),
num_vehicles=21)
vehicles.add(
Expand Down
5 changes: 4 additions & 1 deletion examples/sumo/sugiyama.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from flow.controllers import IDMController, ContinuousRouter
from flow.core.experiment import Experiment
from flow.core.params import SumoParams, EnvParams, \
InitialConfig, NetParams
InitialConfig, NetParams, SumoCarFollowingParams
from flow.core.params import VehicleParams
from flow.envs.loop.loop_accel import AccelEnv, ADDITIONAL_ENV_PARAMS
from flow.scenarios.loop import LoopScenario, ADDITIONAL_NET_PARAMS
Expand Down Expand Up @@ -36,6 +36,9 @@ def sugiyama_example(render=None):
vehicles.add(
veh_id="idm",
acceleration_controller=(IDMController, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
routing_controller=(ContinuousRouter, {}),
num_vehicles=22)

Expand Down
6 changes: 0 additions & 6 deletions flow/core/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,6 @@ def add(self,
type_params.update(car_following_params.controller_params)
type_params.update(lane_change_params.controller_params)

# If a vehicle is not sumo or RL, let the minGap be zero so that it
# does not tamper with the dynamics of the controller
if acceleration_controller[0] != SimCarFollowingController \
and acceleration_controller[0] != RLController:
type_params["minGap"] = 0.0

# This dict will be used when trying to introduce new vehicles into
# the network via a Flow. It is passed to the vehicle kernel object
# during environment instantiation.
Expand Down
2 changes: 1 addition & 1 deletion flow/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Specifies the current version number of Flow."""

__version__ = "0.4.0.dev"
__version__ = "0.4.0"
2 changes: 1 addition & 1 deletion scripts/setup_sumo_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ brew install Caskroom/cask/xquartz autoconf automake pkg-config libtool gdal pro
echo "Installing sumo binaries"
mkdir -p $HOME/sumo_binaries/bin
pushd $HOME/sumo_binaries/bin
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.3.1/binaries-mac.tar.xz
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/binaries-mac.tar.xz
tar -xf binaries-mac.tar.xz
rm binaries-mac.tar.xz
chmod +x *
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_sumo_ubuntu1404.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sudo apt-get install -y libfox-1.6-dev
echo "Installing sumo binaries"
mkdir -p $HOME/sumo_binaries/bin
pushd $HOME/sumo_binaries/bin
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.3.1/binaries-ubuntu1404.tar.xz
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/binaries-ubuntu1404.tar.xz
tar -xf binaries-ubuntu1404.tar.xz
rm binaries-ubuntu1404.tar.xz
chmod +x *
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_sumo_ubuntu1604.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sudo pip3 install cmake cython
echo "Installing sumo binaries"
mkdir -p $HOME/sumo_binaries/bin
pushd $HOME/sumo_binaries/bin
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.3.1/binaries-ubuntu1604.tar.xz
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/binaries-ubuntu1604.tar.xz
tar -xf binaries-ubuntu1604.tar.xz
rm binaries-ubuntu1604.tar.xz
chmod +x *
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_sumo_ubuntu1804.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sudo pip3 install cmake cython
echo "Installing sumo binaries"
mkdir -p $HOME/sumo_binaries/bin
pushd $HOME/sumo_binaries/bin
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.3.1/binaries-ubuntu1804.tar.xz
wget https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/binaries-ubuntu1804.tar.xz
tar -xf binaries-ubuntu1804.tar.xz
rm binaries-ubuntu1804.tar.xz
chmod +x *
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def run(self):
"""Install traci wheels."""
subprocess.check_call(
['pip', 'install',
'https://akreidieh.s3.amazonaws.com/sumo/flow-0.3.1/'
'sumotools-0.3.1-py3-none-any.whl'])
'https://akreidieh.s3.amazonaws.com/sumo/flow-0.4.0/'
'sumotools-0.4.0-py3-none-any.whl'])


class BinaryDistribution(Distribution):
Expand Down
16 changes: 16 additions & 0 deletions tests/fast_tests/test_scenario_base_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from flow.core.params import VehicleParams
from flow.core.params import EnvParams
from flow.core.params import SumoParams
from flow.core.params import SumoCarFollowingParams
from flow.scenarios.loop import LoopScenario, ADDITIONAL_NET_PARAMS
from flow.envs import TestEnv
from flow.scenarios import Scenario
Expand Down Expand Up @@ -121,6 +122,9 @@ def setUp_gen_start_pos(self, initial_config=InitialConfig()):
veh_id="test",
acceleration_controller=(IDMController, {}),
routing_controller=(ContinuousRouter, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
num_vehicles=15)

# create the environment and scenario classes for a ring road
Expand Down Expand Up @@ -441,6 +445,9 @@ def setUp(self):
veh_id="test",
acceleration_controller=(IDMController, {}),
routing_controller=(ContinuousRouter, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
num_vehicles=15)

initial_config = InitialConfig(x0=150)
Expand Down Expand Up @@ -514,6 +521,9 @@ def setUp_gen_start_pos(self, initial_config=InitialConfig()):
veh_id="test",
acceleration_controller=(IDMController, {}),
routing_controller=(ContinuousRouter, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
num_vehicles=5)

# create the environment and scenario classes for a ring road
Expand Down Expand Up @@ -590,6 +600,9 @@ def setUp(self):
veh_id="test",
acceleration_controller=(IDMController, {}),
routing_controller=(ContinuousRouter, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
num_vehicles=50)

initial_config = InitialConfig(lanes_distribution=5)
Expand Down Expand Up @@ -622,6 +635,9 @@ def setUp(self):
veh_id="test",
acceleration_controller=(IDMController, {}),
routing_controller=(ContinuousRouter, {}),
car_following_params=SumoCarFollowingParams(
min_gap=0
),
num_vehicles=50)

initial_config = InitialConfig(spacing="random", lanes_distribution=5)
Expand Down
14 changes: 0 additions & 14 deletions tests/fast_tests/test_vehicles.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,6 @@ def test_controlled_id_params(self):
Ensure that, if a vehicle is not a sumo vehicle, then minGap is set to
zero so that all headway values are correct.
"""
# check that, if the vehicle is not a SimCarFollowingController
# vehicle, then its minGap is equal to 0
vehicles = VehicleParams()
vehicles.add(
"typeA",
acceleration_controller=(IDMController, {}),
car_following_params=SumoCarFollowingParams(
speed_mode="obey_safe_speed",
),
lane_change_params=SumoLaneChangeParams(
lane_change_mode="no_lat_collide",
))
self.assertEqual(vehicles.types[0]["type_params"]["minGap"], 0)

# check that, if the vehicle is a SimCarFollowingController vehicle,
# then its minGap, accel, and decel are set to default
vehicles = VehicleParams()
Expand Down

0 comments on commit 0cee1b9

Please sign in to comment.