From 6764c7faa4dccaf480997ea6d3a095b6c243ab54 Mon Sep 17 00:00:00 2001 From: Naveen Sundar Govindarajulu Date: Fri, 15 Jun 2018 14:48:24 -0700 Subject: [PATCH] Adding in the soda can challenge. --- .../com/naveensundarg/planner/utils/Sandbox.java | 4 ++-- .../planner/problems/tora/sodacan.clj | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/com/naveensundarg/planner/problems/tora/sodacan.clj diff --git a/src/main/java/com/naveensundarg/planner/utils/Sandbox.java b/src/main/java/com/naveensundarg/planner/utils/Sandbox.java index 5cf4d1f..568a49b 100644 --- a/src/main/java/com/naveensundarg/planner/utils/Sandbox.java +++ b/src/main/java/com/naveensundarg/planner/utils/Sandbox.java @@ -42,11 +42,11 @@ public class Sandbox { public static void main(String[] args) throws com.naveensundarg.shadow.prover.utils.Reader.ParsingException { - List planningProblemList = (PlanningProblem.readFromFile(Sandbox.class.getResourceAsStream("../problems/learning/reasoning_5.clj"))); + List planningProblemList = (PlanningProblem.readFromFile(Sandbox.class.getResourceAsStream("../problems/tora/sodacan.clj"))); Planner depthFirstPlanner = new DepthFirstPlanner(); - PlanningProblem planningProblem = planningProblemList.stream().filter(problem -> problem.getName().equals("learning")).findFirst().get(); + PlanningProblem planningProblem = planningProblemList.stream().filter(problem -> problem.getName().equals("soda can challenge")).findFirst().get(); depthFirstPlanner.plan(planningProblem.getBackground(), planningProblem.getActions(), planningProblem.getStart(), planningProblem.getGoal()).ifPresent( diff --git a/src/main/resources/com/naveensundarg/planner/problems/tora/sodacan.clj b/src/main/resources/com/naveensundarg/planner/problems/tora/sodacan.clj new file mode 100644 index 0000000..1874555 --- /dev/null +++ b/src/main/resources/com/naveensundarg/planner/problems/tora/sodacan.clj @@ -0,0 +1,15 @@ +{:name "soda can challenge" + :background [(forall [?thing] (if (and (Checked ?thing) (Possible ?thing)) + (exists ?answer (Know ?answer))))] + :start [(Possible A) + (Possible B) + (Possible C) + + (forall [?u] (if (and (not (= ?u A)) (not (= ?u B)) (not (= ?u C))) (not (Possible ?u))))] + + :actions [(define-action checkU [?q] + {:preconditions [(Possible ?q)] + :additions [(Checked ?q)] + :deletions []})] + + :goal [(exists ?answer (Know ?answer))]} \ No newline at end of file