;; -*- Mode: Lisp; -*- ;;;; Tiny Gizmo, a partial implementation of QP theory ;;;; modified: Thursday, February 14, 2008 at 11:24:59 by Ken Forbus ;;; Copyright (c) 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. ;;;; Gizmo was the first implementation of QP theory, which ;;;; evolved from 1982 to 1984. Like the original, TGizmo ;;;; is based on an LTMS. However, we've simplified the modeling ;;;; language, and not implemented limit analysis or temporal ;;;; projection here to keep the size of the code small. ;;;; We show how to use dependency-directed search to interpret ;;;; measurements within a single qualitative behavior, as per ;;;; Forbus' IJCAI-83 paper. ;;;; File name: tgizmo.lsp (in-package :cl-user) (defvar *tgizmo-path* (make-bps-path "tgizmo")) (defvar *tgizmo-files* '("defs" ; Definitions of internal structs. "mlang" ; Simple modeling language for QP descriptions. "psvs" ; Finding view and process structures. "resolve" ; Influence resolution. "ineqs" ; Inequality reasoning. "states" ; Caching states. "mi" ; Measurement Interpretation system. "debug")) ; Various examples and debugging procedures. (defvar *tgizmo-domain-file* "tnst") ;;tiny naive steam theory (defvar *tgizmo-laws-file* "laws") ;;qualitative laws ;;; The file laws.lisp contains PDIS rules that enforce logical ;;; constraints of QP theory. It must be compiled after a tgizmo ;;; has been created. (defun load-tgizmo (&key (action :compile-if-newer)) (bps-load-file (make-bps-path "ltms") "ltre" :action :load-source) (cl-user::load-ltre :action action) (if (eq action :compile) (compile-tgizmo) (bps-load-files *tgizmo-path* *tgizmo-files* :action action))) (defun compile-tgizmo () (bps-load-file (make-bps-path "ltms") "ltre" :action :load-source) (cl-user::load-ltre) (bps-load-files *tgizmo-path* *tgizmo-files* :action :compile) (unless (and (boundp '*tgizmo*) (not (null *tgizmo*))) (create-tgizmo "DUMMY")) (bps-load-file *tgizmo-path* *tgizmo-laws-file* :action :compile) (bps-load-file *tgizmo-path* *tgizmo-domain-file* :action :compile))