-
Notifications
You must be signed in to change notification settings - Fork 14
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
rpgoldman
wants to merge
29
commits into
master
Choose a base branch
from
lce-rebase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1fbbf7d
All recent changes but unstaged.
ukuter 6b6166f
Add a test suite for domain conditionals
mdehavensift 1e5a6a7
Add parameters to allow disabling debug prints in loop extensions
mdehavensift 1287cc4
Use loop extension debug printing function in conditional extensions
mdehavensift 0ea841a
Move some debug prints in explicit search behind *verbose* checks
mdehavensift abd5f52
Fix errors from rebase.
rpgoldman 61f246d
Fix undefined variable.
rpgoldman 48d23b4
Fix more rebase issues.
rpgoldman 3be9da9
Fix variable issues.
rpgoldman 82ddd4b
Remove incorrect ignore declaration.
rpgoldman 8be565a
Fix two bugs in seek-plans-stack.
rpgoldman 1f479f9
Remove a condition
mdehavensift 1a93302
Change (until (not <condition>)) to (while <condition>)
mdehavensift ea1aa06
Replace slot type comments with declarations
mdehavensift c215068
Add ftype declaration to make-conditional-state-expand
mdehavensift 99bd64e
Fix misformed ftype definition
mdehavensift d396dd1
Use conditional-p rather than duplicating the check directly
mdehavensift 31e9772
Replace dbg-lp with trace-print
mdehavensift d9951f4
Create looping-mixin
mdehavensift a43364f
gensym + intern replaced by gentemp
mdehavensift bee99e1
Fix indentation error
mdehavensift b7e3e96
Import relevant SHOP symbols into loop conditionals test package
mdehavensift 7ddcd7b
Add ":redefine-ok t" to test domains in loop conditional tests
mdehavensift ae9da93
Fix incorrect trace print
mdehavensift 8d362f4
Fix errors introduced when rebasing.
rpgoldman 0808cde
RANDOM-STATE update.
rpgoldman 1725030
Replace tabs with spaces
matthewdehaven 987376d
Add optional package argument to new-symbol
matthewdehaven 1a61b7a
Simplify seek-plans-task for looping domain
matthewdehaven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule random-state
updated
29 files
+46 −0 | .github/workflows/build-clean-test.yml | |
+50 −0 | .github/workflows/test.yml | |
+1 −1 | LICENSE | |
+21 −0 | adler32.lisp | |
+29 −0 | cityhash.lisp | |
+53 −0 | do-test.lisp | |
+3 −151 | docs/index.html | |
+141 −9 | documentation.lisp | |
+27 −10 | generator.lisp | |
+38 −0 | histogram.lisp | |
+7 −10 | implementation.lisp | |
+2 −8 | kiss.lisp | |
+0 −6 | linear-congruence.lisp | |
+0 −6 | mersenne-twister.lisp | |
+0 −6 | middle-square.lisp | |
+30 −0 | murmurhash.lisp | |
+20 −8 | package.lisp | |
+0 −6 | pcg.lisp | |
+46 −39 | protocol.lisp | |
+12 −0 | random-state-test.asd | |
+1 −7 | random-state-viewer.asd | |
+10 −13 | random-state.asd | |
+0 −6 | rc4.lisp | |
+3 −6 | squirrel.lisp | |
+46 −0 | test.lisp | |
+15 −17 | toolkit.lisp | |
+0 −6 | tt800.lisp | |
+10 −7 | viewer.lisp | |
+343 −0 | xorshift.lisp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
shop3/explicit-stack-search/plan-tree-simple-print.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
(in-package :plan-tree) | ||
|
||
(defparameter *output-form* nil) | ||
|
||
(defmethod print-node ((plan-tree-node top-node)) | ||
(let ((*output-form* nil)) | ||
(iter | ||
(for node in (complex-tree-node-children plan-tree-node)) | ||
(format t "~%Node: ~s" node) | ||
(print-node node)) | ||
(format t "~%Plan tree: ~s" *output-form*))) | ||
|
||
(defmethod print-node ((plan-tree-node complex-tree-node)) | ||
(let ((dependencies (tree-node-dependencies plan-tree-node)) | ||
output-dependency-form | ||
output-children-form) | ||
(iter | ||
(for d in dependencies) | ||
(push | ||
`(:establisher | ||
((:task | ||
,(if (eq (establisher d) :init) | ||
:init | ||
(tree-node-task (establisher d)))) | ||
(:type ,(type-keyw (type-of (establisher d))))) | ||
:label ,(prop d)) | ||
output-dependency-form)) | ||
|
||
(iter | ||
(with children = (complex-tree-node-children plan-tree-node)) | ||
(while children) | ||
(as node = (pop children)) | ||
(format t "~% Child node: ~s" node) | ||
;; What about :UNORDERED??? | ||
(if (eql (type-of node) 'plan-tree::ordered-tree-node) | ||
(setf children (append | ||
(complex-tree-node-children node) | ||
children)) | ||
;; else | ||
(push | ||
`(:task ,(tree-node-task node) | ||
:type ,(type-keyw (type-of node))) | ||
output-children-form) | ||
)) | ||
|
||
(when (tree-node-task plan-tree-node) | ||
(push | ||
`(:task ,(tree-node-task plan-tree-node) | ||
:type ,(type-keyw (type-of plan-tree-node)) | ||
:children ,output-children-form | ||
:depends-on ,output-dependency-form) | ||
*output-form*)) | ||
|
||
(iter | ||
(for node in (complex-tree-node-children plan-tree-node)) | ||
(print-node node)))) | ||
|
||
|
||
(defmethod print-node ((plan-tree-node primitive-tree-node)) | ||
(let ((dependencies (tree-node-dependencies plan-tree-node)) | ||
output-dependency-form) | ||
(iter | ||
(for d in dependencies) | ||
(push | ||
`(:establisher | ||
((:task | ||
,(if (eq (establisher d) :init) | ||
:init | ||
(tree-node-task (establisher d)))) | ||
(:type ,(type-keyw (type-of (establisher d))))) | ||
:label ,(prop d)) | ||
output-dependency-form)) | ||
|
||
;; there is no children since this node is primitive. | ||
|
||
(when (tree-node-task plan-tree-node) | ||
(push | ||
`(:task ,(tree-node-task plan-tree-node) | ||
:type :primitive | ||
:depends-on ,output-dependency-form) | ||
*output-form*)))) | ||
|
||
(defmethod print-node ((plan-tree-node ordered-tree-node)) | ||
(iter | ||
(for node in (complex-tree-node-children plan-tree-node)) | ||
(format t "~%Node in ordered: ~s" node) | ||
(print-node node))) | ||
|
||
(defmethod print-node ((plan-tree-node unordered-tree-node)) | ||
(format t "~%Unordered CHILDREN: ~A" | ||
(complex-tree-node-children plan-tree-node))) | ||
|
||
(defun type-keyw (node-type) | ||
(ecase node-type | ||
(primitive-tree-node | ||
:primitive) | ||
(complex-tree-node | ||
:complex) | ||
(t (format t "~%Add this type to the list: ~s" node-type)))) | ||
#| | ||
(plan-tree:primitive-tree-node | ||
(unless (ignored-primitive-node-p tree) | ||
(incf *tree-leaf-index*) | ||
(dolist (partial-constraint partial-constraints) | ||
(declare (type list partial-constraint)) | ||
(let ((vars (find-primitive-node-variables tree))) | ||
|
||
(assert (eq '<= (tree-partial-constraint-op (car partial-constraint)))) | ||
(assert (eq '<= (tree-partial-constraint-op (cdr partial-constraint)))) | ||
|
||
(new-constraint-with-properties *constraint-db* | ||
(lte-constraint (tree-partial-constraint-lhs (car partial-constraint)) | ||
(tachyon/internal/csp-problem-def/structures:node-variables-start-min vars)) | ||
:bound :min | ||
:purpose 'tree-constraint) | ||
(new-constraint-with-properties *constraint-db* | ||
(lte-constraint (tree-partial-constraint-lhs (cdr partial-constraint)) | ||
(tachyon/internal/csp-problem-def/structures:node-variables-start-max vars)) | ||
:bound :max | ||
:purpose 'tree-constraint))))) | ||
|
||
(t (error 'unhandled-tree-node-error :node tree)))) | ||
|
||
|# |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 callprint-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).