PDDL syntax error, ':DURATIVE-ACTIONS' : domain definition expected - pddl

I was modeling a domain file with durative actions. I am using the PDDL plugin for VS Code. The code does not have any syntax error problems. The Planner from HTTP://solver.planning.domains/solve return an error
/tmp/solver_planning_domains_tmp_41rdIKx0z0gCb/domain.pddl: syntax error in line 5, ':DURATIVE-ACTIONS': domain definition expected Failed to parse the problem -- list index out of range
The complete domain file big to post here, so the related part of code is:
I appreciated your help.
(define (domain test)
(:requirements :strips :typing :fluents :durative-actions :duration-inequalities :negative-preconditions :equality )
(:types
getbot - robot
wp0 wp1 charging_station object_location - location
a1 a2 a3 - area
bat1 charger - power
gripper
obj- object
)
(:predicates
;General predicates
(robot-at ?rb - robot ?l - location)
(location-situated ?l - location ?a - area) ;location situated in which area
;Gripper related predicates
(object-found ?o - object)
(object-at ?o - object ?obj_loc - location)
(object-placed ?o - object ?obj_loc - location)
(gripper-empty ?rb - robot ?gr - gripper)
(holding-object ?rb - robot ?o - object)
Thank you in advance

The planner on that server doesn't support durative actions.

Related

Error when domain and the problem to use durative-actions

I'm taking the yb_drill_TBM2 example and converting it for use with a time planner (POPF).
I am not able to identify the error can you help me?
DOMAIN:
; Specification in PDDL1 of the rockin TBM2 drill test domain
; author : Oscar Lima, olima_84#yahoo.com
(define (domain idmind_agent)
(:requirements :strips :typing :fluents :negative-preconditions :disjunctive-preconditions :durative-actions )
(:types
location ; locations in the arena, points of interest
robot ; your amazing yet powerful robot
object ; objects to be manipulated by the robot
gripper ; robot gripper
robot_platform ; platform slots for the robot to store objects
)
(:predicates
; robot ?r is at location ?l
(at ?r - robot ?l - location)
; object ?o is on location ?l
(on ?o - object ?l - location)
; object ?o is stored on robot platform ?rp
(stored ?o - object ?rp - robot_platform)
; robot platform ?rp is occupied, yb has 3 free places to store objects
(occupied ?rp - robot_platform)
; gripper ?g is holding object ?o
(holding ?g - gripper ?o - object)
; gripper ?g is free (does not contain object)
(gripper_is_free ?g - gripper)
)
; moves a robot ?r from ?source - location to a ?destination - location
; NOTE : the situation in which the robot arm is in any position before moving
; is not handled at the planning level, hence we advise to always move the arm
; to a folded position, then navigate
(:durative-action move_base
:parameters (?source ?destination - location ?r - robot ?g - gripper)
:duration (= ?duration 1)
:condition (and (at start (at ?r ?source))
(over all (gripper_is_free ?g))
)
:effect (and
(at start (not (at ?r ?source)))
(at end (at ?r ?destination))
)
)
; pick an object ?o which is inside a location ?l with a free gripper ?g
; with robot ?r that is at location ?l
(:durative-action pick
:parameters (?o - object ?l - location ?r - robot ?g - gripper)
:duration (= ?duration 1)
:condition (and (at start (on ?o ?l))
(over all (at ?r ?l))
(at start (gripper_is_free ?g))
)
:effect (and (at end (holding ?g ?o))
(at start (not (on ?o ?l)))
(at start (not (gripper_is_free ?g)))
)
)
; stage an object ?o in a robot platform ?rp which is not occupied with a gripper ?g
; which is holding the object ?o
(:durative-action stage
:parameters (?o - object ?rp - robot_platform ?g - gripper)
:duration (= ?duration 1)
:condition (and (at start (holding ?g ?o))
(at start (not (occupied ?rp)))
(at start (not (gripper_is_free ?g)))
)
:effect (and (at start (not (holding ?g ?o)))
(at start (gripper_is_free ?g))
(at start (stored ?o ?rp))
(at start (occupied ?rp))
)
)
; unstage an object ?o stored on a robot platform ?rp with a free gripper ?g
(:durative-action unstage
:parameters (?o - object ?rp - robot_platform ?g - gripper)
:duration (= ?duration 1)
:condition (and (at start (gripper_is_free ?g))
(at start (stored ?o ?rp))
(at start (not (holding ?g ?o)))
)
:effect (and (at start (not (gripper_is_free ?g)))
(at start (not (stored ?o ?rp)))
(at start (not (occupied ?rp)))
(at start(holding ?g ?o))
)
)
; places and object ?o with a gripper ?g which is holding the object ?o
; with a robot ?r at a location ?l on robot_platform ?rp
(:durative-action drop_on_platform
:parameters (?o - object ?l - location ?g - gripper ?r - robot ?rp - robot_platform)
:duration (= ?duration 1)
:condition (and (over all (at ?r ?l))
(at start (holding ?g ?o))
(at start (not (stored ?o ?rp)))
)
:effect (and (at end (gripper_is_free ?g)) ; the gripper is free
(at end (on ?o ?l)) ; object is now on location l
(at start (not (holding ?g ?o))) ; the gripper is no longer holding the object
)
)
)
Problem:
(define (problem problem_1)
(:domain idmind_agent)
(:objects
dock S1 S2 S3 S4 S5 - location
platform_middle platform_left platform_right - robot_platform
idmind - robot
o1 o2 - object
robotiq - gripper
)
(:init
(at idmind dock)
(on o1 S2)
(on o2 S2)
(not (occupied platform_middle))
(not (occupied platform_left))
(not (occupied platform_right))
(gripper_is_free robotiq)
)
(:goal
(and
(on o1 S1)
(on o2 S4)
)
)
)
But I'm getting this error that I'm not being able to understand. I wonder if you can help me with what I'm missing.
rosrun rosplan_planning_system popf new.domain.pddl new_problem.pddl
Critical Errors Encountered in Domain/Problem File
--------------------------------------------------
Due to critical errors in the supplied domain/problem file, the planner
has to terminate. The errors encountered are as follows:
Errors: 1, warnings: 9
new_problem.pddl: line: 11: Warning: Undeclared requirement :typing
new_problem.pddl: line: 11: Warning: Undeclared requirement :typing
new_problem.pddl: line: 11: Warning: Undeclared requirement :typing
new_problem.pddl: line: 11: Warning: Undeclared requirement :typing
new_problem.pddl: line: 11: Warning: Undeclared requirement :typing
new_problem.pddl: line: 14: Warning: Undeclared symbol: at
new_problem.pddl: line: 15: Warning: Undeclared symbol: on
new_problem.pddl: line: 17: Warning: Undeclared symbol: occupied
new_problem.pddl: line: 20: Warning: Undeclared symbol: gripper_is_free
new_problem.pddl: line: 30: Error: Syntax error in problem file - types used, but no :types section in domain file.
Thank you very much in advance for your help.

SPARQL: Understanding what value gets assigned to variable

Hi I am new to SPARQL and I would like to understand better some things regarding variable assigments. Lets say I have the below:
SELECT ?z WHERE
{
?x n:type 'Type_1' .
?x n:belongs ?r .
?r n:belongs ?z .
?y n:type 'Type_1' .
?y n:belongs ?r_2 .
?r_2 n:belongs ?z . FILTER(?x != ?y)
}
In the above example query ?r and ?r_2 from my understanding have different values stored inside .Does the same applies for both variables ?z, or because both have the same name also have the same value stored inside?. An explanation would be appreciated. Cheers!
You can think of SPARQL as a template. It is a declarative language where you explicitly put in the things you know, and you put in variables for the things you don't.
The query executes, and puts the values of the things you don't yet know, into the response, against the variable names.
A variable called 'x' is the same variable throughout the query. It's response value is 'bound' to the parameter 'x'.
There is a SPARQL tutorial which I wrote in the open source graph-notebook project found here: https://github.com/aws/graph-notebook
After you run the notebook, navigate to 06-LANGUAGE-TUTORIALS
Although it was originally built for Amazon Neptune, it is open source and will work with any SPARQL 1.1 endpoint.

PDDL forall with when condition in durative-action

This question builds on a previous question about forall clauses. I would like to limit the forall with a 'when' statement as shown below:
(:durative-action finish
:parameters (?r - robot ?p - part)
:duration ( = ?duration 1)
:condition (and
(at start (robot_free ?r))
(at start (forall (?f - fastener_loc)
when (part_fastener ?p ?f)
(loc_not_fastened ?f)
)
)
)
:effect (and
(at start(not (robot_free ?r)))
(at end (part_free ?p))
(at end (robot_free ?r))
)
)
This works without the 'when' statement. When I include the 'when' statement, I receive several errors:
Error: Syntax error in durative-action declaration.
Error: Unreadable structure
Error: Syntax error in domain
Thanks in advance for any help.
I was able to get this to work with an imply statement.
(:durative-action finish
:parameters (?r - robot ?p - part)
:duration ( = ?duration 1)
:condition (and
(at start (robot_free ?r))
(at start (forall (?f - fastener_loc)
(imply (part_fastener ?p ?f)(loc_not_fastened ?f))
)
)
)
:effect (and
(at start(not (robot_free ?r)))
(at end (part_free ?p))
(at end (robot_free ?r))
)
)
Not sure if this could also work the the when syntax.
The when clause needs to be wrapped in (brackets)
The when keyword is restricted to conditional effects.
You can see the definition in the PDDL3.1 BNF.
Be a bit careful when combining forall with imply, because it could lead to a nasty combinatorial explosion. Keep in mind that imply typically gets flattened (Negation Normal Form) to a disjunction. So in your case it would become:
(or (not (part_fastener ?p ?f)) (loc_not_fastened ?f))
Which planners typically split into two separate actions (to remove disjunctions), one with (not (part_fastener ?p ?f)) as its precondition, and one with (loc_not_fastened ?f).
The forall then explodes this to all pairwise combinations of the disjunction, to ground it to all instances of fastener_loc, combined with all grounded combinations of robot and part action parameters (to generate the grounded actions themselves).
If you only have a few objects of each type I guess you should be OK.

SPARQL performance in property path query Sesame / rdf4j

Let's say I want to find all subjects which are connected with objects via property path. The connection could be represented:
Subject - prop 1 -> A - prop 2 -> B - prop 3 -> Object
This could be achieved by quite simple SPARQL query:
SELECT ?s WHERE {
?s prop1/prop2/prop3 ?o .
VALUES ?o { <uri1> ... <urin> }
}
But I also want to include paths which use subclasses of A and/or B:
Subject - prop 1 -> subclassOfA - prop 2 -> subclassOfB - prop 3 -> Object
To achieve this I've added intermediate "sublassOf" property into the the path:
SELECT ?s WHERE {
?s prop1/<subclassOf>*/prop2/<subclassOf>*/prop3 ?o .
VALUES ?o { <uri1> ... <urin> }
}
This worked really fast on my dataset in Sesame 2.7.2, but after migrating to rdf4j 2.5.2 this query just hangs. The question is whether this is the correct way of querying this way or there's something much more efficient? And what could've caused such a significant performance drop in the new versions?

Default RDFS inference in Virtuoso 7.x

This is a question about simple RDFS inference in Virtuoso 7.1 and DBpedia. I have a Virtuoso instance which was installed using this link as a reference. Now if I query the endpoint with the following query :
Select ?s
where { ?s a <http://dbpedia.org/ontology/Cricketer> . }
I get a list of Cricketers that are present in DBpedia. Suppose I want all the athletes (all sports and cricketers included, where Athlete is rdfs:superClassOf Cricketer), I just try the query
Select ?s
where { ?s a <http://dbpedia.org/ontology/Athlete> . }
For this I get all the correct answers. However I have an issue with rdfs:subPropertyOf. For example the property <http://dbpedia.org/ontology/capital> is the sub-property of <http://dbpedia.org/ontology/administrativeHeadCity>. So suppose I want all the capitals and the administrative head cities and I issue the query
Select ?s ?o
where { ?s <http://dbpedia.org/ontology/administrativeHeadCity> ?o . }
I get zero results. Why is it that subproperty inference isn't working in DBpedia? Is there something else that I have missed?
You've missed a couple of things.
First, Virtuoso is at 7.2.4 as of April 2016, and this version is strongly recommended over the old version from 2014, for many reasons.
#AKSW's advice about Property Paths will work much better with this later version, too.
Then, you can use inference on the DBpedia endpoint (including your local mirror), through the input:inference pragma, as shown on the live results of the query shown below --
DEFINE input:inference "http://dbpedia.org/resource/inference/rules/dbpedia#"
SELECT ?place ?HeadCity
WHERE
{
?place <http://dbpedia.org/ontology/administrativeHeadCity> ?HeadCity
}
ORDER BY ?place ?HeadCity
You can also see a list of predefined inference rule sets.
And... more of the relevant documentation.
(ObDisclaimer: I work for OpenLink Software, producer of Virtuoso.)
There is no automatic inference enabled in DBpedia. DBpedia itself is a dataset loaded into Virtuoso.
The reason that you get all instances with a superclass like dbo:Athlete is that subclass-inheritance is fully materialized in the current DBpedia dataset:
(s rdf:type c1), (c1 rdfs:subClassOf c2) -> (s rdf:type c2)
That means that for each individual x, the DBpedia dataset contains all the classes C it belongs to - in fact also the superclasses.
That procedure was not done for subproperty-inheritance, i.e.,
(s p1 o), (p1 rdfs:subPropertyOf p2) -> (s p2 o)
You can solve that problem with SPARQL 1.1 property paths:
SELECT ?s ?o WHERE {
?p rdfs:subPropertyOf* <http://dbpedia.org/ontology/administrativeHeadCity> .
?s ?p ?o .
}