Package MAKBPInterpreter
Class MuddyChildrenProblem
- java.lang.Object
-
- MAKBPInterpreter.MuddyChildrenProblem
-
public class MuddyChildrenProblem extends java.lang.Object
Class representing the problem of muddy children. The problem is as follows:- the children go to play but the father has warned them not to get dirty;
- they come back and if one of them is dirty, the father says "at least one of you is dirty".
-
-
Constructor Summary
Constructors Constructor Description MuddyChildrenProblem()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
prettyPrintKripkeStructure(KripkeStructure structure, java.util.function.Function<java.lang.String,java.lang.String> atomPredicateExtractor)
Pretty prints a Kripke structure.static void
problem(int n, int realWorld, int maxIteration)
Generalized problem using the multi-agent knowledge-based program (MABKP) interpreter.static void
problemN2K1()
Problem with two children and one child among them is dirty (without the MAKBP interpreter).static void
problemN2K2()
Problem with two children and both are dirty (without the MAKBP interpreter).static void
problemN3K2()
Problem with three children and thow child among them are dirty (without the MAKBP interpreter).static void
problemN3K3()
Problem with three children and are all dirty (without the MAKBP interpreter).
-
-
-
Method Detail
-
prettyPrintKripkeStructure
public static java.lang.String prettyPrintKripkeStructure(KripkeStructure structure, java.util.function.Function<java.lang.String,java.lang.String> atomPredicateExtractor)
Pretty prints a Kripke structure.- Parameters:
structure
- structure to pretty printatomPredicateExtractor
- function to extract the predicate- Returns:
- worlds of the structure in prettyfied string
-
problem
public static void problem(int n, int realWorld, int maxIteration)
Generalized problem using the multi-agent knowledge-based program (MABKP) interpreter. To encode the real world, we pass a decimal number which will be then decoded in a binary number allowing to create the worlds in an automatic way. For example, if n = 4, realWorld will be between 0 and 15 included. If we choose realWorld = 13 ( = (1101)_2 ), the real world will be the world where :- agents 0, 2, 3 are dirty
- agent 1 is clean
- Parameters:
n
- number of childrenrealWorld
- real world encoded in decimalmaxIteration
- maximum number of iteration to avoid an infinite while loop- Throws:
java.lang.IllegalArgumentException
- thrown the real world can't exists
-
problemN2K1
public static void problemN2K1()
Problem with two children and one child among them is dirty (without the MAKBP interpreter).
-
problemN2K2
public static void problemN2K2()
Problem with two children and both are dirty (without the MAKBP interpreter).
-
problemN3K2
public static void problemN3K2()
Problem with three children and thow child among them are dirty (without the MAKBP interpreter).
-
problemN3K3
public static void problemN3K3()
Problem with three children and are all dirty (without the MAKBP interpreter).
-
-