This project provides a robust Python environment for fitting optimal Continuous Piecewise Linear (CPWL) functions to datasets in general dimensions ($n$D).
The core script formulates the fitting problem as a Mixed-Integer Linear Programming (MILP) model, allowing for precise optimization using Google's OR-Tools. It supports a variety of industry-standard solvers, including GUROBI, HiGHS, and SCIP.
Additionally, the environment includes built-in tools to visualize the resulting CPWL functions for 2D and 3D datasets.
- Python 3.10 or higher
- Git
-
Clone the repository:
git clone [https://github.com/quentinplsrd/cpwl-nd-optimization.git](https://github.com/quentinplsrd/cpwl-nd-optimization.git) cd cpwl-nd-optimization -
Create a virtual environment:
- Windows:
python -m venv .venv
- Mac/Linux:
python3 -m venv .venv
- Windows:
-
Activate the environment:
- Windows:
.venv\Scripts\activate - Mac/Linux:
source .venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
To run the main analysis script:
python src/main_script.py