ECLiPSe Code Samples

Overview

This is a still somewhat random collection of ECLiPSe ECLiPSe code and examples:

Simple Problems To Get Started

Cryptarithmetic
Two versions of the famous SEND+MORE=MONEY puzzle, and a more general solver for this kind of puzzle.
Magic Hexagon
Another puzzle with numbers and how to avoid symmetric solutions.
Magic Sequences
Construct magic sequences.
Magic Squares
Construct magic squares.
Golomb rulers
Construction of optimal Golomb rulers.
Zebra
Lewis Carrol's classical zebra puzzle.
Tomography
Reconstructing a pattern from sampling data.
Queens
The unavoidable N-queens problem, and a more scalable version with different search strategies.
Liars
Reasoning about the truth of statements.
Sudoku
Popular Japanese Puzzle.
Steiner triplets
A problems with sets.

Puzzle Collections

Integer Programming Puzzles
Martin Chlond's collections of puzzles, good for learning.
Enigmas
Solution to Enigmas from New Scientist magazine, mixed difficulties.
Doug Edmunds' CLP Puzzles page
Collection of zebra-style puzzles.

Harder Puzzles

Domino tiling problem
An interesting modelling exercise.
Nonograms
Solving Nonograms ( 1, 2, 3, 4, 5, 6)
Crowded chessboard
Place 51 pieces on a chessboard (results)
Non-dominating Queens
Using a boolean matrix model, and a version with symmetry breaking.

Planning and Scheduling

Jobshop Scheduling
Using propagation and heuristics to solve the Jobshop Scheduling Problem.
Warehouse location
The warehouse location problem from van Hentenryck's book.
Transport, generic version using lists or arrays
A small transportation problem, solved with lib(eplex).
Bridge
The bridge scheduling problem from van Hentenryck's book.
Square tiling
Covering a square with smaller squares of different sizes.
Golf
Scheduling players for a golf tournament (uses sets).
Rostering
Computing a staff roster (problem statement).
Crew
Small airline crew scheduling example.

Running these examples

If you have a recent version of ECLiPSe, you can compile the examples directly from this web site as follows:
?- http_client:http_compile("http://eclipse.crosscoreop.com/eclipse/examples/sendmore.pl").