Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions lab03/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
*.acn
*.acr
*.alg
*.aux
*.bak
*.bbl
*.bcf
*.blg
*.brf
*.bst
*.dvi
*.fdb_latexmk
*.fls
*.glg
*.glo
*.gls
*.idx
*.ilg
*.ind
*.ist
*.lof
*.log
*.lol
*.lot
*.maf
*.mtc
*.mtc1
*.nav
*.nlo
*.nls
*.out
*.pyg
*.run.xml
*.snm
*.synctex.gz
*.tex.backup
*.tex~
*.thm
*.toc
*.vrb
*.xdy
*.xml
*blx.bib
.bak
.mtc
build/
103 changes: 103 additions & 0 deletions lab03/1/domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
(define (domain package-transport-step6)
(:requirements :strips :typing :negative-preconditions :action-costs
:durative-actions :conditional-effects)

(:types
package
location
city airport port - location
vehicle
truck plane ship - vehicle
)

(:predicates
(at-pkg ?p - package ?l - location)
(at-vehicle ?v - vehicle ?l - location)
(in-pkg ?p - package ?v - vehicle)
(road-connection ?from - location ?to - location)
(air-connection ?from - airport ?to - airport)
(sea-connection ?from - port ?to - port)
(fragile ?p - package)
)

(:functions
(total-cost) - number
(travel-distance ?l1 - location ?l2 - location) - number
(speed ?v - vehicle) - number
(load-unload-fixed-time) - number
)

(:durative-action load-package
:parameters (?pkg - package ?veh - vehicle ?loc - location)
:duration (= ?duration (load-unload-fixed-time))
:condition (and
(at start (at-pkg ?pkg ?loc))
(at start (at-vehicle ?veh ?loc))
)
:effect (and
(at end (in-pkg ?pkg ?veh))
(at end (not (at-pkg ?pkg ?loc)))
; Conditional costs
(when (and (at start (fragile ?pkg))) ; If fragile
(at end (increase (total-cost) 15))) ; Total load cost for fragile = 5 (base) + 10 (extra)
(when (and (at start (not (fragile ?pkg)))) ; If NOT fragile (requires :negative-preconditions also for conditions in 'when')
(at end (increase (total-cost) 5)))
)
)

(:durative-action unload-package
:parameters (?pkg - package ?veh - vehicle ?loc - location)
:duration (= ?duration (load-unload-fixed-time))
:condition (and
(at start (in-pkg ?pkg ?veh))
(at start (at-vehicle ?veh ?loc))
)
:effect (and
(at end (at-pkg ?pkg ?loc))
(at end (not (in-pkg ?pkg ?veh)))
(at end (increase (total-cost) 3))
)
)

(:durative-action drive-truck
:parameters (?tr - truck ?from - location ?to - location)
:duration (= ?duration (/ (travel-distance ?from ?to) (speed ?tr)))
:condition (and
(at start (at-vehicle ?tr ?from))
(over all (road-connection ?from ?to))
)
:effect (and
(at start (not (at-vehicle ?tr ?from)))
(at end (at-vehicle ?tr ?to))
(at end (increase (total-cost) 10))
)
)

(:durative-action fly-plane
:parameters (?pl - plane ?from - airport ?to - airport)
:duration (= ?duration (/ (travel-distance ?from ?to) (speed ?pl)))
:condition (and
(at start (at-vehicle ?pl ?from))
(over all (air-connection ?from ?to))
)
:effect (and
(at start (not (at-vehicle ?pl ?from)))
(at end (at-vehicle ?pl ?to))
(at end (increase (total-cost) 100))
)
)

(:durative-action sail-ship
:parameters (?sh - ship ?from - port ?to - port)
:duration (= ?duration (/ (travel-distance ?from ?to) (speed ?sh)))
:condition (and
(at start (at-vehicle ?sh ?from))
(over all (sea-connection ?from ?to))
)
:effect (and
(at start (not (at-vehicle ?sh ?from)))
(at end (at-vehicle ?sh ?to))
(at end (increase (total-cost) 50))
)
)
)
74 changes: 74 additions & 0 deletions lab03/1/problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
(define (problem multi-modal-transport-conditional)
(:domain package-transport-step6)

(:objects
p1 - package
p2 - package

london paris newyork - city
heathrow jfk charlesdegaulle - airport
dover calais newyork_port - port

my_truck - truck
my_plane - plane
my_ship - ship
another_truck - truck
)

(:init
(= (total-cost) 0)
(= (load-unload-fixed-time) 1)

(= (speed my_truck) 60)
(= (speed another_truck) 60)
(= (speed my_plane) 500)
(= (speed my_ship) 30)

(= (travel-distance london heathrow) 30) (= (travel-distance heathrow london) 30)
(= (travel-distance london dover) 80) (= (travel-distance dover london) 80)
(= (travel-distance paris charlesdegaulle) 20) (= (travel-distance charlesdegaulle paris) 20)
(= (travel-distance paris calais) 150) (= (travel-distance calais paris) 150)
(= (travel-distance newyork jfk) 25) (= (travel-distance jfk newyork) 25)
(= (travel-distance newyork newyork_port) 10) (= (travel-distance newyork_port newyork) 10)
(= (travel-distance jfk newyork_port) 30) (= (travel-distance newyork_port jfk) 30)
(= (travel-distance london paris) 350) (= (travel-distance paris london) 350)
(= (travel-distance heathrow jfk) 3000) (= (travel-distance jfk heathrow) 3000)
(= (travel-distance heathrow charlesdegaulle) 300) (= (travel-distance charlesdegaulle heathrow) 300)
(= (travel-distance dover calais) 50) (= (travel-distance calais dover) 50)
(= (travel-distance calais newyork_port) 3500) (= (travel-distance newyork_port calais) 3500)

(at-pkg p1 london)
(fragile p1)

(at-pkg p2 jfk)

(at-vehicle my_truck london)
(at-vehicle my_plane heathrow)
(at-vehicle my_ship dover)
(at-vehicle another_truck newyork_port)

(road-connection london heathrow) (road-connection heathrow london)
(road-connection london dover) (road-connection dover london)
(road-connection paris charlesdegaulle) (road-connection charlesdegaulle paris)
(road-connection paris calais) (road-connection calais paris)
(road-connection newyork jfk) (road-connection jfk newyork)
(road-connection newyork newyork_port) (road-connection newyork_port newyork)
(road-connection jfk newyork_port) (road-connection newyork_port jfk)
(road-connection london paris) (road-connection paris london)

(air-connection heathrow jfk) (air-connection jfk heathrow)
(air-connection heathrow charlesdegaulle) (air-connection charlesdegaulle heathrow)

(sea-connection dover calais) (sea-connection calais dover)
(sea-connection calais newyork_port) (sea-connection newyork_port calais)
)

(:goal
(and
(at-pkg p1 newyork)
(at-pkg p2 calais)
)
)

(:metric minimize (total-cost))
)
39 changes: 39 additions & 0 deletions lab03/2/domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(define (domain cleaning-robot-world)
(:requirements :strips :typing :negative-preconditions)

(:types
robot
room
)

(:predicates
(at ?r - robot ?p - room)
(is_dirty ?p - room)
(is_clean ?p - room)
(connected ?p1 - room ?p2 - room)
)

(:action move
:parameters (?r - robot ?from_room - room ?to_room - room)
:precondition (and
(at ?r ?from_room)
(connected ?from_room ?to_room)
)
:effect (and
(not (at ?r ?from_room))
(at ?r ?to_room)
)
)

(:action clean_current_room
:parameters (?r - robot ?p_to_clean - room)
:precondition (and
(at ?r ?p_to_clean)
(is_dirty ?p_to_clean)
)
:effect (and
(not (is_dirty ?p_to_clean))
(is_clean ?p_to_clean)
)
)
)
29 changes: 29 additions & 0 deletions lab03/2/problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(define (problem clean-all-rooms-task-minimal)
(:domain cleaning-robot-world)

(:objects
r1 - robot
p1 - room
p2 - room
p3 - room
)

(:init
(at r1 p1)
(is_dirty p1)
(is_dirty p2)
(is_dirty p3)
(connected p1 p2)
(connected p2 p1)
(connected p1 p3)
(connected p3 p1)
)

(:goal
(and
(is_clean p1)
(is_clean p2)
(is_clean p3)
)
)
)
53 changes: 53 additions & 0 deletions lab03/3/domain.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
(define (domain ball-moving-robot)
(:requirements :strips :typing)

(:types
robot
room
ball
arm
)

(:predicates
(at ?r - robot ?rm - room)
(inroom ?b - ball ?rm - room)
(holding ?a - arm ?b - ball)
(arm-empty ?a - arm)
)

(:action move
:parameters (?r - robot ?from - room ?to - room)
:precondition (at ?r ?from)
:effect (and
(not (at ?r ?from))
(at ?r ?to)
)
)

(:action pick-up
:parameters (?r - robot ?a - arm ?b - ball ?rm - room)
:precondition (and
(at ?r ?rm)
(inroom ?b ?rm)
(arm-empty ?a)
)
:effect (and
(holding ?a ?b)
(not (arm-empty ?a))
(not (inroom ?b ?rm))
)
)

(:action put-down
:parameters (?r - robot ?a - arm ?b - ball ?rm - room)
:precondition (and
(at ?r ?rm)
(holding ?a ?b)
)
:effect (and
(inroom ?b ?rm)
(arm-empty ?a)
(not (holding ?a ?b))
)
)
)
29 changes: 29 additions & 0 deletions lab03/3/problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(define (problem move-balls-task3)
(:domain ball-moving-robot)

(:objects
room1 room2 - room
robot1 - robot
ball1 ball2 ball3 ball4 - ball
arm1 arm2 - arm
)

(:init
(at robot1 room1)
(inroom ball1 room1)
(inroom ball2 room1)
(inroom ball3 room1)
(inroom ball4 room1)
(arm-empty arm1)
(arm-empty arm2)
)

(:goal
(and
(inroom ball1 room2)
(inroom ball2 room2)
(inroom ball3 room2)
(inroom ball4 room2)
)
)
)
Binary file added lab03/Lab3_PL.pdf
Binary file not shown.
Binary file added lab03/images/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lab03/images/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lab03/report.pdf
Binary file not shown.
Loading