Class NonTransitiveDice
- Version:
- 4.8
Nontransitive Dice problem is to assign to given number of dices a number to each side of the dice in such a way that
a) given cyclic order of dices, each dice wins with the next one with probability p larger than 0.5.
b) maximize minimum p.
c) no two dices which are matched against each other can result in draw. default approach to satisfy this condition is to require all sides of all dices to be assigned unique values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
It specifies the currently best solution which is a bound for the next solution.int
It specifies number of dices in the problem.int
It specifies number of sides for each dice in the problem.boolean
If true then faces on non consequtive faces can be the same.It contains constraints which can be used for shaving guidance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
It executes the program solving non transitive dice problem using two different methods.void
model()
It specifies a standard way of modeling the problem.boolean
It executes a specialized search to find a solution to this problem.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 Details
-
noDices
public int noDicesIt specifies number of dices in the problem. -
noSides
public int noSidesIt specifies number of sides for each dice in the problem. -
currentBest
public int currentBestIt specifies the currently best solution which is a bound for the next solution.The currentBest specifies the difference between noSides^2 and minimumWinning. Since we maximize minimumWinning we minimize currentBest. The next solution must have a lower value for currentBest. currentBest is an upperbound.
minimumWinning + currentBest = noSides^2
Good initial value for currentBest is noSides^2 / 2.
-
shavingConstraints
It contains constraints which can be used for shaving guidance. -
reuseOfNumbers
public boolean reuseOfNumbersIf true then faces on non consequtive faces can be the same.
-
-
Constructor Details
-
NonTransitiveDice
public NonTransitiveDice()
-
-
Method Details
-
model
public void model()Description copied from class:ExampleFD
It specifies a standard way of modeling the problem. -
searchSpecial
public boolean searchSpecial()It executes a specialized search to find a solution to this problem. It uses input order, indomain middle, and limit of backtracks. It prints major search statistics.- Returns:
- true if solution is found, false otherwise.
-
main
It executes the program solving non transitive dice problem using two different methods. The second method employs constraint guided shaving.- Parameters:
args
- the first argument specifies number of dices, the second argument specifies the number of sides of each dice.
-