pip install pandas opencv-python tqdm lz4 requests
Don't install tf 2.0
pip install tensorflow==1.14
pip install ray ray[debug] ray[rllib]
On MacOS, brew install boost
is equivalent to apt install libboost-all-dev
apt update && apt-get install -y build-essential libboost-all-dev cmake
git clone --recursive https://github.com/cityflow-project/CityFlow.git
go to cityflow directory
pip install .
git clone https://github.com/openai/gym
cd gym
pip install .
gym_cityflow
文档结构遵循 gym
环境的规则,详见此处
使用前,cd
到gym_cityflow
目录,运行 pip install -e .
进行环境包的安装。否则,无法在 ray_dqn_agent.py
中直接 import gym_cityflow
ray中可以自定义环境以及神经网络模型,详见此处
Config
包含 agent_config
和 env_config
agent_config
:遵照ray
中agent/[algorithm].py
的DEFAULT_CONFIG
以及agents/trainer.py
的COMMON_CONFIG
,两者是继承关系,DEFAULT_CONFIG
继承COMMON_CONFIG
env_config
:为agent_config
字典下的一个属性,即其为大字典中的小字典,用于配置Cityflow
环境参数
Just change this part
trainer = DQNTrainer(
env=CityflowGymEnv,
config=config_agent)
and
import ray.rllib.agents.dqn as dqn
from ray.rllib.agents.dqn import DQNTrainer
into your algorithm, then it would work.
Remember: Follow the DEFAULT_CONFIG
in each algorithm and change your own configuration.
For Tensorboard, just
tensorboard --logdir = ~/ray_results
注: ray_results目录位置需根据本机位置修改, 可直接写绝对路径