Here we give several MiniZinc examples. For each one, we provide a problem description, a model, one or more data files, and one or more solutions provided by our implementation.
A Golomb ruler may be defined as a set of m integers 0 = a1 < a2 < … < am such that the m(m-1)/2 differences aj - ai, 1 ≤ i < j ≤ m are distinct. Such a ruler is said to contain m marks and is of length am. The objective is to find optimal (minimum length) or near optimal rulers.
| Model file | Data files | Solutions |
|---|---|---|
| golomb.mzn |
Example from the MiniZinc paper: n×n job shop scheduling in MiniZinc.
| Model file | Data files | Solutions |
|---|---|---|
| jobshop_nxn.mzn |
Langford's Problem (CSPlib problem 24). Instance L(k,n): Arrange k sets of numbers 1 to n so that each appearance of the number m is m numbers on from the last. For example, the L(3,9) problem is to arrange 3 sets of the numbers 1 to 9 so that the first two 1's and the second two 1's appear one number apart, the first two 2's and the second two 2's appear two numbers apart, etc.
| Model file | Data files | Solutions |
|---|---|---|
| langford.mzn |
Classic OR problem: Find the minimum cost flow in a network, while satisfying the demands in the nodes, and not violating the capacities of the arcs.
| Model file | Data files | Solutions |
|---|---|---|
| min_cost_flow.mzn |
The classical 0/1 multidimensional knapsack problem. There is a knapsack with m different capacity constraints. There are n items with profits and weights. The goal is to maximise the total profit of the items in the knapsack while not violating any of the capacity constraints.
| Model file | Data files | Solutions |
|---|---|---|
| multidimknapsack_simple.mzn |
Rectangular Scheduling Problem. J jobs have to be performed using M machines with the objective of minimising the total makespan.
| Model file | Data files | Solutions |
|---|---|---|
| oss.mzn |
Perfect squares: find a set of integers the sum of whose squares is itself a square.
| Model file | Data files | Solutions |
|---|---|---|
| perfsq.mzn |
A group of N people wants to take a group photo. Each person can give P preferences next to whom he or she wants to be placed in the photo. The problem to be solved is to find a placement that satisfies as many preferences as possible.
| Model file | Data files | Solutions |
|---|---|---|
| photo.mzn |
Product example from the OPL book.
| Model file | Data files | Solutions |
|---|---|---|
| product.mzn |
Place N queens on a N x N chess board such that none of the queens can attack each other.
| Model file | Data files | Solutions |
|---|---|---|
|
queen_cp2.mzn (CP version) |
||
| queen_ip.mzn (IP version) |
MiniZinc model of one-hoist scheduling. Robert Rodosek and Mark Wallace. A Generic Model and Hybrid Algorithm for Hoist Scheduling Problems. In Michael J. Maher and Jean-Francois Puget eds. Principles and Practice of Constraint Programming - CP98, Springer, Lecture Notes in Computer Science, volume 1520, 1998.
| Model file | Data files | Solutions |
|---|---|---|
| singHoist2.mzn |
Simple sudoku for squares of arbitrary size N = S2.
| Model file | Data files | Solutions |
|---|---|---|
| sudoku.mzn | S = 3 | S = 3 |
Also known as "Einstein's puzzle". For details see the comment at the top of the model file. There is no separate data file for this problem because it is formulated in such a way that the model and data cannot be easily separated.
| Model file | Data files | Solutions |
|---|---|---|
| zebra.mzn | N/A |
zebra.soln |