Ecole: A Library for Learning Inside MILP Solvers

Antoine Prouvost, Justin Dumouchelle, Maxime Gasse, Didier Chételat, Andrea LodiarXiv 2021

Abstract

In this paper we describe Ecole (Extensible Combinatorial Optimization Learning Environments), a library to facilitate integration of machine learning in combinatorial optimization solvers. It exposes sequential decision making that must be performed in the process of solving as Markov decision processes. This means that, rather than trying to predict solutions to combinatorial optimization problems directly, Ecole allows machine learning to work in cooperation with a state-of-the-art mixed-integer linear programming solver that acts as a controllable algorithm. Ecole provides a collection of computationally efficient, ready to use learning environments, which are also easy to extend to define novel training tasks.

Introduction

Combinatorial optimization problems, such as routing, scheduling, and facility location, are ubiquitous across industries but remain computationally intensive (NP-hard). Modern solvers typically address these using Branch-and-Bound (B&B) algorithms, which rely heavily on handcrafted heuristics to navigate the search space. While there is significant interest in replacing these heuristics with machine learning (ML) models tailored to specific problem distributions, the technical integration of ML into high-performance solvers is a significant hurdle.

Solvers are generally written in C/C++ for performance, while the ML ecosystem is dominated by Python. Bridging these environments requires complex memory management and efficient data extraction to avoid bottlenecks like the Python Global Interpreter Lock (GIL). Ecole addresses this by providing a fast, extensible Python interface that exposes the internal decision-making processes of the SCIP solver as Markov Decision Processes (MDPs).

The Ecole Framework

Ecole frames the internal control problems of a solver as MDPs, adopting an interface inspired by the OpenAI Gym paradigm (reset, step). This allows researchers to apply reinforcement learning (RL) and imitation learning techniques directly to solver heuristics without managing low-level C++ APIs.

The interaction loop between the Agent and the Environment in Ecole, framing solver decisions as a Markov Decision Process.

Technical Implementation

The library is built with a C++ core using the open-source SCIP solver, with Python bindings generated via PyBind11 and Xtensor. This architecture ensures that data extraction and solver execution occur outside the Python GIL, enabling true multi-threading and zero-copy data transfers.

Users can customize their environments by defining specific observation functions, reward functions, and transition dynamics. For example, a solver's state can be represented as a bipartite graph, and the reward can be tied to the number of LP iterations performed.

Mapping of theoretical MDP components to their specific implementations and classes within the Ecole library.

Datasets and Problem Families

To support data-hungry ML algorithms, Ecole includes built-in instance generators for four classic Mixed-Integer Linear Programming (MILP) problem families:

  • Set Covering
  • Combinatorial Auctions
  • Capacitated Facility Location
  • Independent Set (using Erdos-Renyi and Barabasi-Albert random graphs)

These generators allow for the on-the-fly creation of massive, customized datasets, facilitating robust training for RL agents.

Key Insights

  • Cooperation over Replacement: Unlike approaches that attempt to predict solutions directly, Ecole uses ML to guide the solver's heuristics. This ensures that the solver maintains its mathematical guarantees of optimality while benefiting from learned decision-making.
  • Dynamic Action Spaces: Ecole adapts the Gym paradigm to handle the dynamic nature of solvers, where the set of valid actions (e.g., branching variables) changes at every node in the B&B tree.
  • Zero-Overhead Abstraction: The library demonstrates that a high-level Python API can be provided without sacrificing the raw performance of the underlying C++ solver.

Performance Results

Benchmarking confirms that Ecole meets the performance requirements for combinatorial optimization research:

  • Execution Overhead: Comparing vanilla SCIP to Ecole’s branching wrapper shows a wall-time ratio of approximately 1.0, indicating that the Python interface introduces virtually no overhead to the solving process.
  • Feature Extraction Speed: Ecole’s observation extraction (e.g., for bipartite graph features) is significantly faster than previous state-of-the-art research code, with speedups ranging from 1.5x to over 400x depending on the problem type.

Limitations and Future Work

Currently, Ecole is limited to the open-source SCIP solver, as commercial solvers like Gurobi or CPLEX do not allow the deep internal integration required for step-by-step control. Future development will focus on expanding the library to include environments for node selection and cutting plane selection, as well as introducing new metrics like primal-dual integrals and native support for parallel environments.

Summary updated

BibTeX
@misc{prouvost2021ecole,
  author = {Antoine Prouvost and Justin Dumouchelle and Maxime Gasse and Didier Chételat and Andrea Lodi},
  title = {{Ecole: A Library for Learning Inside MILP Solvers}},
  year = {2021},
  eprint = {2104.02828},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.02828},
}
Figure