Why a comparison?
Summarizes the differences between CP and MP.
CP works with the same concepts as mathematical programming: decision variables, objective function, and constraints. However, there are some differences between CP models and MP models.
In short:
CP models have only discrete decision variables (integer or Boolean) while MP models support both discrete and continuous decision variables.
CP models natively support logical constraints as well as a full range of arithmetic expressions including modulo, integer division, or the
elementexpression which indexes an array of values by a decision variable. In contrast, MP models support only linear constraints, linearized logical constraints, or quadratic convex constraints.CP models have no limitation on the arithmetic constraints that can be set on decision variables, while an MP engine is specific to a class of problems whose solution space satisfies certain mathematical properties.
Each optimization engine uses different techniques and algorithms to find feasible solutions and optimize them.
| Feature | MP | CP |
|---|---|---|
| Relaxation | Yes | No |
| GAP measure | Yes | No |
| Optimality proof | Yes | Yes |
| Modeling limitations | Quadratic problems are limited to PSD (Positive Semi Definite) problems and Second Order Cone Programming (SOCP) problems | Discrete problems |
| Specialized constraints | No | Yes |
| Logical constraints | Yes | Yes |
| Theoretical grounds | Algebra | Graph theory and algorithmic |
| Modeler support | Yes | Yes |
| Model and run | Yes | Yes |