mirror of
https://github.com/RAIRLab/Spectra.git
synced 2024-11-09 11:10:34 -05:00
Some more tweaks
This commit is contained in:
parent
afde7793e5
commit
d1e0cb891a
7 changed files with 55 additions and 54 deletions
|
@ -66,14 +66,14 @@
|
|||
(setup-snark :time-limit time-limit :verbose verbose)
|
||||
(if sortal-setup-fn (funcall sortal-setup-fn))
|
||||
(let* ((n-a (make-hash-table :test #'equalp))
|
||||
(a-n (make-hash-table :test #'equalp)))
|
||||
(a-n (make-hash-table :test #'equalp))
|
||||
)
|
||||
(mapcar (lambda (axiom)
|
||||
(let ((name (gensym)))
|
||||
(setf (gethash (princ-to-string axiom) a-n) name)
|
||||
(setf (gethash (princ-to-string name) n-a) axiom))) axioms)
|
||||
(mapcar (lambda (axiom)
|
||||
(snark::assert axiom :name (gethash (princ-to-string axiom) a-n)
|
||||
))
|
||||
(snark::assert axiom))
|
||||
(mapcar #'!@ axioms))
|
||||
(if (equalp :PROOF-FOUND (snark:prove (!@ f)))
|
||||
(list t (remove nil
|
||||
|
@ -101,8 +101,7 @@
|
|||
(setf (gethash (princ-to-string axiom) a-n) name)
|
||||
(setf (gethash (princ-to-string name) n-a) axiom))) axioms)
|
||||
(mapcar (lambda (axiom)
|
||||
(snark::assert axiom :name (gethash (princ-to-string axiom) a-n)
|
||||
))
|
||||
(snark::assert axiom))
|
||||
(mapcar #'!@ axioms))
|
||||
(if (equalp :PROOF-FOUND (snark:prove (!@ f)))
|
||||
"YES"
|
||||
|
@ -126,8 +125,7 @@
|
|||
(setf (gethash (princ-to-string axiom) a-n) name)
|
||||
(setf (gethash (princ-to-string name) n-a) axiom))) axioms)
|
||||
(mapcar (lambda (axiom)
|
||||
(snark::assert axiom :name (gethash (princ-to-string axiom) a-n)
|
||||
))
|
||||
(snark::assert axiom))
|
||||
(mapcar #'!@ axioms))
|
||||
|
||||
(let ((proof (snark:prove (!@ f) :answer (!@ (list 'ans var)) )))
|
||||
|
@ -154,8 +152,7 @@
|
|||
(setf (gethash (princ-to-string axiom) a-n) name)
|
||||
(setf (gethash (princ-to-string name) n-a) axiom))) axioms)
|
||||
(mapcar (lambda (axiom)
|
||||
(snark::assert axiom :name (gethash (princ-to-string axiom) a-n)
|
||||
))
|
||||
(snark::assert axiom))
|
||||
(mapcar #'!@ axioms))
|
||||
|
||||
(let ((proof (snark:prove (!@ f) :answer (!@ (cons 'ans vars)) )))
|
||||
|
@ -179,8 +176,7 @@
|
|||
(setf (gethash (princ-to-string axiom) a-n) name)
|
||||
(setf (gethash (princ-to-string name) n-a) axiom))) axioms)
|
||||
(mapcar (lambda (axiom)
|
||||
(snark::assert axiom :name (gethash (princ-to-string axiom) a-n)
|
||||
))
|
||||
(snark::assert axiom))
|
||||
(mapcar #'!@ axioms))
|
||||
|
||||
(let ((proof (snark:prove (!@ f) :answer (!@ (cons 'ans vars)) )))
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,13 @@
|
|||
|
||||
:additions [(interrogates commander prisoner)]
|
||||
|
||||
:deletions []})
|
||||
|
||||
(define-action stay-put [?x ?y]
|
||||
{:preconditions [(sameroom ?x ?y)]
|
||||
|
||||
:additions [(sameroom ?x ?y)]
|
||||
|
||||
:deletions []})
|
||||
]
|
||||
}
|
|
@ -1,21 +1,23 @@
|
|||
{:definitions
|
||||
{:name "demo 1"
|
||||
:background [
|
||||
(forall [?x ?room1 ?room2]
|
||||
(if (not (= ?room1 ?room2))
|
||||
(if (in ?x ?room1) (not (in ?x ?room2))) ))
|
||||
{: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)
|
||||
]
|
||||
:start [(in self room1)
|
||||
(in self room1)
|
||||
(in commander room2)
|
||||
(in prisoner room1)
|
||||
(open (door room2))
|
||||
(not (open (door room1)))]
|
||||
(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 []
|
||||
|
||||
|
@ -28,8 +30,7 @@
|
|||
|
||||
|
||||
(define-action accompany [?person ?room1 ?room2]
|
||||
{:preconditions [(not (= ?room1 ?room2))
|
||||
(in ?person ?room1)
|
||||
{:preconditions [(in ?person ?room1)
|
||||
(in self ?room1)
|
||||
(open (door ?room1))
|
||||
(open (door ?room2))]
|
||||
|
@ -41,8 +42,7 @@
|
|||
(in self ?room1)]})
|
||||
|
||||
(define-action move [?person ?room2 ?room1]
|
||||
{:preconditions [(not (= ?room1 ?room2))
|
||||
(in ?person ?room2)
|
||||
{:preconditions [(in ?person ?room2)
|
||||
(open (door ?room1))
|
||||
(open (door ?room2))]
|
||||
|
||||
|
@ -57,24 +57,15 @@
|
|||
:additions [(interrogates commander prisoner)]
|
||||
|
||||
:deletions []})
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
:goals {G1 {:priority 6.0
|
||||
:state [(not (open (door room1)))]}
|
||||
|
||||
G2 {:priority 6.0
|
||||
:state [(in prisoner room1)]}
|
||||
|
||||
G3 {:priority 6.0
|
||||
:state [(forall [?room]
|
||||
(if (in prisoner ?room)
|
||||
(in self ?room)))]}
|
||||
G4 {:priority 3.0
|
||||
:state [(in prisoner room2)
|
||||
(in self room2)]}
|
||||
G5 {:priority 2.0
|
||||
|
||||
:state [(interrogates commander prisoner)]}}
|
||||
:goals {G1 {:priority 1.0
|
||||
:state [(sameroom self prisoner)]}
|
||||
|
||||
G2 {:priority 2.0
|
||||
:state [(in prisoner room2)]}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ public class GoalTrackerTest {
|
|||
|
||||
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_1.clj")));
|
||||
|
||||
|
||||
GoalTrackingProblem goalTrackingProblem = goalTrackingProblemList.get(0);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue