Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog post for CP ecosystem #53

Merged
merged 11 commits into from
Sep 19, 2021
74 changes: 74 additions & 0 deletions _posts/2021-09-18-cp-0-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
layout: post
title: "An update on constraint programming in JuMP"
date: 2021-09-18
categories: [releases]
permalink: /blog/constraint-programming-update/
---

_Author: Thibaut Cuvelier (@dourouc05)_

JuMP and MathOptInterface are oriented towards traditional mathematical
optimization, encompassing problem classes such as mixed-integer linear programs
and conic optimization. However, the MathOptInterface API is amenable to other
kinds of formalism, including [constraint programming](https://en.wikipedia.org/wiki/Constraint_programming).

In constrast to linear or conic programs, constraint programs typically have no
objective function, but a much wider variety of constraints that are supported.
The best-known constraint is probably `all_different`, which models the fact
that several integer-valued variables should take different values (i.e., no two
variables are allowed to have the same value). However, there are a range of
other constraint types, with a focus on describing combinatorial structures.
Efficient solvers have been written for constraint programs.

There are a few tools for constraint programming outside the Julia ecosystem.
The most popular are [MiniZinc](https://www.minizinc.org) and
[OR-Tools](https://developers.google.com/optimization).

The goal of the [ConstraintProgrammingExtensions.jl](https://github.com/dourouc05/ConstraintProgrammingExtensions.jl)
package is to bring first-class support for constraint programming to JuMP and
MathOptInterface.

Discussions about constraint programming support in the JuMP ecosystem started
[in 2019](https://github.com/jump-dev/JuMP.jl/issues/2014). The original scope
was quite limited, as it only planned to propose some modeling capabilities to
JuMP. However, quite soon, it morphed into a larger proposal of a full
[constraint programming environment](https://github.com/jump-dev/JuMP.jl/issues/2227),
accessible from the same API as JuMP, including wrapping various specialized
constraint programming solvers.

In the last few months, the constraint programming ecosystem in JuMP has made
tremendous progress. Highlights include:

- The v0.6 release of [ConstraintProgrammingExtensions.jl](https://github.com/dourouc05/ConstraintProgrammingExtensions.jl).
Highlights of the ConstraintProgrammingExtensions.jl package include:
* set definitions for [dozens of constraint types](http://tcuvelier.be/ConstraintProgrammingExtensions.jl/dev/reference/sets/)
* a number of [bridges](http://tcuvelier.be/ConstraintProgrammingExtensions.jl/dev/reference/bridges_sets/),
including many bridges to convert constraint programming models into
standard mixed-integer programming models
* Support for the [FlatZinc file format](https://www.minizinc.org/doc-2.5.5/en/fzn-spec.html), a standard in constraint programming
to exchange models (similar to the LP and MPS formats for linear programming)

- Interfacing several solvers through ConstraintProgrammingExtensions.jl. These
include:
* The pure-Julia [ConstraintSolver.jl](https://github.com/Wikunia/ConstraintSolver.jl/)
* The industry standard [IBM CPLEX CP Optimizer](https://github.com/dourouc05/CPLEXCP.jl/)
* The open-source [Chuffed](https://github.com/dourouc05/Chuffed.jl/)

Other pure-Julia constraint solvers have been released, but they do not yet
use ConstraintProgrammingExtensions API:
* [JuliaConstraints](https://github.com/JuliaConstraints)
* [SeaPearl](https://github.com/corail-research/SeaPearl.jl)

- A session on constraint programming talks at JuMP-dev 2021
* [The design of MiniZinc](https://www.youtube.com/watch?v=tHi0Jd7vgVA)
* [ConstraintProgrammingExtensions.jl](https://www.youtube.com/watch?v=B0lO6HdlFAw&list=PLP8iPy9hna6Q343_8sSq4f306VGLW4TLK&index=104)
* [ConstraintSolver.jl](https://www.youtube.com/watch?v=FXqQc8bi_vw&list=PLP8iPy9hna6Q343_8sSq4f306VGLW4TLK&index=101)
* [JuliaConstraints](https://www.youtube.com/watch?v=G4siuvNMj0c&list=PLP8iPy9hna6Q343_8sSq4f306VGLW4TLK&index=4)

This is the start of our journey towards constraint programming in JuMP. Although MathOptInterface and JuMP are nearing
their 1.0 release, the constraint programming ecosystem has still a long way to go.
In the near term, more modelling features should be added as extensions to JuMP and
more solvers should be made accessible. In the longer term, constraint
programming modelling will also benefit from the [next generation of nonlinear
support](https://github.com/jump-dev/MathOptInterface.jl/issues/846).