TRY NOW!
AMPL > >Resources > >Logic Constraint Extensions: Examples

Logic Constraint Extensions: Examples

This is a preliminary set of examples to offer some starting points for experimenting with AMPL’s “logic” and constraint programming interfaces. We welcome comments for improvements or other examples that would illustrative.

Model fileRepresents
balAssign0.mod
balAssign0.dat
Integer program for assignment of people to groups so that each group is “balanced” by various criteria
balAssign1.mod
balAssign1.dat
Constraint program for balanced assignment of people to groups, using the numberof operator
mapColoring.modModel for map coloring using a not-equals constraint
nQueens0.modInteger program for the n queens problem: put n queens on an n-by-n chessboard so that no queen is attacking any other queen
nQueens.modConstraint program for the n queens problem, using the alldiff operator
openShop.mod
openShop.dat
Open-shop scheduling model using disjunctive constraints to avoid job and machine conflicts
photo.mod
photo9.dat,
photo11.dat
Line up a group of people to maximize the number of adjacency preferences satisfied, modeling with alldiff, equivalence (<==>), and strict inequality (<)
singleHoist.mod
singleHoist3.dat
singleHoist4.dat
Hoist scheduling model using disjunctive constraints
sudoku.mod
sudokuVeryEasy.dat
sudokuHard.dat
Model to solve instances of the 3 x 3 Sudoku problem, using the alldiff operator