Class NonTransitiveDice

java.lang.Object
org.jacop.examples.fd.ExampleFD
org.jacop.examples.fd.NonTransitiveDice

public class NonTransitiveDice extends ExampleFD
It models and solves Nontransitive Dice Problem.
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 Details

    • noDices

      public int noDices
      It specifies number of dices in the problem.
    • noSides

      public int noSides
      It specifies number of sides for each dice in the problem.
    • currentBest

      public int currentBest
      It 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

      public List<Constraint> shavingConstraints
      It contains constraints which can be used for shaving guidance.
    • reuseOfNumbers

      public boolean reuseOfNumbers
      If 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.
      Specified by:
      model in class ExampleFD
    • 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

      public static void main(String[] args)
      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.