Some more tweaks

This commit is contained in:
Naveen Sundar Govindarajulu 2017-01-18 22:58:41 -05:00
parent afde7793e5
commit d1e0cb891a
7 changed files with 55 additions and 54 deletions

View file

@ -22,7 +22,7 @@ public class RunDemo {
public static void main(String[] args) throws Reader.ParsingException {
List<GoalTrackingProblem> goalTrackingProblemList = (GoalTrackingProblem.readFromFile(Planner.class.getResourceAsStream("goal_tracking_tests.clj")));
List<GoalTrackingProblem> goalTrackingProblemList = (GoalTrackingProblem.readFromFile(Planner.class.getResourceAsStream("goal_management_2.clj")));
GoalTrackingProblem goalTrackingProblem = goalTrackingProblemList.get(0);
@ -31,18 +31,25 @@ public class RunDemo {
goalTrackingProblem.getPlanningProblem().getStart(),
goalTrackingProblem.getPlanningProblem().getActions());
long start = System.currentTimeMillis();
Goal g1 = goalTrackingProblem.getGoalNamed("G1");
Goal g2 = goalTrackingProblem.getGoalNamed("G2");
Goal g3 = goalTrackingProblem.getGoalNamed("G3");
Goal g4 = goalTrackingProblem.getGoalNamed("G4");
Goal g5 = goalTrackingProblem.getGoalNamed("G5");
tryAndAddGoal(g1, goalTracker);
tryAndAddGoal(g2, goalTracker);
tryAndAddGoal(g3, goalTracker);
tryAndAddGoal(g4, goalTracker);
tryAndAddGoal(g5, goalTracker);
long end = System.currentTimeMillis();
cp.println("--------------------------");
cp.setForegroundColor(Ansi.FColor.CYAN);
cp.print("Time Taken:");
cp.clear();
cp.print(" ");
cp.setAttribute(Ansi.Attribute.BOLD);
cp.print((end-start)/1000 + "s");
}

View file

@ -57,6 +57,13 @@
:additions [(interrogates commander prisoner)]
:deletions []})
(define-action stay-put [?x ?y]
{:preconditions [(sameroom ?x ?y)]
:additions [(sameroom ?x ?y)]
:deletions []})
]
}

View file

@ -0,0 +1,71 @@
{:definitions
{:name "test"
:background []
:start [
(forall [?x ?room1 ?room2] (implies (and (not (= ?room1 ?room2)) (in ?x ?room1)) (not (in ?x ?room2))))
(not (= room1 room2))
(not (= prisoner commander))
(not (= self prisoner))
(not (= self commander))
(person prisoner)
(person commander)
(in self room1)
(in commander room2)
(in prisoner room1)
(open (door room2))
(not (open (door room1)))
(forall [?x ?y ?room] (implies (and (and (in ?x ?room) (in ?y ?room)) (not (= ?x ?y))) (sameroom ?x ?y)))
(forall [?x ?y] (exists ?room (implies (sameroom ?x ?y) (and (in ?x ?room) (in ?y ?room)) )) )
]
:goal []
:actions
[(define-action open-door [?room]
{:preconditions [(not (open (door ?room)))]
:additions [(open (door ?room))]
:deletions [(not (open (door ?room)))]})
(define-action accompany [?person ?room1 ?room2]
{:preconditions [(in ?person ?room1)
(in self ?room1)
(open (door ?room1))
(open (door ?room2))]
:additions [(in ?person ?room2)
(in self ?room2)]
:deletions [(in ?person ?room1)
(in self ?room1)]})
(define-action move [?person ?room2 ?room1]
{:preconditions [(in ?person ?room2)
(open (door ?room1))
(open (door ?room2))]
:additions [(in ?person ?room1)]
:deletions [(in ?person ?room2)]})
(define-action get-interrogated [?room]
{:preconditions [(in commander ?room)
(in prisoner ?room)]
:additions [(interrogates commander prisoner)]
:deletions []})
]
}
:goals {G1 {:priority 1.0
:state [(sameroom self prisoner)]}
G2 {:priority 2.0
:state [(in prisoner room2)]}
}
}