Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9b50dc5
Added partition function
bcorfman Nov 17, 2016
401b49d
New Action, PlanningKB and PlanningProblem classes to implement total…
bcorfman Nov 17, 2016
2eb5360
Removed extraneous methods from PlanningKB since it no longer derives…
bcorfman Nov 17, 2016
e3cea7e
Cleaned up a comment.
bcorfman Nov 17, 2016
c78ea93
Cleaned up a comment.
bcorfman Mar 20, 2018
f1155ac
Initial add
bcorfman Apr 14, 2018
8617fc0
Changed read_from_tokens to reverse lists by default, so that .pop()
bcorfman Apr 15, 2018
a7fef4b
In the process of adding PDDL file parsing.
bcorfman Apr 15, 2018
c4b04ce
Reverted back to current AIMA state (removing yield statements).
bcorfman Apr 15, 2018
c65ac28
Incorporated latest AIMA changes while leaving my partition function
bcorfman Apr 15, 2018
26d3d3f
Domain file parsing complete.
bcorfman Apr 17, 2018
233be50
Added blocks world PDDL to the repo. More than likely will need to
bcorfman Apr 20, 2018
5b6f9c4
Renamed parse.py to pddl_parse and updated imports.
bcorfman Apr 22, 2018
32bdb81
Moved to pddl_files subfolder
bcorfman Apr 22, 2018
9a8f564
In process of updating example functions to be brought in as PDDL files
bcorfman Apr 22, 2018
57e1e96
Last version of my own PDDL parsing.
bcorfman Apr 27, 2018
6344a9f
Last version of PDDL parsing that attempts to save tokens and their
bcorfman May 12, 2018
6be6d6e
Spare tire PDDL now working
bcorfman May 13, 2018
3c93c29
Aircargo and Blocks PDDL files now working.
bcorfman May 13, 2018
c5fe847
Revised BlocksWorld and added SussmanAnomaly
bcorfman May 14, 2018
2644171
Revised bug in blocks problem.
bcorfman May 14, 2018
17607ff
Initial TPP domain and problem files
bcorfman May 14, 2018
eab18fd
TPP task 02 problem, duplicated from Pyperplan tests
bcorfman May 14, 2018
3dbdc6f
Planning now working with PDDL parsing tests.
bcorfman May 14, 2018
5ee73c1
Change to exception in gather_test_pairs()
bcorfman May 15, 2018
f27fe34
Update config files
bcorfman May 16, 2018
64f13c6
Conflicts resolved.
bcorfman May 28, 2018
8f46e66
Resolved conflicts.
bcorfman May 28, 2018
fe476ce
Merge branch 'master' of https://github.com/aimacode/aima-python
bcorfman May 28, 2018
920b965
Solved conflicts with current version of planning.py, plus added
bcorfman May 28, 2018
41aeaf4
Accidentally deleted TotalOrderPlanner in the last merge, put it back…
bcorfman May 28, 2018
fd4e362
Added import of copy module.
bcorfman May 28, 2018
1ed5031
Changed _build_expr_string to be accessible outside pddl_parse module.
bcorfman May 29, 2018
dc61a2d
Yield blank set from check_pos_precond for failure case.
bcorfman Jun 4, 2018
3ce0bd3
Solved bug exposed with Cake problem by passing a flag back indicating
bcorfman Jun 11, 2018
c26f0a2
Removed test runner from bottom of module.
bcorfman Jun 11, 2018
556b072
At Dr. Norvig's request, updated PlanningAction and PlanningKB to
bcorfman Jun 15, 2018
2f8799d
Brief edits to parse.py
bcorfman Jun 16, 2018
e6fa99d
Renamed PlanningProblem to PlanningSearchProblem and PlanningAction to
bcorfman Jun 16, 2018
a38f29b
Fixed True/False bug in STRIPSAction.check_pos_precond
bcorfman Jun 16, 2018
db83e6f
Added three unit tests for PlanningSearchProblem.
bcorfman Jun 18, 2018
24511f5
Fixed directory path for pddl_files in PlanningSearchProblem unit tests
bcorfman Jun 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/dictionaries/brandon_corfman.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def __init__(self,dimrow):
wumpus_at_least = list()
for x in range(1, dimrow+1):
for y in range(1, dimrow + 1):
wumps_at_least.append(wumpus(x, y))
wumpus_at_least.append(wumpus(x, y))

self.tell(new_disjunction(wumpus_at_least))

Expand Down
31 changes: 31 additions & 0 deletions pddl_files/aircargo-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; air cargo domain from AIMA book 2nd ed.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; since the 'at' predicate is used for both cargo and planes, I didn't specify types
; in this domain to keep things simpler.

(define (domain aircargo)
(:requirements :strips)
(:predicates (at ?x ?a)
(cargo ?c)
(airport ?a)
(plane ?p)
(in ?x ?p)
)

(:action load
:parameters (?c ?p ?a)
:precondition (and (cargo ?c) (plane ?p) (airport ?a) (at ?c ?a) (at ?p ?a))
:effect (and (in ?c ?p) (not (at ?c ?a))))

(:action unload
:parameters (?c ?p ?a)
:precondition (and (cargo ?c) (plane ?p) (airport ?a) (in ?c ?p) (at ?p ?a))
:effect (and (at ?c ?a) (not (in ?c ?p))))

(:action fly
:parameters (?p ?f ?t)
:precondition (and (at ?p ?f) (plane ?p) (airport ?f) (airport ?t))
:effect (and (at ?p ?t) (not (at ?p ?f))))
)
17 changes: 17 additions & 0 deletions pddl_files/aircargo-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(define (problem Transport)

(:domain aircargo)

(:init (at C1 SFO)
(at C2 JFK)
(at P1 SFO)
(at P2 JFK)
(cargo C1)
(cargo C2)
(plane P1)
(plane P2)
(airport JFK)
(airport SFO))

(:goal (and (at C1 JFK) (at C2 SFO)))
)
24 changes: 24 additions & 0 deletions pddl_files/blocks-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Building block towers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain BlocksWorld)
(:requirements :strips)
(:predicates (on ?x ?y)
(clear ?x)
(block ?x)
)

(:action Move
:parameters (?b ?x ?y)
:precondition (and (on ?b ?x) (clear ?b) (clear ?y) (block ?b))
:effect (and (on ?b ?y) (clear ?x) (not (on ?b ?x)) (not (clear ?y)))
)

(:action Move_To_Table
:parameters (?b ?x)
:precondition (and (on ?b ?x) (clear ?b) (block ?b))
:effect (and (on ?b Table) (clear ?x) (not (on ?b ?x)))
)
)

18 changes: 18 additions & 0 deletions pddl_files/blocks-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(define (problem ThreeBlockTower)

(:domain BlocksWorld)

(:init
(on A Table)
(on B Table)
(on C Table)
(block A)
(block B)
(block C)
(clear A)
(clear B)
(clear C)
)

(:goal (and (on A B) (on B C)))
)
20 changes: 20 additions & 0 deletions pddl_files/cake-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Cake domain
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain Cake)
(:requirements :strips)

(:action Eat
:parameters (Cake)
:precondition (have Cake)
:effect (and (eaten Cake) (not (have Cake)))
)

(:action Bake
:parameters (Cake)
:precondition (not (have Cake))
:effect (have Cake)
)
)

9 changes: 9 additions & 0 deletions pddl_files/cake-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; The "have cake and eat it too" problem.

(define (problem HaveCakeAndEatItToo)
(:domain Cake)

(:init (have Cake) )

(:goal (and (have Cake) (eaten Cake)))
)
37 changes: 37 additions & 0 deletions pddl_files/shoes-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Putting on a pair of shoes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain Shoes)
(:requirements :strips)
(:predicates (leftfoot ?x)
(rightfoot ?x)
(on ?x ?y)
)

(:action RightShoe
:parameters ()
:precondition (and (on RightSock ?x) (rightfoot ?x) (not (on RightShoe ?x)))
:effect (and (on RightShoe ?x))
)

(:action RightSock
:parameters ()
:precondition (and (clear ?x) (rightfoot ?x))
:effect (and (on RightSock ?x) (not (clear ?x)))
)

(:action LeftShoe
:parameters ()
:precondition (and (on LeftSock ?x) (leftfoot ?x) (not (on LeftShoe ?x)))
:effect (and (on LeftShoe ?x))
)

(:action LeftSock
:parameters ()
:precondition (and (clear ?x) (leftfoot ?x))
:effect (and (on LeftSock ?x) (not (clear ?x)))
)

)

12 changes: 12 additions & 0 deletions pddl_files/shoes-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(define (problem PutOnShoes)

(:domain Shoes)

(:init (clear LF)
(clear RF)
(leftfoot LF)
(rightfoot RF)
)

(:goal (and (On RightShoe RF) (on LeftShoe LF)))
)
20 changes: 20 additions & 0 deletions pddl_files/shopping-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Shopping domain
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain Shopping)
(:requirements :strips)

(:action Buy
:parameters (?x ?store)
:precondition (and (at ?store) (sells ?store ?x))
:effect (have ?x)
)

(:action Go
:parameters (?x ?y)
:precondition (and (at ?x) (loc ?x) (loc ?y))
:effect (and (at ?y) (not (at ?x)))
)
)

17 changes: 17 additions & 0 deletions pddl_files/shopping-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
;; Going shopping

(define (problem GoingShopping)

(:domain Shopping)

(:init (At Home)
(Loc Home)
(Loc Supermarket)
(Loc HardwareStore)
(Sells Supermarket Milk)
(Sells Supermarket Banana)
(Sells HardwareStore Drill)
)

(:goal (and (Have Milk) (Have Banana) (Have Drill) (At Home)))
)
37 changes: 37 additions & 0 deletions pddl_files/spare-tire-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Changing a spare tire on a car
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (domain SpareTire)
(:requirements :strips)
(:predicates (At Spare Trunk)
(At Spare Ground)
(At Flat Axle)
(At Flat Ground)
(At Spare Axle))

(:action remove
:parameters (Spare Trunk)
:precondition (At Spare Trunk)
:effect (and (At Spare Ground) (not (At Spare Trunk))))

(:action remove
:parameters (Flat Axle)
:precondition (At Flat Axle)
:effect (and (At Flat Ground) (not (At Flat Axle))))

(:action put_on
:parameters (Spare Axle)
:precondition (and (At Spare Ground) (not (At Flat Axle)))
:effect (and (At Spare Axle) (not (At Spare Ground))))

(:action leave_overnight
:effect
(and (not (At Spare Ground))
(not (At Spare Axle))
(not (At Spare Trunk))
(not (At Flat Ground))
(not (At Flat Axle))
)
)
)
9 changes: 9 additions & 0 deletions pddl_files/spare-tire-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(define (problem ChangeFlatTire)

(:domain SpareTire)

(:init (At Flat Axle)
(At Spare Trunk))

(:goal (At Spare Axle))
)
15 changes: 15 additions & 0 deletions pddl_files/sussman-anomaly-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(define (problem SussmanAnomaly)

(:domain BlocksWorld)

(:init (clear C)
(clear B)
(on A Table)
(on B Table)
(on C A)
(block A)
(block B)
(block C))

(:goal (and (on A B) (on B C)))
)
65 changes: 65 additions & 0 deletions pddl_files/tpp-domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
; IPC5 Domain: TPP Propositional
; Authors: Alfonso Gerevini and Alessandro Saetti

(define (domain TPP-Propositional)
(:requirements :strips :typing)
(:types place locatable level - object
depot market - place
truck goods - locatable)

(:predicates (loaded ?g - goods ?t - truck ?l - level)
(ready-to-load ?g - goods ?m - market ?l - level)
(stored ?g - goods ?l - level)
(on-sale ?g - goods ?m - market ?l - level)
(next ?l1 ?l2 - level)
(at ?t - truck ?p - place)
(connected ?p1 ?p2 - place))

(:action drive
:parameters (?t - truck ?frm ?to - place)
:precondition (and (at ?t ?frm) (connected ?frm ?to))
:effect (and (not (at ?t ?frm)) (at ?t ?to)))


; ### LOAD ###
; ?l1 is the level of ?g ready to be loaded at ?m before loading
; ?l2 is the level of ?g ready to be loaded at ?m after loading
; ?l3 is the level of ?g in ?t before loading
; ?l4 is the level of ?g in ?t after loading

(:action load
:parameters (?g - goods ?t - truck ?m - market ?l1 ?l2 ?l3 ?l4 - level)
:precondition (and (at ?t ?m) (loaded ?g ?t ?l3)
(ready-to-load ?g ?m ?l2) (next ?l2 ?l1) (next ?l4 ?l3))
:effect (and (loaded ?g ?t ?l4) (not (loaded ?g ?t ?l3))
(ready-to-load ?g ?m ?l1) (not (ready-to-load ?g ?m ?l2))))


; ### UNLOAD ###
; ?l1 is the level of ?g in ?t before unloading
; ?l2 is the level of ?g in ?t after unloading
; ?l3 is the level of ?g in ?d before unloading
; ?l4 is the level of ?g in ?d after unloading

(:action unload
:parameters (?g - goods ?t - truck ?d - depot ?l1 ?l2 ?l3 ?l4 - level)
:precondition (and (at ?t ?d) (loaded ?g ?t ?l2)
(stored ?g ?l3) (next ?l2 ?l1) (next ?l4 ?l3))
:effect (and (loaded ?g ?t ?l1) (not (loaded ?g ?t ?l2))
(stored ?g ?l4) (not (stored ?g ?l3))))


; ### BUY ###
; ?l1 is the level of ?g on sale at ?m before buying
; ?l2 is the level of ?g on sale at ?m after buying
; ?l3 is the level of ?g ready to be loaded at ?m before buying
; ?l4 is the level of ?g ready to be loaded at ?m after buying

(:action buy
:parameters (?t - truck ?g - goods ?m - market ?l1 ?l2 ?l3 ?l4 - level)
:precondition (and (at ?t ?m) (on-sale ?g ?m ?l2) (ready-to-load ?g ?m ?l3)
(next ?l2 ?l1) (next ?l4 ?l3))
:effect (and (on-sale ?g ?m ?l1) (not (on-sale ?g ?m ?l2))
(ready-to-load ?g ?m ?l4) (not (ready-to-load ?g ?m ?l3))))

)
Loading