Package org.jacop.examples.fd
Class Golomb
- java.lang.Object
-
- org.jacop.examples.fd.ExampleFD
-
- org.jacop.examples.fd.Golomb
-
public class Golomb extends ExampleFD
It models a Golomb ruler problem.- Version:
- 4.8
Golomb ruler is a special sequence of natural numbers an example is 0 1 4 6
a sequence is a Golomb ruler if all differences are different (1-0), (4-0), (6-0), (4-1), (6-1), (6-4) 1 4 6 3 5 2 All differences above have different values A Golomb ruler is optimal if the length of it (the last mark) has the smallest possible value The presented ruler with 4 marks of length 6 is optimal
-
-
Field Summary
Fields Modifier and Type Field Description intboundIt specifies the upper bound of the optimal solution.intnoMarksIt specifies the number of marks (number of natural numbers in the sequence).java.util.List<IntVar>subsIt contains all differences between all possible pairs of marks.
-
Constructor Summary
Constructors Constructor Description Golomb()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)It executes the program which computes the optimal Golomb ruler.voidmodel()It specifies a standard way of modeling the problem.booleansearchOptimalInfo()It specifies specific search for the optimal solution search procedure, which printouts intermediate search results and shows how the search is progressing.static voidtest(java.lang.String[] args)It executes the program which first computes the optimal Golomb ruler.-
Methods inherited from class org.jacop.examples.fd.ExampleFD
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
-
-
-
-
Field Detail
-
noMarks
public int noMarks
It specifies the number of marks (number of natural numbers in the sequence).
-
bound
public int bound
It specifies the upper bound of the optimal solution.
-
subs
public java.util.List<IntVar> subs
It contains all differences between all possible pairs of marks.
-
-
Method Detail
-
model
public void model()
Description copied from class:ExampleFDIt specifies a standard way of modeling the problem.
-
searchOptimalInfo
public boolean searchOptimalInfo()
It specifies specific search for the optimal solution search procedure, which printouts intermediate search results and shows how the search is progressing.- Returns:
- true if the (optimal) solution is found, false if no solution found.
-
main
public static void main(java.lang.String[] args)
It executes the program which computes the optimal Golomb ruler.- Parameters:
args- the first argument specifies the number of marks, the second argument specifies the upper bound of the optimal solution.
-
test
public static void test(java.lang.String[] args)
It executes the program which first computes the optimal Golomb ruler. Afterwards, it computes all the optimal solutions but it does not use previously established cost of the optimal solution.- Parameters:
args- the first argument specifies the number of marks, the second argument specifies the upper bound of the optimal solution.
-
-