;; -*- Mode: Lisp; -*- ;;;; TGizmo PS/VS operations ;;;; File name: psvs.lsp ;;;; modified: Thursday, February 14, 2008 at 15:34:16 by forbus ;;; Copyright (c) 1991-1993, Kenneth D. Forbus, Northwestern University, ;;; and Johan de Kleer, the Xerox Corporation. ;;; All rights reserved. ;;; See the file legal.txt for a paragraph stating scope of permission ;;; and disclaimer of warranty. The above copyright notice and that ;;; paragraph must be included in any separate copy of this file. (in-package :cl-user) (defun load-scenario (sfile &optional (*tgizmo* *tgizmo*)) (with-tgizmo *tgizmo* (with-ltre (tgizmo-ltre *tgizmo*) (bps-load-file *tgizmo-path* sfile :action :load-source)) (tg-run-rules) (use-transitivity *tgizmo*))) (defun gather-vps (&optional (*tgizmo* *tgizmo*)) (tg-fetch `(active ?x))) (defun psvs-choice-sets (&optional (*tgizmo* *tgizmo*)) (mapcar #'(lambda (a-s) `(,a-s (:not ,a-s))) (gather-vps))) (defun search-psvs (thunk &optional (*tgizmo* *tgizmo*)) (dd-search (psvs-choice-sets) `(unwind-protect (progn (when-debugging-tgizmo :psvs-dds (format t "~% =======================") (show-psvs)) ,thunk (when-debugging-tgizmo :psvs-dds (format t "~% ======================="))) (retract-ir-cwas)))) (defun show-psvs (&optional (*tgizmo* *tgizmo*)) ;;; good for examining the current state (dolist (active-s (tg-fetch '(active ?x))) (format t "~% ~A is ~A." (cadr active-s) (case (label-of active-s) (:true "active") (:false "inactive") (t "??")))))