I am trying to generate an AI plan using PDDL. here is my problem and domain files
problem.pddl
;Header and description
(define (problem lung-cancer-problem)
(:domain lung-cancer)
(:objects
patient1 - patient
model1 model2 model3 - model)
(:init
(not (model-trained model1))
(not (model-trained model2))
(not (model-trained model3)))
(:goal
(and (model-diagnoses model1 patient1)
(model-diagnoses model2 patient1)
(model-diagnoses model3 patient1)
(or (has-lung-cancer patient1)
(not (has-lung-cancer patient1))))))
domain.pddl
;Header and description
(define (domain lung-cancer)
;remove requirements that are not needed
(:requirements :strips :typing :conditional-effects :negative-preconditions :duration-inequalities :equality)
(:types patient model - object)
(:predicates (has-lung-cancer ?p - patient)
(model-trained ?m - model)
(model-diagnoses ?m - model ?p - patient)
)
(:action train-model
:parameters (?m-model)
:precondition (not(model-trained ?m))
:effect (and (model-trained ?m))
)
(:action diagnose-patient
:parameters (?p-patient ?m-model)
:precondition (and(model-trained ?m))
:effect (and (model-diagnoses ?m ?p)
(or (has-lung-cancer ?p)
(not (has-lung-cancer ?p))))
)
)
I am getting error undeclared variable ?m and ?P in the domain file (or (has-lung-cancer ?p) (not (has-lung-cancer ?p)))) Syntax error in the action declaration
How do I solve these?
I generated the codes using ChatGPT
You need spaces around the
-in your:parametersblock. More importantly, you probably should write the PDDL yourself, since ChatGPT isn't (yet) capable of producing decent PDDL (obviously).