# A Note on Piecewise Affine Decision Rules for Robust, Stochastic and Data-Driven Optimization

This repository implements piecewise affine decision rules using the concept of liftings.
It provides all relevant code to reproduce the numerical results presented in the paper.

> Simon Thomä, Maximilian Schiffer, Wolfram Wiesemann. (2026).
> A Note on Piecewise Affine Decision Rules for Robust, Stochastic, and Data-Driven Optimization.
> *Operations Research*. [https://doi.org/10.1287/opre.2024.1344](https://doi.org/10.1287/opre.2024.1344)

Most of the solvers only implement the special cases needed for the numerical experiments yet.
We are happy to collaborate on making this a more general-purpose library.

## Prerequisites

- C++20 or newer is required for compiling the project.
- The project has been tested on Gurobi 11. It may be compatible with other versions, with minor modifications to `CMakeLists.txt`.
- Ensure the environment variable `GUROBI_HOME` is set to point to your Gurobi installation directory.

## Installation

1. **Clone the Repository**

   Clone the repository to your local machine using the following command:

   ```bash
   git clone [Your Repository URL]
   cd [Your Repository Name]
   ```

2. **Set Up Gurobi Environment Variable**

   Set the `GUROBI_HOME` environment variable to point to your Gurobi installation directory.
   Replace `/path/to/gurobi` with the actual path to your Gurobi installation:

    ```bash
   export GUROBI_HOME=/path/to/gurobi
   ```

3. **Create a Build Directory**
   It's a good practice to create a separate build directory:
    ```bash
   mkdir build
    cd build
   ```

4. **Configure the Project with CMake**

   Run CMake from the build directory to configure the project:

    ```bash
    cmake ..
    ```

5. **Compile the Project**

   Compile the project using the makefile generated by CMake:

    ```bash
    make
    ```

## Usage

The code of this repository is structured in three parts:
1. `src/models` contains a relatively general framework to model robust optimization and second-order cone problems.
2. `src/solver` implements all solvers compared in the numerical experiments of the paper.
3. `src/tests` implements the numeric test instances presented in the paper.

`results` contains the raw output data of the tests and `scripts` contains the R-Markdown script used to generate the plots and tables.

## Licensing

This project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details.

For more information on the MIT License, please visit [Open Source Initiative](https://opensource.org/licenses/MIT).
## Citing This Work

If you use this code in your work, please cite this repository:
```
@misc{Thomae2026CD,
  author =        {Simon Thomä, Maximilian Schiffer, Wolfram Wiesemann},
  publisher =     {Operations Research},
  title =         {A Note on Piecewise Affine Decision Rules for Robust, Stochastic, and Data-Driven Optimization},
  year =          {2026},
  doi =           {10.1287/opre.2024.1344.cd},
  note =          {Available for download at https://github.com/ORJournal/2024.1344},
}  
```
and the accompanying paper:
```
@article{Thomae2026,
  author =        {Simon Thomä, Maximilian Schiffer, Wolfram Wiesemann},
  journal =       {Operations Research},
  publisher =     {Institute for Operations Research and the Management Sciences (INFORMS)},
  title =         {A Note on Piecewise Affine Decision Rules for Robust, Stochastic, and Data-Driven Optimization},
  year =          {2026},
  doi =           {10.1287/opre.2024.1344},
}  
```

## Contact Information

For any issues, questions, or collaboration offers,
please reach out to the corresponding author of the accompanying paper.