License Portal

Search
Close this search box.

Logic, Nonlinear & Constraint Programming Extensions

Explore our logic & constraint programming solver and operators, lectures, and example files.

For combinatorial or discrete optimization, AMPL has always provided the option of including integer-valued variables in algebraic objectives and constraints. This is sufficient to make good use of mixed-integer programming solvers that use a classical branch-and-bound procedure.

Optimization systems for constraint programming (CP) also use a branching or tree search, but are able to work with a much broader variety of combinatorial expressions. In exchange for this advantage, CP solvers typically forego the ability to generate the bounds and cuts that are used to great advantage to limit the search in integer programming. The CP approach thus tends to be advantageous for problems that are “highly” combinatorial, in the sense that their formulation in terms of integer variables is artificial and hard to work with, or requires a very large number of variables or constraints, or fails to yield strong bounds.

Logic, Nonlinear & Constraint Programming Extensions

For combinatorial or discrete optimization, AMPL has always provided the option of including integer-valued variables in algebraic objectives and constraints. This is sufficient to make good use of mixed-integer programming solvers that use a classical branch-and-bound procedure.

CP Solvers

Natively

Nonlinear Solvers

Natively

MIP-Based Solvers

Using the AMPL MP Library

Native or Redefined

Examples and presentation slides from INFORMS Phoenix 2012

To get started, see also our presentation slides from INFORMS Phoenix 2012, our collection of simple examples using some of the features described in this document.

Solvers

AMPL has been extended in a variety of ways to take better advantage of the strengths of constraint programming. In this document we provide a syntax and usage summary of the extended operators that are recognized by AMPL’s drivers for the following CP solvers:

IBM ILOG CP with CPLEX

To obtain a driver for the ILOG Concert Technology C++ interface to the IBM ILOG CP constraint programming optimizer and also IBM CPLEX mixed-integer programming optimizer, there are several possibilities.

Gecode

An AMPL-interfaced version of the Gecode constraint programming solver is freely available (under the MIT license) as source code and as binaries for 32-bit Linux64-bit LinuxMac OS X32-bit Windows and 64-bit Windows.

To install binaries, download and unpack the gecode.exe (Windows) or gecode (Linux, MacOS) executable file and place it in your AMPL or solver directory. Then select the Gecode solver with the command.

JaCoP

An AMPL-interfaced version of the JaCoP constraint programming solver is freely available (under the GNU Affero General Public License) as source code and as binaries for 32-bit Linux64-bit LinuxMac OS X32-bit Windows and 64-bit Windows.

To install binaries, download and unpack the zipfile corresponding to your platform, and copy all of the contained files

Operators

Several kinds of constraints useful for CP are naturally expressed by allowing variables in certain operands or arguments where only constant expressions are normally permitted. Other typical CP constraints have been made possible by adding operators to AMPL. Four classes of additions and extensions are covered specifically in this document:

Logic Operators

Basic AMPL constraints consist of numerical-valued expressions connected by <=>= or =.

Conditional Operators

AMPL already provides an if-then-else operator that returns a value that can be used in expressions:

Counting Operators

AMPL’s count operator returns the number of times that a certain constraint is satisfied.

Pairwise Operators

Various assignment and related combinatorial problems require that a collection of entities be pairwise different or disjoint. New iterated operators for these conditions make them easier to state and help to make the resulting problems easier to solve.

Need more support? Contact us.

Check out all technical documentation here.

Join the conversation on the AMPL forum.