;;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; -*- ;;;; -------------------------------------------------------------------------- ;;;; File name: cps.lsp ;;;; System: Classical Problem Solver ;;;; Version: 1.0 ;;;; Purpose: Define CPS system ;;;; -------------------------------------------------------------------------- ;;;; File specifications for CPS, the "Classical Problem Solver" ;;; Last edited: 2/6/93, KDF ;;;; Modified: Ron Ferguson on Tue Dec 30 16:30:54 1997 ;;; 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. (in-package :cl-user) (defparameter *cps-path* (make-bps-path "cps") "Location of CPS source files.") (defparameter *cps-files* '("search" "variants") "Source files for the core problem solver.") (defparameter *algebra-files* '("match" "algebra" "simplify") "Additional source files for Bundy's algebra system.") (defparameter *subway-files* '("subways" "boston") "Additional source files for the subway planner.") (defun load-cps (&key (action :load-source)) "Load the classical problem solver, with algebra and subway examples." (bps-load-files *cps-path* *cps-files* :action action) (bps-load-files *cps-path* *algebra-files* :action action) (bps-load-files *cps-path* *subway-files* :action action)) (defun compile-cps () "Compile the classical problem-solver, with algebra and subway examples." (bps-load-files *cps-path* *cps-files* :action :compile) (bps-load-files *cps-path* *algebra-files* :action :compile) (bps-load-files *cps-path* *subway-files* :action :compile)) (defun shakedown-cps () "Run test cases in the classical problem solver. Assumes CPS is loaded." (format t "~%Running CPS shakedown...~%") (bsolve 'airport (setup-subway-problem 'kendall-square)) (dsolve 'airport (setup-subway-problem 'kendall-square)) (format t " ...shakedown completed.~%~%")) (defun help-cps (&optional (stream *debug-io*)) "Print out simple help text for running examples." (format stream "~%Classical Problem Solver:~%") (format stream " To load: (load-cps)~%") (format stream " Sample algebra problem: ~%") (format stream " (bsolve *bundy* (setup-algebra-problem))~%") (format stream " (dsolve *bundy* (setup-algebra-problem))~%") (format stream " Sample subway problem: ~%") (format stream " (bsolve 'airport (setup-subway-problem 'kendall-square))~%") (format stream " (dsolve 'airport (setup-subway-problem 'kendall-square))~%") (format stream " Print out answer:~%") (format stream " (print-answer )~%") (terpri stream)) (help-cps)