Class Tree
Description Description
===========

A golomb ruler is an assignment of marks to integer positions along a ruler so that no pair of two marks is the same distance from each other. The number of marks is the order of the ruler. The first mark is required to be at position 0, the position of the highest mark is the length of the ruler. The problem is finding the shortest ruler of a given order that contains a given distance between two marks. Also compare: http://en.wikipedia.org/wiki/Golomb_ruler

Input
-----

A number of marks, given as a range of consecutive, ascending integers, starting at 1.

A number of positions, given as a range of consecutive, ascending integers, starting at 0.

A length needed between the locations of precisely two marks.

For example:

mark(1). mark(2). position(0). position(1). position(2). position(3). position(4). lengthNeeded(2).

Output
------

The initial facts and a location fact for each mark giving it's position on the ruler. The optimisation criteria is the length of the ruler. Continuing the above example:

mark(1) mark(2) position(0) position(1) position(2) position(3) position(4) lengthNeeded(2) location(1,0) location(2,2) Optimization: 2

is the optimal solution.

Author: Martin Brain
Encodings
1 - 1 of 1