Skip to content

Instantly share code, notes, and snippets.

@sailik1991
Last active February 12, 2020 01:26
Show Gist options
  • Save sailik1991/6ab37fda6023511744dd512ab448d9fb to your computer and use it in GitHub Desktop.
Save sailik1991/6ab37fda6023511744dd512ab448d9fb to your computer and use it in GitHub Desktop.
This is a PDDL domain file for RADAR's fire-fighting scenario. The system is demonstrated in https://www.youtube.com/watch?v=5BTsNRB9p3o&t.
; Copyright 2017 Yochan Lab (http://rakaposhi.eas.asu.edu/yochan.html/)
; Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
; The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(define (domain RADAR)
(:requirements :typing :strips :equality :action-costs )
;; =====
;; TYPES
;; =====
(:types police fire transport medic - agents
hospital policestation firestation pois - location
)
;; =====
;; PREDICATES
;; =====
(:predicates (alerted ?loc - location)
(updated ?a - agents)
(deployed_police_cars ?at - location)
(deployed_engines ?at - location)
(deployed_small_engines ?at - location)
(deployed_big_engines ?at - location)
(deployed_ladders ?at - location)
(deployed_bulldozers ?at - location)
(deployed_helicopters ?at - location)
(deployed_rescuers ?at - location)
(deployed_ambulances ?at - location)
(positioned_policemen ?at - location)
(media_contacted ?a - agents)
(active_helpline ?a - agents)
(active_local_alert ?a - agents)
(blocked_road ?from - location ?to - location)
(traffic_diverted ?from - location ?to - location)
(prepared_evacuation ?from - location)
(evacuated ?from - location ?to - location)
(extinguished_fire ?at - location)
(fire_at ?at - location)
(small_fire_at ?at - location)
(barricaded ?at - location)
(searched ?at - location)
(attended_casualties ?at - location)
(addressed_media)
(needed_barricade ?at - location)
(needed_active_local_alert ?a - agents)
(needed_diverted_traffic ?from - location ?to - location)
(needed_search_casualties ?at - location)
(needed_attend_casualties ?at - location)
(needed_address_media)
(not_needed_barricade ?at - location)
(not_needed_active_local_alert ?a - agents)
(not_needed_diverted_traffic ?from - location ?to - location)
(not_needed_search_casualties ?at - location)
(not_needed_attend_casualties ?at - location)
(not_needed_address_media)
(has_police_car_number ?from - location)
(has_small_engines_number ?from - location)
(has_big_engines_number ?from - location)
(has_ladders_number ?from - location)
(has_helicopters_number ?from - location)
(has_rescuers_number ?from - location)
(has_ambulances_number ?from - location)
(has_policemen_number ?from - location)
(has_bulldozers_number ?from - location)
)
;; =====
;; FUNCTIONS
;; =====
(:functions
(duration_unit_actions)
(duration_deploy_police_cars)
(duration_deploy_small_engines)
(duration_deploy_big_engines)
(duration_deploy_ladders)
(duration_deploy_bulldozers)
(duration_deploy_helicopters)
(duration_deploy_rescuers)
(duration_deploy_ambulances)
(duration_position_policemen)
(duration_contact_media)
(duration_set_up_helpline)
(duration_issue_local_alert)
(duration_block_road)
(duration_prepare_evacuation)
(duration_evacuation)
(duration_extinguish_small_fire)
(duration_extinguish_big_fire)
(duration_barricade)
(duration_search_casualties)
(duration_attend_casualties)
(duration_address_media)
(total-cost)
)
;; =====
;; ACTIONS / OPERATORS
;; =====
(:action alert
:parameters (?a - agents ?loc - location)
:precondition (and
)
:effect (and
(alerted ?loc)
(increase (total-cost) (duration_unit_actions))
)
)
(:action update
:parameters (?a - agents)
:precondition (and
)
:effect (and
(updated ?a)
(increase (total-cost) (duration_unit_actions))
)
)
(:action deploy_police_cars
:parameters (?a - police ?from - policestation ?to - pois)
:precondition (and
(alerted ?from)
(has_police_car_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_police_cars ?to)
(not (has_police_car_number ?from))
(increase (total-cost) (duration_deploy_police_cars))
)
)
(:action deploy_small_engines
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(has_small_engines_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_engines ?to)
(deployed_small_engines ?to)
(needed_barricade ?to)
(not (not_needed_barricade ?to))
(not (has_small_engines_number ?from))
(increase (total-cost) (duration_deploy_small_engines))
)
)
(:action deploy_big_engines
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(has_big_engines_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_engines ?to)
(deployed_big_engines ?to)
(needed_barricade ?to)
(not (not_needed_barricade ?to))
(not (has_big_engines_number ?from))
(increase (total-cost) (duration_deploy_big_engines))
)
)
(:action deploy_ladders
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(deployed_big_engines ?to)
(has_ladders_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_ladders ?to)
(not (has_ladders_number ?from))
(increase (total-cost) (duration_deploy_ladders))
)
)
(:action deploy_bulldozers
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(has_bulldozers_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_bulldozers ?to)
(not (has_bulldozers_number ?from))
(increase (total-cost) (duration_deploy_bulldozers))
)
)
(:action deploy_helicopters
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(has_helicopters_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_helicopters ?to)
(not (has_helicopters_number ?from))
(increase (total-cost) (duration_deploy_helicopters))
)
)
(:action deploy_rescuers
:parameters (?a - fire ?from - firestation ?to - pois)
:precondition (and
(alerted ?from)
(has_rescuers_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_rescuers ?to)
(not (has_rescuers_number ?from))
(increase (total-cost) (duration_deploy_rescuers))
)
)
(:action deploy_ambulances
:parameters (?a - police ?from - hospital ?to - pois)
:precondition (and
(alerted ?from)
(has_ambulances_number ?from)
)
:effect (and
(not (alerted ?from))
(deployed_ambulances ?to)
(not (has_ambulances_number ?from))
(increase (total-cost) (duration_deploy_ambulances))
)
)
(:action position_policemen
:parameters (?a - police ?from - policestation ?to - pois)
:precondition (and
(alerted ?from)
(has_policemen_number ?from)
)
:effect (and
(not (alerted ?from))
(positioned_policemen ?to)
(increase (total-cost) (duration_position_policemen))
)
)
(:action contact_media
:parameters (?a - agents)
:precondition (and
)
:effect (and
(media_contacted ?a)
(increase (total-cost) (duration_contact_media))
)
)
(:action set_up_helpline
:parameters (?a - agents)
:precondition (and
(media_contacted ?a)
)
:effect (and
(active_helpline ?a)
(increase (total-cost) (duration_set_up_helpline))
)
)
(:action issue_local_alert
:parameters (?a - agents)
:precondition (and
(media_contacted ?a)
)
:effect (and
(active_local_alert ?a)
(not (needed_active_local_alert ?a))
(not_needed_active_local_alert ?a)
(increase (total-cost) (duration_issue_local_alert))
)
)
(:action block_road
:parameters (?a - transport ?from - location ?to - location)
:precondition (and
(active_local_alert ?a)
(positioned_policemen ?to)
(deployed_police_cars ?to)
(positioned_policemen ?from)
(deployed_police_cars ?from)
)
:effect (and
(blocked_road ?from ?to)
(needed_diverted_traffic ?from ?to)
(not (not_needed_diverted_traffic ?from ?to))
(needed_active_local_alert ?a)
(not (not_needed_active_local_alert ?a))
(increase (total-cost) (duration_block_road))
)
)
(:action divert_traffic
:parameters (?a - transport ?from - location ?to - location)
:precondition (and
(active_local_alert ?a)
(blocked_road ?from ?to)
)
:effect (and
(traffic_diverted ?from ?to)
(not (needed_diverted_traffic ?from ?to))
(not_needed_diverted_traffic ?from ?to)
(increase (total-cost) (duration_unit_actions))
)
)
(:action prepare_evacuation
:parameters (?a - police ?from - location)
:precondition (and
(active_local_alert ?a)
)
:effect (and
(prepared_evacuation ?from)
(increase (total-cost) (duration_prepare_evacuation))
)
)
(:action evacuate
:parameters (?a - police ?from - location ?to - location)
:precondition (and
(prepared_evacuation ?from)
(positioned_policemen ?from)
(deployed_police_cars ?from)
(blocked_road ?from ?to)
)
:effect (and
(evacuated ?from ?to)
(increase (total-cost) (duration_evacuation))
)
)
(:action extinguish_small_fire
:parameters (?a - fire ?at - pois)
:precondition (and
(fire_at ?at)
(small_fire_at ?at)
(deployed_engines ?at)
)
:effect (and
(extinguished_fire ?at)
(not (fire_at ?at))
(not (small_fire_at ?at))
(needed_address_media)
(not (not_needed_address_media))
(needed_search_casualties ?at)
(not (not_needed_search_casualties ?at))
(increase (total-cost) (duration_extinguish_small_fire))
)
)
(:action extinguish_big_fire
:parameters (?a - fire ?at - pois)
:precondition (and
(fire_at ?at)
(deployed_big_engines ?at)
)
:effect (and
(extinguished_fire ?at)
(not (fire_at ?at))
(needed_search_casualties ?at)
(not (not_needed_search_casualties ?at))
(increase (total-cost) (duration_extinguish_big_fire))
)
)
(:action barricade
:parameters (?a - fire ?at - pois)
:precondition (and(deployed_engines ?at))
:effect (and
(barricaded ?at)
(needed_active_local_alert ?a)
(not (not_needed_active_local_alert ?a))
(not (needed_barricade ?at))
(not_needed_barricade ?at)
(increase (total-cost) (duration_barricade))
)
)
(:action search_casualties
:parameters (?a - fire ?at - pois)
:precondition (and
(extinguished_fire ?at)
(deployed_bulldozers ?at)
(deployed_helicopters ?at)
(deployed_rescuers ?at)
)
:effect (and
(searched ?at)
(needed_attend_casualties ?at)
(not (not_needed_attend_casualties ?at))
(needed_address_media)
(not (not_needed_address_media))
(increase (total-cost) (duration_search_casualties))
)
)
(:action attend_casualties
:parameters (?a - medic ?at - pois)
:precondition (and
(needed_attend_casualties ?at)
(deployed_ambulances ?at)
)
:effect (and
(attended_casualties ?at)
(not (needed_attend_casualties ?at))
(not_needed_attend_casualties ?at)
(needed_address_media)
(not (not_needed_address_media))
(increase (total-cost) (duration_attend_casualties))
)
)
(:action address_media
:parameters (?a - agents)
:precondition (and
(media_contacted ?a)
(needed_address_media)
)
:effect (and
(addressed_media)
(not (needed_address_media))
(not_needed_address_media)
(increase (total-cost) (duration_address_media))
)
)
)
(define (problem BYENG) (:domain RADAR)
(:objects
policeChief - police
firechief - fire
medichief - medic
transportchief - transport
apachestation courtstation substation - policestation
adminfire mesafire scottsfire phxfire - firestation
lukes joseph - hospital
lake mill marketplace rural byeng - pois
)
(:init
(fire_at byeng)
(=(total-cost) 0.0)
(not_needed_search_casualties lake )
(not_needed_attend_casualties lake )
(not_needed_diverted_traffic lake lake)
(not_needed_diverted_traffic lake mill)
(not_needed_diverted_traffic lake marketplace)
(not_needed_diverted_traffic lake rural)
(not_needed_diverted_traffic lake byeng)
(not_needed_search_casualties mill )
(not_needed_attend_casualties mill )
(not_needed_diverted_traffic mill lake)
(not_needed_diverted_traffic mill mill)
(not_needed_diverted_traffic mill marketplace)
(not_needed_diverted_traffic mill rural)
(not_needed_diverted_traffic mill byeng)
(not_needed_search_casualties marketplace )
(not_needed_attend_casualties marketplace )
(not_needed_diverted_traffic marketplace lake)
(not_needed_diverted_traffic marketplace mill)
(not_needed_diverted_traffic marketplace marketplace)
(not_needed_diverted_traffic marketplace rural)
(not_needed_diverted_traffic marketplace byeng)
(not_needed_search_casualties rural )
(not_needed_attend_casualties rural )
(not_needed_diverted_traffic rural lake)
(not_needed_diverted_traffic rural mill)
(not_needed_diverted_traffic rural marketplace)
(not_needed_diverted_traffic rural rural)
(not_needed_diverted_traffic rural byeng)
(not_needed_search_casualties byeng )
(not_needed_attend_casualties byeng )
(not_needed_diverted_traffic byeng lake)
(not_needed_diverted_traffic byeng mill)
(not_needed_diverted_traffic byeng marketplace)
(not_needed_diverted_traffic byeng rural)
(not_needed_diverted_traffic byeng byeng)
(not_needed_active_local_alert policeChief )
(not_needed_active_local_alert firechief )
(not_needed_active_local_alert medichief )
(not_needed_active_local_alert transportchief )
(not_needed_address_media )
(has_small_engines_number adminfire)
(has_ladders_number adminfire)
(has_bulldozers_number adminfire)
(has_helicopters_number adminfire)
(has_rescuers_number adminfire)
(has_ladders_number mesafire)
(has_rescuers_number mesafire)
(has_small_engines_number scottsfire)
(has_ladders_number scottsfire)
(has_bulldozers_number scottsfire)
(has_rescuers_number scottsfire)
(has_ladders_number phxfire)
(has_bulldozers_number phxfire)
(has_helicopters_number phxfire)
(has_rescuers_number phxfire)
(has_ambulances_number joseph)
(has_policemen_number apachestation)
(has_police_car_number courtstation)
(has_police_car_number substation)
(has_policemen_number substation)
(=(duration_unit_actions) 1)
(=(duration_deploy_police_cars) 1)
(=(duration_deploy_small_engines) 2)
(=(duration_deploy_big_engines) 4)
(=(duration_deploy_ladders) 3)
(=(duration_deploy_bulldozers) 3)
(=(duration_deploy_helicopters) 3)
(=(duration_deploy_rescuers) 3)
(=(duration_deploy_ambulances) 2)
(=(duration_position_policemen) 1)
(=(duration_contact_media) 1)
(=(duration_set_up_helpline) 1)
(=(duration_issue_local_alert) 1)
(=(duration_block_road) 2)
(=(duration_prepare_evacuation) 1)
(=(duration_evacuation) 5)
(=(duration_extinguish_small_fire) 1)
(=(duration_extinguish_big_fire) 1)
(=(duration_barricade) 1)
(=(duration_search_casualties) 3)
(=(duration_address_media) 2)
(=(duration_attend_casualties) 3)
)
(:goal
(and
(extinguished_fire byeng)
(addressed_media)
)
)
(:metric minimize (total-cost))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment