Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Loop and Conditional extensions to the SHOP domain language #142

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

rpgoldman
Copy link
Contributor

No description provided.

@rpgoldman
Copy link
Contributor Author

@ukuter or
@mdehaven-- Please provide a better commit message for the first commit in this branch (amend the commit and then force-push)

Also, please put a description of what this branch aims to achieve into the PR description box.

The above two things will live on in the SHOP3 repo history and need to be informative to help any future maintainers.

Copy link
Contributor Author

@rpgoldman rpgoldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few things we should fix before merging. Also, we need to add the looping constructs into the manual before we merge.

(cond
((primitivep (get-task-name task))
(setf (mode state) 'expand-primitive-task))
((eql (get-task-name task) :loop)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to use keywords here instead of just using the normal symbols?

I know this is a nit, but SHOP syntax is already full of inconsistencies about use of keywords versus normal symbols, and I would like to move towards consistency by killing all use of keywords inside method definitions, and reserve them only for :op, :method, etc.


(defparameter *output-form* nil)

(defmethod print-node ((plan-tree-node top-node))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a defgeneric with docstring to explain what this is for and how to invoke it. Do we call print-node directly, or is there an outer function to invoke?

When we get the docstrings, we should reference them in the manual (I can explain how this is done).

shop3/explicit-stack-search/plan-tree.lisp Outdated Show resolved Hide resolved
))
)

(defun make-conditional-state-expand (&rest arglist
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(declaim (ftype (function (&rest arglist &key :top-tasks :tasks :unifier) (values conditional-state-expand &optional) make-conditional-state-expand))

maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is syntactically wrong: make-conditional-state-expand (function name) is an argument of ftype and not part of function (the type description).

(:documentation "Mixin domain class for HTNs with LOOP tasks in them."))


(defmethod seek-plans-task ((domain looping-domain) task1 state tasks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be replaced by a simpler method that checks for (looping-p (get-task-name task1)) and then calls seek-plans-loop or if that test fails, simply call-next-method?

By squashing all of the seek-plans-task code for other classes and mixins, this potentially breaks present and future code for other SHOP extensions.

shop3/shop3.asd Outdated Show resolved Hide resolved
shop3/tests/conditional-tests.lisp Outdated Show resolved Hide resolved
shop3/looping-tasks/exts-common.lisp Outdated Show resolved Hide resolved
backtrack-stack)))))
ess-search-state)

(defun new-symbol (sym)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never use intern without specifying the optional package argument, otherwise you just get whatever *package* is bound to when new-symbol is called.

Also gentemp = gensym followed by intern, so just use gentemp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to bother you again, but what about this:

(defun new-symbol (sym &optional (pkg-desig :shop)) ...)

I just suggest this because so far we are guessing what Ugur wanted originally. Not a big deal.

@rpgoldman
Copy link
Contributor Author

Awesome progress in just 1 day, @matthewdehaven !

ukuter and others added 24 commits September 18, 2023 16:07
Fix syntax error and unused `rationale` argument.
Undefined variable (misspelling) and variable that is written but not
read.
Setting up to print trace information caused us inadvertently to
rebind `state`, breaking a call to `stack-backtrack`.
This condition is removed in the original `loop-conditional-exts`
branch and replaced with just the else condition. This change matches
the behavior on that branch.
And a package name is provided
rpgoldman and others added 5 commits September 19, 2023 10:05
Only handle the loop tasks and defer primitive and non-primitive
handling to `call-next-method`. This avoids duplicate code which could
break other extensions.
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.

None yet

4 participants