Skip to content

Fixes for numeric planning#136

Closed
DillonZChen wants to merge 3 commits into
AI-Planning:mainfrom
DillonZChen:main
Closed

Fixes for numeric planning#136
DillonZChen wants to merge 3 commits into
AI-Planning:mainfrom
DillonZChen:main

Conversation

@DillonZChen

Copy link
Copy Markdown
Collaborator

Proposed changes

Fix the minus expression for parsing domains.

As an example the code

from pddl.parser.domain import DomainParser

domain = DomainParser()(
    """
;; https://github.com/ipc2023-numeric/ipc2023-dataset/blob/main/block-grouping/domain.pddl
;; Enrico Scala (enricos83@gmail.com) and Miquel Ramirez (miquel.ramirez@gmail.com)

(define (domain mt-block-grouping)
    (:requirements :typing :numeric-fluents)
    (:types block - object )
    (:functions
        (x ?b - block)  ;; The position of a block
        (y ?b - block)  ;;
        (max_x)
        (min_x)
        (max_y)
        (min_y)
    )

    ;; Move a block from its location to an adjacent location
    (:action move_block_up
     :parameters (?b - block)
     :precondition (and (<= (+ (y ?b)1) (max_y) ))
     :effect (and
        (increase (y ?b) 1)
    ))

    (:action move_block_down
     :parameters (?b - block)
     :precondition (and (>= (- (y ?b) 1) (min_y) ))
     :effect (and
        (decrease (y ?b) 1)
    ))

    (:action move_block_right
     :parameters (?b - block)
     :precondition (and (<= (+ (x ?b)1) (max_x) ))
     :effect (and
        (increase (x ?b) 1)
    ))

    (:action move_block_left
     :parameters (?b - block)
     :precondition (and (>= (- (x ?b) 1) (min_x) ))
     :effect (and
        (decrease (x ?b) 1)
    ))
)
"""
)

causes the error

KeyError: 'NUMBER'

During handling of the above exception, another exception occurred:

lark.exceptions.UnexpectedToken: Unexpected token Token('NUMBER', '1') at line 26, column 39.
Expected one of: 
	* RPAR

Fixes

Remove a seemingly unnecessary line in the lark file

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works

Further comments

Added some fixtures to the tests and they all pass.

@DillonZChen

Copy link
Copy Markdown
Collaborator Author

Oh I just realised this is the same issue as #104.

@DillonZChen DillonZChen closed this May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant