I have been working on a project about the well known problem fox-goose-beans-farmer. I am trying to implement it on a browser based compiler which is https://stripsfiddle.herokuapp.com/ . All of the functions except moveFoxAcross and moveFoxBack works. I couldn't see any flaws. Can someone point out my mistake or suggest any valid syntax source. Here is my domain code:
(define (domain domain-FGB)
(:requirements :strips :typing)
(:types fox goose beans farmer onLeftBank)
(:action moveGooseAcross
:parameters (?g - goose ?l - onLeftBank ?f - farmer)
:precondition (and (not (at ?g ?l)) (not (at ?f ?l)))
:effect (and (at ?g ?l) (at ?f ?l))
)
(:action moveFoxAcross
:parameters (?fo - fox ?l - onLeftBank ?f - farmer ?b - beans ?g - goose)
:precondition (and (not (at ?fo ?l)) (not (at ?f ?l))(or (and (not (at ?b ?l)) (at ?g ?l)) (and (at ?b ?l) (not (?g ?l)))))
:effect (and (at ?fo ?l) (at ?f ?l))
)
(:action moveBeansAcross
:parameters (?b - beans ?fo - fox ?l - onLeftBank ?f - farmer ?g - goose)
:precondition (and (not (at ?b ?l)) (not (at ?f ?l))(or (and (not (at ?fo ?l)) (at ?g ?l)) (and (at ?fo ?l) (not (at ?g ?l)))))
:effect (and (at ?b ?l) (at ?f ?l))
)
(:action farmerAcrossRiver
:parameters (?f - farmer ?l - onLeftBank)
:precondition (not (at ?f ?l))
:effect (at ?f ?l)
)
(:action moveGooseBack
:parameters (?g - goose ?l - onLeftBank ?f - farmer)
:precondition (and (at ?g ?l) (at ?f ?l))
:effect (and (not (at ?g ?l)) (not (at ?f ?l))))
(:action moveFoxBack
:parameters (?fo - fox ?l - onLeftBank ?f - farmer ?b - beans ?g - goose)
:precondition (and (at ?fo ?l) (at ?f ?l) (or (and (not (at ?b ?l)) (at ?g ?l)) (and (at ?b ?l) (not (?g ?l)))))
:effect (and (not (at ?fo ?l)) (not (at ?f ?l))))
(:action moveBeansBack
:parameters (?b - beans ?fo - fox ?l - onLeftBank ?f - farmer ?g - goose)
:precondition (and (at ?b ?l) (at ?f ?l)(or (and (not (at ?fo ?l)) (at ?g ?l)) (and (at ?fo ?l) (not (at ?g ?l)))))
:effect (and (not (at ?b ?l)) (not (at ?f ?l))))
(:action farmerGoesBack
:parameters (?f - farmer ?l - onLeftBank)
:precondition (at ?f ?l)
:effect (not (at ?f ?l))
))
Here is my problem code:
(define (problem FGB)
(:domain domain-FGB)
(:objects
FOX - fox
GOOSE - goose
BEANS - beans
FARMER - farmer
ONLEFTBANK - onLeftBank)
(:init
(and (not(at FOX ONLEFTBANK)) (not(at GOOSE ONLEFTBANK)) (not(at FARMER ONLEFTBANK)) (not(at BEANS ONLEFTBANK))))
(:goal (and (at FOX ONLEFTBANK) (at GOOSE ONLEFTBANK) (at FARMER ONLEFTBANK) (at BEANS ONLEFTBANK))))
You can just select "Create your own" from the list at the domain section and copy/paste my code to try it yourself.
Thanks in advance
The problem is the missing "at" in the second and clause of the second or clause. The capital AT below.
:precondition (and
(not (at ?fo ?l))
(not (at ?f ?l))
(or (and
(not (at ?b ?l))
(at ?g ?l)
)
(and
(at ?b ?l)
(not (AT ?g ?l))
)
)
)
But I could not find a solution with this correction. I keep on working and will inform if find any solution.