CPSC 625-600 Read-Only Bulletin Board

Last modified: 9/7/16, 10:53AM (Wed)

This page will have all relevant email transactions with the students regarding the AI course, so that everyone has equal information regarding the course material.

Newest transactions will be posted on the top. Regularly view this page to see what's going on between other students and the instructor.

All sensitive material such as your name, email address, etc. will be removed, and also any part of code that is not relevant to the discussion will not be uploaded here.


Article List

Date: 10/20 Title: Two-pointer method
Date: 10/18 Title: Emacs tips
Date: 9/15 Title: Simple recursive function example
Date: 9/15 Title: Alpha-beta pruning example output
Date: 9/7 Title: LISP: trace
Date: 9/7 Title: LISP: compiling
Date: 9/7 Title: LISP: basic usage
Date: 8/26 Title: Nothing here yet


Articles

Date: 10/20 Title: Two-pointer method
Two-pointer method with set-of-support strategy (from Gordon Novak's CS381K assignment):
  1. Initialize: Set the inner loop pointer to the front of the list of clauses. Set the outer loop pointer to the first clause resulting from the negated conclusion.
  2. Resolve: If the two clauses denoted by the two pointers can be resolved, produce the resolvent. Add the resolvent to the end of the list of clauses and print it out. (Note: it may be advantageous to to check whether the resolvent is already present in the list of clauses; if so, it need not be added.) If the resolvent is empty (NIL NIL), stop; the theorem is proved. Note that there may be multiple ways to resolve a single pair of clauses.
  3. Step: Move the inner loop pointer forward one clause. If the inner loop pointer has not reached the outer loop pointer, go to the Resolve step. Otherwise, reset the inner loop pointer to the front of the list of clauses and move the outer loop pointer forward one clause. If the outer loop pointer goes beyond the last clause in the list, stop; the theorem cannot be proved.
Date: 10/18 Title: Emacs tips
Running LISP in a shell can be cumbersome, especially for CMUCL. You can have a more pleasant experience by running it in the emacs text editor.

Here are some tips. M- means Meta- (Alt-, etc.). C- means Ctrl-.

  • Start emacs by running emacs.
  • Start a UNIX shell: M-x shell
  • Once inside the shell, run LISP: /usr/bin/lisp
  • You can type a command, and edit using the arrow keys and backspace.
  • Go to the beginning of the line: C-a.
  • Go to the end of the line: C-e.
  • To go to the previous command, C-up_arrow
  • To go to the next command, C-down_arrow
  • Interrupt: C-c C-c
  • Exit: C-x C-c (if you're still running the shell you may have to confirm "yes").
Date: 9/15 Title: Simple recursive function example
Simple recursive function to compute the depth of a tree.
(defun tree-depth (tree)
  (if (atom tree)
        0
        (let ((maxval 0))
		(dolist (child tree)
                        (setq maxval (max (tree-depth child) maxval))
		)
		(+ 1 maxval)
        )
  )
)
Date: 9/15 Title: Alpha-beta pruning example output
Alpha-beta pruning example:
> (alphabeta '((5 10) (6 3 -2) (6 ((7 4 -3) 9 3) 1)))

"MIN CUT (6 3 -2): alpha = 5, beta =3, after 3
" 
"------> (6 3 MINCUT)
" 
"MIN CUT (7 4 -3): alpha = 5, beta =4, after 4
" 
"------> (7 4 MINCUT)
" 
"MAX CUT ((7 4 -3) 9 3): alpha = 9, beta=6, after 9
" 
"------> ((7 4 MINCUT) 9 MAXCUT)
" 
"MIN CUT (6 ((7 4 -3) 9 3) 1): alpha = 5, beta =1, after 1
" 
"------> (6 ((7 4 MINCUT) 9 MAXCUT) 1 MINCUT)
" 

OPTIONAL:

((5 10) (6 3 MINCUT) (6 ((7 4 MINCUT) 9 MAXCUT) 1 MINCUT))
Date: 9/7 Title: LISP: trace
Here's an example of how you should use (trace ...) to track the function calls and the return values. It becomes very handy when you're debugging recursive functions.
CMU Common Lisp CVS Head 2003-07-01 16:23:01, running on unix
With core: /usr/local/lib/cmucl/lib/lisp.core
Dumped on: Tue, 2003-07-01 16:01:00-05:00 on empic5
See  for support information.
Loaded subsystems:
    Python 1.1, target UltraSparc/Solaris 7
    CLOS based on Gerd's PCL 2003/06/18 09:23:09
* (load "deriv.lsp")

; Loading #p"/user/choe/web_project/420/deriv.lsp".
T
* (trace deriv)			<--- Trace calls to deriv
; 

; Warning: This function is undefined:
;   DERIVMULT
; 
(DERIV)

* (trace derivplus)		<--- Trace calls to derivplus

(DERIVPLUS)
* (trace splus)			<--- Trace calls to splus

(SPLUS)
* (deriv '(+ (+ x 2) (+ 2 x)) 'x)   <---- Call deriv!

  0: (DERIV (+ (+ X 2) (+ 2 X)) X)	   <---- shows how the functions are
    1: (DERIVPLUS (+ (+ X 2) (+ 2 X)) X)	 called, with their full
    1: DERIVPLUS returned (+ (+ 1 0) (+ 0 1))	 arguments! You can easily
  0: DERIV returned (+ (+ 1 0) (+ 0 1))		 track what's going wrong
(+ (+ 1 0) (+ 0 1))				 by looking at the arguments
* (quit)					 and the returned values.
Date: 9/7 Title: LISP: compiling
Here's how you compile:

; compile
(compile-file "dfs.lsp")

; load the compiled binary
(load "dfs.sparcf")

; run the function
(dfs '((2 9) (4 (1 30) 2) 5))


Here's how you compile, with tail-recursion turned off:

; compile with tail-recursion off
(compile-file "dfs.lsp" :block-compile nil)

; load the compiled binary
(load "dfs.sparcf")

; turn trace on on the recusrive function
(trace dfs-core)

; run the function
(dfs '((2 9) (4 (1 30) 2) 5))


Here's an example run. Bold is what you enter in the Lisp interpreter. * (compile-file "dfs.lsp" :block-compile nil) ; Python version 1.1, VM version UltraSparc/Solaris 7 on 16 SEP 08 09:51:43 pm. ; Compiling: /home/faculty/choe/web_project/625/src/dfs.lsp 25 AUG 08 08:57:56 pm ; Converted DFS. ; Compiling DEFUN DFS: ; Converted DFS-CORE. ; Compiling DEFUN DFS-CORE: ; Converted GOALP. ; Compiling DEFUN GOALP: ; Converted MAKE-NODE-LIST. ; Compiling DEFUN MAKE-NODE-LIST: ; Converted EXPAND. ; Compiling DEFUN EXPAND: ; Byte Compiling Top-Level Form: ; dfs.sparcf written. ; Compilation finished in 0:00:00. #P"/home/faculty/choe/web_project/625/src/dfs.sparcf" NIL NIL * (load "dfs.sparcf") ; Loading #P"/home/faculty/choe/web_project/625/src/dfs.sparcf". T * (dfs '((2 9) (4 (1 30) 2) 5)) 0: (DFS-CORE ((# # 5))) 0: DFS-CORE returned 30 30 * (trace dfs-core) Warning: Function DFS-CORE already TRACE'd, retracing it. (DFS-CORE) * (dfs '((2 9) (4 (1 30) 2) 5)) 0: (DFS-CORE ((# # 5))) 1: (DFS-CORE ((2 9) (4 # 2) 5)) 2: (DFS-CORE (2 9 (4 # 2) 5)) 3: (DFS-CORE (9 (4 # 2) 5)) 4: (DFS-CORE ((4 # 2) 5)) 5: (DFS-CORE (4 (1 30) 2 5)) 6: (DFS-CORE ((1 30) 2 5)) 7: (DFS-CORE (1 30 2 5)) 8: (DFS-CORE (30 2 5)) 8: DFS-CORE returned 30 7: DFS-CORE returned 30 6: DFS-CORE returned 30 5: DFS-CORE returned 30 4: DFS-CORE returned 30 3: DFS-CORE returned 30 2: DFS-CORE returned 30 1: DFS-CORE returned 30 0: DFS-CORE returned 30 30 *
Date: 9/7 Title: LISP: basic usage
Here's an example which will help you get started wetting your hands in Lisp. The commands in Bold are what you're supposed to type in. My comments are in Italics - YC.
  • CMU Common Lisp is installed in /usr/bin/lisp:
    Example:
    
    unix$ /usr/bin/lisp 	<-- 'unix$' is the unix prompt
    CMU Common Lisp CVS Head 2003-04-21 16:23:29, running on unix
    With core: /usr/lib/cmucl/lib/lisp.core
    Dumped on: Mon, 2003-04-21 15:40:49-05:00 on empic5
    See  for support information.
    Loaded subsystems:
        Python 1.1, target SPARCstation/Solaris 2
        CLOS based on Gerd's PCL 2003/03/22 16:15:17
    * 					<-- '*' is the lisp prompt
    
    
  • To quit from lisp, enter (quit)
    Example:
    
    CMU Common Lisp CVS Head 2003-04-21 16:23:29, running on unix
    With core: /usr/lib/cmucl/lib/lisp.core
    Dumped on: Mon, 2003-04-21 15:40:49-05:00 on empic5
    See  for support information.
    Loaded subsystems:
        Python 1.1, target SPARCstation/Solaris 2
        CLOS based on Gerd's PCL 2003/03/22 16:15:17
    * (quit)			<-- your input 
    unix$				<-- the unix prompt 
    
  • If you caused an error and it doesn't seem to work, enter q to go back up to the top-level.
    Example:
    
    CMU Common Lisp CVS Head 2003-04-21 16:23:29, running on unix
    With core: /usr/lib/cmucl/lib/lisp.core
    Dumped on: Mon, 2003-04-21 15:40:49-05:00 on empic5
    See  for support information.
    Loaded subsystems:
        Python 1.1, target SPARCstation/Solaris 2
        CLOS based on Gerd's PCL 2003/03/22 16:15:17
    * adf;lakjf		<--- your erroneous input
    
    Error in KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER:  the variable ADF is unbound.
    
    Restarts:
      0: [ABORT] Return to Top-Level.
    
    Debug  (type H for help)
    
    (EVAL ADF)
    Source: Error finding source: 
    Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
      target:code/eval.lisp.
    0] q			<--- '0]' is the prompt
    
    *				<--- lisp prompt  
    
    
    
Date: 8/26 Title: Nothing here yet

$Id: board.php,v 1.5 2004/08/30 23:54:24 choe Exp $