Question
I need help with Dr.Racket (Scheme, Lisp) . I just have to Implement find-solution using A* search . I don't know what it is I
I need help with Dr.Racket (Scheme, Lisp).
I just have to Implement "find-solution using A* search". I don't know what it is I just know that it's a Heuristic-based and it combines DFS and Breath-First Search. Please help.
Main ideas of A* search . not every sequence needs to be explored . visited successors can be ignored . explore the most promising sequence first
ACCUMULATOR INVARIANTS: . paths is a list of all seqsstarting at b generated so far that have no repeated nodes . visited is the list of boards encountered on all sequences explored so far
However, below is an example of a Breath-First Search.
; find-solution-bfs: board --> seq
; Purpose: To find a solution to the given board
(define (find-solution-bfs b)
(local [; search-paths: lseq --> seq
; Purpose: To find a solution to b by searching all possible paths
; ACCUMULATOR INVARIANT: ; paths is all paths starting at b generated so far from shortest to longest (define (search-paths paths) (cond [(equal? (first (first paths)) WIN) (first paths)] [else (local [(define children (generate-children (first (first paths)))) (define new-paths (map (lambda (c) (cons c (first paths))) children))] (search-paths (append (rest paths) new-paths)))]))] (reverse (search-paths (list (list b))))))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started