(define (domain logistics-domain) (:requirements :typing :equality :disjunctive-preconditions :probabilistic-effects :existential-preconditions :conditional-effects :rewards) (:types city box) (:constants newyork - city chicago - city losangeles - city detroit - city) (:predicates (box-at-city ?b - box ?c - city) (destination ?b - box ?dst - city) ) (:action drive-box :parameters (?b - box ?src - city ?dst - city) ;;box, source, destination :precondition (and (not (destination ?b ?src)) (box-at-city ?b ?src) ;;make sure the box is at src (or ;;now make sure the box can go to dst from src (and (= ?src newyork) ;;newyork (or (= ?dst chicago) ;;can go to chicago ) ) (and (= ?src chicago) ;;chicago (or (= ?dst newyork) ;;can go to newyork ) ) ) ) :effect (and (not (box-at-city ?b ?src)) ;;take the box out of the city (and (when (= ?src newyork) ;;for newyork (probabilistic 0.2 (probabilistic ;;box gets lost, send to random adjacent city 0.3 (and (decrease (reward) 10) ;;the cost to go to chicago (box-at-city ?b chicago) (when (destination ?b chicago) (increase (reward) 50)) ) 0.7 (box-at-city ?b newyork) ) 0.8 (and ;;most of the time you get where you want to (when (= ?dst chicago) (decrease (reward) 10)) (when (destination ?b ?dst) (increase (reward) 50)) (box-at-city ?b ?dst) ;;put the box at dst ) ) ) (when (= ?src chicago) ;;for chicago (probabilistic 0.2 (probabilistic ;;box gets lost, send to random adjacent city 0.3 (and (decrease (reward) 10) ;;the cost to go to newyork (box-at-city ?b newyork) (when (destination ?b newyork) (increase (reward) 50) ) ) 0.7 (box-at-city ?b chicago) ) 0.8 (and ;;most of the time you get where you want to (when (= ?dst newyork) (decrease (reward) 10)) ;;cost for chicago (box-at-city ?b ?dst) ;;put the box at dst (when (destination ?b ?dst) (increase (reward) 50) ) ) ) ) ) ;; (when (exists (?city - city) ;; (and (box-at-city ?b ?city) ;; (destination ?b ?city) ;; ) ;; ) ;; (increase (reward) 50) ;; ) ) ) ) (define (problem logistics-problem) (:domain logistics-domain) (:objects mybox - box) (:init (box-at-city mybox newyork) (destination mybox chicago) ) (:metric maximize (reward)) )