Last active
September 2, 2021 12:15
-
-
Save ivancorrales/ed5cd0519fcadb362cddc3e04217bd92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Header and description | |
(define (domain restaurant) | |
;remove requirements that are not needed | |
(:requirements :typing :strips :fluents :durative-actions :timed-initial-literals :typing :conditional-effects :negative-preconditions :duration-inequalities :equality) | |
(:types waiter group table) | |
; un-comment following line if constants are needed | |
;(:constants ) | |
(:predicates | |
; the group is waiting to be accompanied to the table | |
(waiting_for_a_table ?g - group) | |
; the poeple in the group ar lloking at the menu to decided | |
; what they want to eat | |
(looking_the_menu ?g - group) | |
; The people in the group already know what they want to order | |
(ready_to_order ?g - group) | |
; The group is waiting for the food | |
(waiting_for_the_food ?g - group) | |
; The people in the group are ready to eat | |
(ready_to_eat ?g - group) | |
; The group is asking the bill | |
(ask_for_the_bill ?g - group) | |
; The group has left the restaurant | |
(bye ?g -group) | |
; The waiter can attend the people or perform actions, otherwise | |
; the waiter will be busy doing other issues | |
(is_available ?w - waiter) | |
; The table is free, otherwise the table will be busied by | |
; a group | |
(is_free ?t - table) | |
; The table is assigned to the group | |
(assigned ?t - table ?g - group ) | |
; The food is cooked for the group | |
(is_cooked_food ?g - group) | |
; The order is received in the kitchen | |
(order_received ?g - group) | |
) | |
(:functions | |
; It returns the number or people in a group | |
(group_size ?g - group) | |
; The total tips received by the waiter | |
(tips ?w - waiter) | |
; The number of chairs in the table | |
(capacity ?t - table) | |
) | |
; The waiter will assign a table to the group | |
(:durative-action ASSIGN-TABLE-TO-GROUP | |
; Elements involves in this action: The table, the waiter and | |
; the group | |
:parameters (?w - waiter ?t - table ?g - group) | |
; The spend time on this action is 1 minute | |
:duration (= ?duration 1) | |
; The waiter is available | |
; The table must be free | |
; The group must be waiting for a table | |
; The capacity of the table must be equal or greater than the | |
; number of perople in the group | |
:condition (and | |
(at start (is_available ?w)) | |
(at start (is_free ?t)) | |
(at start (waiting_for_a_table ?g)) | |
(at start (>= (capacity ?t) (group_size ?g))) | |
) | |
;Effects when the action starts: | |
; The table is not free,it cannot be assigned to other group | |
; The table is assigned to the group | |
; The groups is not waiting for a table anymore | |
; The waiter is not available | |
; Effects when the action ends: | |
; The waiter is available again | |
; The group starts to look at the menu | |
:effect (and | |
(at start ( not (is_free ?t))) | |
(at start (assigned ?t ?g )) | |
(at start ( not (waiting_for_a_table ?g))) | |
(at start (not(is_available ?w))) | |
(at end (is_available ?w)) | |
(at end (looking_the_menu ?g)) | |
) | |
) | |
; The group decides what they want to eat | |
(:durative-action DECIDE-WHAT-TO-EAT | |
; Only a group is involved in this action | |
:parameters (?g - group) | |
; This action will take always 5 minutes | |
:duration (= ?duration 5) | |
; The action starts when the predicate looking_the_menu | |
; is true | |
:condition (and | |
(at start (looking_the_menu ?g)) | |
) | |
;Effects when the action starts: | |
; The group need to change the value of this predicate | |
; to avoid execute this action more than once | |
; Effects when the action ends: | |
; The group is ready to order when the action ends | |
:effect (and | |
(at start ( not (looking_the_menu ?g))) | |
(at end (ready_to_order ?g)) | |
) | |
) | |
; The group order the food to the waiter | |
(:durative-action ORDER-FOOD | |
:parameters (?g - group ?w - waiter ) | |
; This action will take 30' per person in the group | |
:duration (= ?duration (* (group_size ?g) 0.5) ) | |
; The waiter must be available | |
; The group must be ready to order | |
:condition (and | |
(at start (is_available ?w)) | |
(at start (ready_to_order ?g)) | |
) | |
;Effects when the action starts: | |
; The waiter is not available | |
; The groups is not ready to order anymore | |
; Effects when the action ends: | |
; The waiter is available again | |
; The groups is waiting for being served the food | |
; The order for the group is received | |
:effect (and | |
(at start (not(is_available ?w))) | |
(at start (not (ready_to_order ?g))) | |
(at end (is_available ?w)) | |
(at end (waiting_for_the_food ?g)) | |
(at end (order_received ?g)) | |
) | |
) | |
; The food is cooked | |
(:durative-action COOKING-FOOD | |
:parameters (?g - group) | |
; Cooking the food will take 4 minutes per person in the group | |
:duration (= ?duration (* 4 (group_size ?g))) | |
:condition (and | |
(at start (waiting_for_the_food ?g)) | |
(at start (order_received ?g)) | |
) | |
;Effects when the action starts: | |
; The waiter is not available | |
; The groups is not ready to order anymore | |
; Effects when the action ends: | |
; The waiter is available again | |
; The groups is waiting for being served the food | |
:effect (and | |
(at start (order_received ?g)) | |
(at end (is_cooked_food ?g)) | |
) | |
) | |
; The food is served to the groups | |
(:durative-action SERVE-THE-FOOD | |
:parameters (?w - waiter ?g - group) | |
; The action will take 45' per person in the group | |
:duration (= ?duration (* 0.75 (group_size ?g))) | |
; The waiter is available | |
; The group is wating for the food | |
; The food is cooked | |
:condition (and | |
(at start (is_available ?w)) | |
(at start (waiting_for_the_food ?g)) | |
(at start (is_cooked_food ?g)) | |
) | |
;Effects when the action starts: | |
; The waiter is not available | |
; The groups is not waiting for the food anumore | |
; The food is not cooked | |
; Effects when the action ends: | |
; The waiter is available again | |
; The people in the group are ready to eat | |
:effect (and | |
(at start (not(is_available ?w))) | |
(at start (not (waiting_for_the_food ?g))) | |
(at start (not(is_cooked_food ?g))) | |
(at end (is_available ?w)) | |
(at end (ready_to_eat ?g)) | |
) | |
) | |
; The people in the group start to eat | |
(:durative-action EAT | |
:parameters (?g - group) | |
; This will take 20 minutes always | |
:duration (= ?duration 20 ) | |
; The group must must be ready to eat | |
:condition (and | |
(at start (ready_to_eat ?g)) | |
) | |
;Effects when the action starts: | |
; The groups is not ready to eat | |
; Effects when the action ends: | |
; The group ask for the bill | |
:effect (and | |
(at start (not (ready_to_eat ?g))) | |
(at end (ask_for_the_bill ?g)) | |
) | |
) | |
; The group pay the bill and leave the restaurant | |
(:durative-action PAY-BILL-AND-SAY-BYE | |
:parameters (?w - waiter ?g - group ?t - table) | |
; We assume that this action will always take 3 minutes | |
:duration (= ?duration 3 ) | |
; The group asks for the bill | |
; The waiter is available | |
; The table is assigned to this group | |
:condition (and | |
(at start (ask_for_the_bill ?g)) | |
(at start (is_available ?w)) | |
(at start (assigned ?t ?g )) | |
) | |
;Effects when the action starts: | |
; The waiter is not available | |
; The groups is not asking for the bill anymore | |
; Effects when the action ends: | |
; The waiter is available again | |
; The group say "bye", leave the restaurant | |
; The table is free | |
; The waiter receives a tip (1,5€|$ per person) | |
:effect (and | |
(at start (not(is_available ?w))) | |
(at start (not(ask_for_the_bill ?g))) | |
(at end (is_available ?w)) | |
(at end (bye ?g)) | |
(at end (is_free ?t)) | |
(at end (increase (tips ?w) (* 1.5 (group_size ?g)))) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment