Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (35 sloc) 1.18 KB
;;;; -*- Mode: Lisp; Syntax: Common-Lisp -*-
;;;; Code from Paradigms of AI Programming
;;;; Copyright (c) 1991 Peter Norvig
;;;; File gps-srch.lisp: Section 6.4 GPS based on explicit search
(requires "gps" "search")
(defun search-gps (start goal &optional (beam-width 10))
"Search for a sequence of operators leading to goal."
(cons '(start) start)
#'(lambda (state) (subsetp goal state :test #'equal))
#'(lambda (state)
(+ (count-if #'action-p state)
(count-if #'(lambda (con)
(not (member-equal con state)))
(defun gps-successors (state)
"Return a list of states reachable from this one using ops."
#'(lambda (op)
(remove-if #'(lambda (x)
(member-equal x (op-del-list op)))
(op-add-list op)))
(applicable-ops state)))
(defun applicable-ops (state)
"Return a list of all ops that are applicable now."
#'(lambda (op)
(subsetp (op-preconds op) state :test #'equal))
You can’t perform that action at this time.