This repository implements an MIQP-based contingency planner for autonomous driving under uncertainty. The planner maintains multiple candidate trajectories that share an initial segment and branch later to cover different possible evolutions of the driving environment. Unlike heuristic methods, the branching time is optimized as a decision variable within a receding-horizon framework.
The codebase targets Python 3.10 and has been tested on Ubuntu 20.04. We recommend using Anaconda to manage the environment so you can always return to a clean setup if something goes wrong.
Create a new Conda environment with Python 3.10:
conda create -n miqp_planner python=3.10 -yIn this guide, the environment is named miqp_planner. You may choose a different name, but use it consistently in the commands below. Then activate the environment:
conda activate miqp_plannerEnsure the environment remains activated before running any project-related commands.
Clone the repository using SSH and enter the project directory:
git clone git@gitlab.lrz.de:cps/commonroad/miqp-based-contingency-planner.git
cd miqp-based-contingency-plannerThis project uses Poetry for dependency management. Install Poetry inside the activated Conda environment:
pip install poetry
poetry --versionInstall all required dependencies according to the locked versions in poetry.lock, and install the project itself:
poetry installThis step may take several minutes depending on the system and network connection.
To verify that the project has been installed correctly, run:
python -c "import miqp_planner; print(miqp_planner.__file__)"If no error occurs and a valid path is printed, the installation was successful.
This project relies on optimization solvers such as Gurobi. To use these solvers, a valid academic license is required.
Gurobi academic licenses: https://www.gurobi.com/academia/academic-program-and-licenses/
After obtaining a license, install the Python interface:
conda install -c gurobi gurobimiqp-based-contingency-planner
|
├─ config
│ ├─ configuration.py # Dataclass-based configuration loader and updater
│ ├─ time_invariant_constraints.py # Time-invariant constraint definitions
│ ├─ intersection.yaml # Intersection scenario configuration
│ ├─ lane_change_mona.yaml # Lane-change (Mona) scenario configuration
│ └─ lane_change_multi.yaml # Multi-obstacle lane-change configuration
|
├─ experiments
│ ├─ visualization.py # Visualization helpers for planned trajectories
│ └─ simulator
│ ├─ opt_simulator.py # Optimization-based prediction simulator
│ ├─ sim_config.yaml # Simulator configuration
│ └─ utils.py # Simulator utility functions
|
├─ miqp_planner
│ ├─ miqp_planner_base.py # Base MIQP planner class and shared logic
│ ├─ miqp_long_planner.py # Longitudinal MIQP sub-planner
│ ├─ miqp_lat_planner.py # Lateral MIQP sub-planner
│ ├─ miqp_ks_planner.py # Kinematic single-track (KS) MIQP planner
│ ├─ miqp_enks_planner.py # Enhanced nonlinear KS (ENKS) MIQP planner
│ ├─ miqp_partial_planner.py # Partial MIQP planner variants
│ ├─ helper_functions.py # Reference path and helper utilities
│ ├─ safe_distance.py # Safe-distance constraint modeling
│ ├─ trajectory.py # Trajectory data structures and utilities
│ ├─ gurobi_optimizer.py # Gurobi-backed optimization routines
│ ├─ main.py # Main planner entry point
│ ├─ main_close_loop.py # Closed-loop experiment entry point
│ └─ main_multi_obs.py # Multi-obstacle experiment entry point
|
├─ scenarios # CommonRoad scenario XML files
|
├─ tests
│ └─ test_MIQP_planner.py # End-to-end MIQP planner tests
|
├─ pyproject.toml
├─ poetry.lock
├─ commonroad_style_guide.rst
├─ LICENSE.txt
└─ README.md