Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi How can i call the function for this code using Lisp ACL? and explain plz (defun a-star (start goal graph) (let ((open-list (list start))

Hi

How can i call the function for this code using Lisp ACL?

and explain plz

(defun a-star (start goal graph) (let ((open-list (list start)) (closed-list nil) (g-scores (list (cons start 0))) (f-scores (list (cons start (heuristic start goal))))) (loop while open-list do (let* ((current (pop open-list)) (g-score (getf g-scores current)) (neighbors (get-neighbors current graph))) (if (equal current goal) (return (reconstruct-path current closed-list)) (progn (push current closed-list) (loop for neighbor in neighbors do (let ((g (+ g-score (cost current neighbor))) (h (heuristic neighbor goal))) (when (or (not (member neighbor closed-list)) (< g (getf g-scores neighbor))) (setf (getf g-scores neighbor) g) (setf (getf f-scores neighbor) (+ g h)) (when (not (member neighbor open-list)) (push neighbor open-list) (sort open-list (lambda (a b) (< (getf f-scores a) (getf f-scores b))))))))))))))

Thx

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago