some more edits.

This commit is contained in:
Naveen Sundar Govindarajulu 2017-01-24 15:24:08 -06:00
parent 04995c6990
commit 5ec5169ae5
3 changed files with 181 additions and 5 deletions

View file

@ -38,7 +38,7 @@ public class RunDemo {
}
});
planningProblemWarmUp();
// planningProblemWarmUp();
System.out.println("\nWARM UP DONE");
} catch (Reader.ParsingException e) {
e.printStackTrace();
@ -53,7 +53,7 @@ public class RunDemo {
System.out.println();
List<GoalTrackingProblem> goalTrackingProblemList = (GoalTrackingProblem.readFromFile(Planner.class.getResourceAsStream("goal_management_1.clj")));
List<GoalTrackingProblem> goalTrackingProblemList = (GoalTrackingProblem.readFromFile(Planner.class.getResourceAsStream("goal_management_6.clj")));
GoalTrackingProblem goalTrackingProblem = goalTrackingProblemList.get(0);
@ -65,14 +65,17 @@ public class RunDemo {
long start = System.currentTimeMillis();
Goal g1 = goalTrackingProblem.getGoalNamed("G1");
Goal g2 = goalTrackingProblem.getGoalNamed("G2");
Goal g2a = goalTrackingProblem.getGoalNamed("G2a");
Goal g2b = goalTrackingProblem.getGoalNamed("G2b");
Goal g3 = goalTrackingProblem.getGoalNamed("G3");
Goal g4 = goalTrackingProblem.getGoalNamed("G4");
tryAndAddGoal(g1, goalTracker);
tryAndAddGoal(g2, goalTracker);
tryAndAddGoal(g2a, goalTracker);
tryAndAddGoal(g2b, goalTracker);
tryAndAddGoal(g3, goalTracker);

View file

@ -79,7 +79,7 @@
G4 {:priority 1.0
:state [(in prisoner room2)
(in self room2)]}
G5 {:priority 3
G5 {:priority 3.0
:state [(interrogates commander prisoner)]}}

View file

@ -0,0 +1,173 @@
{:definitions
{:name "demo 1"
:background []
:start [
(person prisoner)
(prisoner prisoner)
(person commander)
(commander commander)
(robot guard)
(robot guide)
(not (= prisoner commander))
(not (= prisoner guard))
(not (= prisoner guide))
(not (= commander guard))
(not (= commander guide))
(not (= guard guide))
(room room1)
(room room2)
(room hallway)
(not (= room1 room2))
(not (= room1 hallway))
(not (= room2 hallway))
(in prisoner room1)
(in commander room2)
(in guard room1)
(in guide hallway)
(not (open (door room1)))
(open (door room2))
(open (door hallway))
(forall (?robot ?prisoner ?commander)
(implies (and (and (robot ?robot) (prisoner ?prisoner)) (commander ?commander))
(can accompany ?robot ?prisoner ?commander)))
(forall (?commander ?prisoner ?person)
(implies (and (and (commander ?commander) (prisoner ?prisoner)) (person ?person))
(can accompany ?commander ?prisoner ?person)))
(forall (?robot ?commander ?person)
(implies (and (and (and (robot ?robot) (commander ?commander)) (person ?person))
(needs ?commander (interrogate ?person)))
(can accompany ?robot ?commander ?person)))
(forall (?room ?x ?y)
(implies (and (in ?x ?room) (and (in ?y ?room) (not (= ?x ?y))))
(sameroom ?x ?y)))
(forall (?room2 ?x ?room1)
(implies (and (not (= ?room1 ?room2)) (in ?x ?room1))
(not (in ?x ?room2))))
(forall (?room ?x ?y)
(implies (and (sameroom ?x ?y) (in ?x ?room))
(in ?y ?room)))
(needs commander (interrogate prisoner))
]
:goal []
:actions
[
(define-action move [?actor ?room1 ?room2]
{:preconditions [(robot ?actor)
(room ?room1)
(room ?room2)
(in ?actor ?room1)
(open (door ?room1))
(open (door ?room2))
(not (= ?room1 ?room2))]
:additions [(in ?actor ?room2)]
:deletions [(in ?actor ?room1)]
})
(define-action keepDoorClosed [?actor ?room]
{:preconditions [(robot ?actor)
(room ?room)
(in ?actor ?room)
(not (open (door ?room)))]
:additions []
:deletions [(open (door ?room))]
})
(define-action accompany [?actor ?person1 ?person2 ?room1 ?room2]
{:preconditions [(robot ?actor)
(person ?person1)
(person ?person2)
(can accompany ?actor ?person1 ?person2)
(room ?room1)
(room ?room2)
(in ?actor ?room1)
(in ?person1 ?room1)
(in ?person2 ?room2)
(open (door ?room1))
(open (door ?room2))
(not (= ?actor ?person1))
(not (= ?actor ?person2))
(not (= ?person1 ?person2))
(not (= ?room1 ?room2))]
:additions [(accompanies ?person1 ?person2)
(in ?actor ?room2)
(in ?person1 ?room2)]
:deletions [(in ?actor ?room1)
(in ?person1 ?room1)]
})
(define-action accompany2 [?actor ?person1 ?person2 ?room]
{:preconditions [(robot ?actor)
(person ?person1)
(person ?person2)
(can accompany ?actor ?person1 ?person2)
(room ?room)
(in ?actor ?room)
(in ?person1 ?room)
(in ?person2 ?room)
(not (= ?actor ?person1))
(not (= ?actor ?person2))
(not (= ?person1 ?person2))]
:additions [(accompanies ?person1 ?person2)]
:deletions []
})
(define-action openDoor [?actor ?room]
{:preconditions [(robot ?actor)
(room ?room)
(in ?actor ?room)
(not (open (door ?room)))]
:additions [(open (door ?room))]
:deletions [(not (open (door ?room)))]
})
(define-action stayInRoom [?actor ?room]
{:preconditions [(in ?actor ?room)
(room ?room)]
:additions [(in ?actor ?room)]
:deletions []
})
(define-action staySameRoom [?actor ?person]
{:preconditions [(robot ?actor)
(sameroom ?actor ?person)
(person ?person)
(in ?actor ?room)
(in ?person ?room)
(room ?room)]
:additions [(sameroom ?actor ?person)]
:deletions []
})
]
}
:goals {G1 {:priority 1.0
:state [(not (open (door room1)))]}
G2a {:priority 1.0
:state [(in prisoner room1)]}
G2b {:priority 1.0
:state [(in guard room1)]}
G3 {:priority 1.0
:state [(sameroom guard prisoner)]}
G4 {:priority 2.1
:state [(accompanies prisoner commander)]}
}
}