Class PigeonHole

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

public class PigeonHole extends ExampleFD
It solves the PigeonHole problem.

The problem is how to assign n pigeons into n-1 holes in such a way that each hole holds only one pigeons. Clearly this problem is not satisfiable.

Version:
4.9
  • Field Details

    • noPigeons

      public int noPigeons
  • Constructor Details

    • PigeonHole

      public PigeonHole()
  • 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
    • modelBasic

      public void modelBasic()
      It specifies inefficient model which uses only primitive constraints.
    • main

      public static void main(String[] args)
      It executes the program to solve PigeonHole problem in two different ways. The first approach uses global constraint, the second approach uses only primitive constraints.
      Parameters:
      args - the number of pigeons.