Skip to content

Commit

Permalink
Disable plan tree output on classic SHOP.
Browse files Browse the repository at this point in the history
These are still messed up, and not critical.
  • Loading branch information
rpgoldman committed Nov 4, 2023
1 parent 2446efd commit d430207
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 64 deletions.
58 changes: 31 additions & 27 deletions shop3/buildapp/shop-app-entrypoints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@

(defun common/options ()
(list
(clingon:make-option
:flag
:description "Print plan tree as well as plan."
:key :plan-tree
:long-name "tree")

(clingon:make-option
:counter
:description "Verbose output."
Expand All @@ -105,22 +101,27 @@
:description "Print plan to file."
:key :plan-file
:required nil
:long-name "plan-file")
(clingon:make-option
:string
:description "Print plan tree to file."
:key :tree-file
:required nil
:long-name "tree-file")))
:long-name "plan-file")))

(defun ess/options ()
(append
(list
(clingon:make-option
:flag
:description "Print HDDL output (plan and tree)."
:key :hddl
:long-name "hddl")
:description "Print plan tree as well as plan."
:key :plan-tree
:long-name "tree")
(clingon:make-option
:string
:description "Print plan tree to file."
:key :tree-file
:required nil
:long-name "tree-file")
(clingon:make-option
:flag
:description "Print HDDL output (plan and tree)."
:key :hddl
:long-name "hddl")
(clingon:make-option
:string
:description "Print HDDL output to file."
Expand Down Expand Up @@ -199,8 +200,8 @@

(defun classic/handler (cmd)
(let ((args (clingon:command-arguments cmd))
(plan-tree (or (clingon:getopt cmd :plan-tree)
(clingon:getopt cmd :tree-file)))
;; (plan-tree (or (clingon:getopt cmd :plan-tree)
;; (clingon:getopt cmd :tree-file)))
(shop::*define-silently* (zerop (clingon:getopt cmd :verbose))))
(handler-bind ((error
(lambda (x)
Expand All @@ -209,9 +210,11 @@
(uiop:quit 1)))))
(iter (for x in args)
(load-shop-file x))
(multiple-value-bind (plans time trees)
(find-plans shop::*problem* :plan-tree plan-tree :verbose (clingon:getopt cmd :verbose))
(declare (ignore time)) ; at least for now...
(multiple-value-bind (plans ;; time trees
)
(find-plans shop::*problem* :plan-tree nil ;plan-tree
:verbose (clingon:getopt cmd :verbose))
;;(declare (ignore time)) ; at least for now...
(unless plans
(error "Unable to find a plan for problem ~a"
(shop::problem-name shop::*problem*)))
Expand All @@ -221,13 +224,14 @@
(unwind-protect
(print-plan (first plans) plan-stream)
(unless (eq plan-stream t) (close plan-stream))))
(when plan-tree
(let ((stream (alexandria:if-let ((plan-path (clingon:getopt cmd :tree-file)))
(open plan-path :direction :output :if-exists :supersede)
t)))
(unwind-protect
(print-classic-tree (first trees) stream)
(unless (eq stream t) (close stream)))))))))
;; (when plan-tree
;; (let ((stream (alexandria:if-let ((plan-path (clingon:getopt cmd :tree-file)))
;; (open plan-path :direction :output :if-exists :supersede)
;; t)))
;; (unwind-protect
;; (print-classic-tree (first trees) stream)
;; (unless (eq stream t) (close stream)))))
))))

(defun tree-compare/handler (cmd)
(let ((args (clingon:command-arguments cmd)))
Expand Down
74 changes: 37 additions & 37 deletions shop3/buildapp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,45 +210,45 @@ elif [ "$RES" != "$EXPECTED" ]; then
exit 1
fi

echo "Test SHOP with 2 arguments and plan-tree"
# echo "Test SHOP with 2 arguments and plan-tree"

PLAN=$(mktemp -t "planXXXXXX")
PLAN_TREE=$(mktemp -t "treeXXXXXX")
shop --tree-file ${PLAN_TREE} --plan-file ${PLAN} logistic.lisp Log_ran_problems_15.lisp
EC=$?
if [ "$EC" -ne 0 ]; then
echo "Failed to run planner successfully";
exit $EC
else
RES=`cat ${PLAN}`
if [ "$RES" != "$EXPECTED" ]; then
echo "Plan result did not equal the expected."
exit 1
fi
compare_trees
fi
echo "... ok"
# PLAN=$(mktemp -t "planXXXXXX")
# PLAN_TREE=$(mktemp -t "treeXXXXXX")
# shop --tree-file ${PLAN_TREE} --plan-file ${PLAN} logistic.lisp Log_ran_problems_15.lisp
# EC=$?
# if [ "$EC" -ne 0 ]; then
# echo "Failed to run planner successfully";
# exit $EC
# else
# RES=`cat ${PLAN}`
# if [ "$RES" != "$EXPECTED" ]; then
# echo "Plan result did not equal the expected."
# exit 1
# fi
# compare_trees
# fi
# echo "... ok"

echo "Test SHOP with 1 argument and plan tree"
INPUT=$(mktemp -t "inputXXXXXX")
cat logistic.lisp > ${INPUT}
cat Log_ran_problems_15.lisp >> ${INPUT}
PLAN=$(mktemp -t "planXXXXXX")
PLAN_TREE=$(mktemp -t "treeXXXXXX")
shop --tree-file ${PLAN_TREE} --plan-file ${PLAN} ${INPUT}
EC=$?
if [ "$EC" -ne 0 ]; then
echo "Failed to run planner successfully";
exit $EC
else
RES=`cat ${PLAN}`
if [ "$RES" != "$EXPECTED" ]; then
echo "Plan result did not equal the expected."
exit 1
fi
compare_trees
fi
echo "... ok"
# echo "Test SHOP with 1 argument and plan tree"
# INPUT=$(mktemp -t "inputXXXXXX")
# cat logistic.lisp > ${INPUT}
# cat Log_ran_problems_15.lisp >> ${INPUT}
# PLAN=$(mktemp -t "planXXXXXX")
# PLAN_TREE=$(mktemp -t "treeXXXXXX")
# shop --tree-file ${PLAN_TREE} --plan-file ${PLAN} ${INPUT}
# EC=$?
# if [ "$EC" -ne 0 ]; then
# echo "Failed to run planner successfully";
# exit $EC
# else
# RES=`cat ${PLAN}`
# if [ "$RES" != "$EXPECTED" ]; then
# echo "Plan result did not equal the expected."
# exit 1
# fi
# compare_trees
# fi
# echo "... ok"


echo "Test ESS-SHOP with 2 arguments"
Expand Down

0 comments on commit d430207

Please sign in to comment.