Class WolfGoatCabbage

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

public class WolfGoatCabbage extends ExampleFD
A simple logic problem of transporting wolf, goat, and cabbage over the river.
Version:
4.8

We need to transfer the cabbage, the goat and the wolf from one bank of the river to the other bank. But there is only one seat available on his boat !

Furthermore, if the goat and the cabbage stay together as we are leaving on a boat, the goat will eat the cabbage. And if the wolf and the goat stay together as we are leaving, the wolf will eat the goat !

  • Field Details

    • numberInnerMoves

      public int numberInnerMoves
      It specifies number of moves allowed (one move is from one river bank to the other)
  • Constructor Details

    • WolfGoatCabbage

      public WolfGoatCabbage()
  • 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
    • main

      public static void main(String[] args)
      It executes a program which finds the optimal trip and load of the boat between the river banks so all parties survive.
      Parameters:
      args - no argument is used.