“It is often said that if something can be described, then it can be automated.
The problem is that describing something is a very complex matter.”

Rhetor: GenAI-Assisted MILP Modelling Environment

Rhetor is an Integrated Modelling Environment for researchers, students, and practitioners who model and solve mixed-integer linear programming (MILP) problems. It supports a subset of the Optimisation Programming Language (OPL) syntax and is built on PyOPL, a Python library for parsing and solving OPL-like mathematical programming models. Rhetor also provides optional GenAI assistance for drafting, checking, and refining mathematical models.

PyPI - Downloads PyPI - Python Version PyPI - Version PyPI - Wheel arXiv

Sudoku

Install and start Rhetor

Install:

pip install rhetor

Start Rhetor:

pyopl

To enable GenAI features, set at least one of the following environment variables before starting Rhetor:

or install and run ollama locally.

Example (macOS / bash):

export OPENAI_API_KEY="sk-..."

Alternatively, you can use rhetor in Jupyter notebook

Open In Colab

or you can use the Rhetor Skills and PyOPL MCP to integrate Rhetor with your favorite agentic workflow (e.g. Github Copilot).

Key capabilities

Supported solvers and GenAI providers

Rhetor can solve supported models with Gurobi or the SciPy/HiGHS backend. Optional GenAI features support OpenAI and Google Gemini through API keys, or Ollama for local models.

Documentation and examples

Rhetor embeds GenAI features that support the modelling process: features can be explored within the system in a conversational fashion. A complete user guide and examples for PyOPL are available at:

Social media posts

A selection of LinkedIn posts about Rhetor is available below.

License

Rhetor is released under the MIT License.

Citation

Rossi, R. & Prestwich, S. D. (2026).
Grammar-Aware Literate Generative Mathematical Programming with Compiler-in-the-Loop.
arXiv:2601.17670 [cs.PL].
@misc{rossi2026grammarawareliterategenerativemathematical,
            title={Grammar-Aware Literate Generative Mathematical Programming with Compiler-in-the-Loop},
            author={Roberto Rossi and Steven D. Prestwich},
            year={2026},
            eprint={2601.17670},
            archivePrefix={arXiv},
            primaryClass={cs.PL},
            url={https://arxiv.org/abs/2601.17670},
          }