Skip to content

An Efficient and Realistic Traffic Simulator with Embedded Machine Learning Models

License

Notifications You must be signed in to change notification settings

cityflow-project/CityFlowER

Repository files navigation

CityFlowER: Efficient and Realistic Traffic Simulation

Documentation Status

Build Status

CityFlowER is An Efficient and Realistic Traffic Simulator Platform with Embedded Machine Learning Models. It Can Support Multi-agent Reinforcement Learning for Various Traffic Analysis and Control Tasks.

Framework and comparison to other implementations:

Framework

This simulator introduces following features:

  • Realistic A microscopic traffic simulator which simulates the behavior of each vehicle. Any individual vehicle can be controlled by one or multiple behavior models to mimic the realistic driving scenario.
Framework
  • Efficient The embedded structure's simulation speed is much faster than API based implementation, and approximating the rule based control methods.
Framework
  • Large Scale CityFlowER support large scale simulation efficiently.
Framework
  • Simple config setting for loaded models. You could find the following implementation in src/vehicle/vehicle.cpp or src/vehicle/lanechange.cpp The code blocks to import rule based file is shown below: We also provide training example in Imitate_cityflow/*, please check it out for example of training:

    // vehicleInfo is updated out of the function
    // "PATH" is the pre-trained model path
    double Vehicle::getCarFollowSpeed(double interval) {
    
    Vehicle *leader = getLeader();
    std::vector<torch::jit::IValue> input_feature;
    auto input = torch::tensor ({leader->getSpeed(), vehicleInfo.speed ...});
    
    input_feature.push_back(input);
    static torch::jit::script::Module speedModel = torch::jit::load("PATH");
    
    at::Tensor output_speed = speedModel.forward(input_feature).toTensor();
    return output_speed.item<double>();
    }
    void SimpleLaneChange::makeSignal(double interval) {
    
    std::vector<torch::jit::IValue> input_feature;
    auto input = torch::tensor ({vehicle->engine->getCurrentTime(),...});
    input_feature.push_back(input);
    
    static torch::jit::script::Module laneModel = torch::jit::load("PATH");
    at::Tensor lane_choice = laneModel.forward(input_feature).toTensor();
    signalSend->target = lane_choice;
    }

    For large scale vehicle settings, you could also define control_config.xml and mapping the vehicle_id with assigned ML models intended to use.

    In next updated version, we will provide this detailed instructions for the defination of control_config.xml.

Release Plans

Release Checklist

  • Basic Platform Code
  • Integration with LibTorch
  • Functionality Release
    • Car Following Speed Model
    • Lane Changing Model
  • Install & Deployment guideline
  • Pre-trained model release

Featured Research and Projects Using CityFlow

Links

Citation

@inproceedings{da2024cityflower,
  title={CityFlowER: An Efficient and Realistic Traffic Simulator with Embedded Machine Learning Models},
  author={Da, Longchao and Chu, Chen and Zhang, Weinan and Wei, Hua},
  booktitle={Joint European Conference on Machine Learning and Knowledge Discovery in Databases},
  pages={368--373},
  year={2024},
  organization={Springer}
}

About

An Efficient and Realistic Traffic Simulator with Embedded Machine Learning Models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published