Jacop

 

Jacop is a fast constraint solver with powerful features for solving problems involving integers, sets of integers, and floats. The examples included here all relate to puzzles (my interest), but Jacop can of course be used more seriously. Two advantages of examples based around puzzles are that the problems are easy to understand and the coding is relatively short.

For more information on Jacop, see:

A fabulous resource for programming with constraints in many different languages and libraries is hakank's Home Page. His Jacop page is here, and he also has a page for the Scala version of Jacop.


 

1. Cryptoarithmetic

A cryptoarithmetic puzzle is typically a single math expression (often involving addition) where the digits are represented by letters. Your task is to identify the unique digit (0 to 9) that goes with each letter.

2. Logic Puzzles

This section contains a few logic grid puzzles, so named because they're best solved by drawing a grid to mark out the ways that data can be combined, and various combinations eliminated. For those of you interested in learning this approach, have a look here, here, and here.

3. Grid-based Games

The game grid, or chessboard, means that the Jacop code must deal with constraints between the cells of a 2D array. The examples below are ordered simplest to hardest, with the main difference being the number of constraints applied to the grid cells.

Aside from the listed examples, I've utilized two support files: JacopUtils.java and ValsMap.java, which offer utilities for printing search results and manipulating arrays of variables.


 

Downloads and Other Links


Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to the third-party libraries page