# Heuristic Search

• R&N Chapter 3.5: The A$$^*$$ Algorithm
• R&N Chapter 3.6: Design of heuristic function
• plus the summary of Chapter 3

Note that these two sections of the chapter really only gives you one (1) algorithm, the A$$*$$ Algorithm. Howeever, it exists in many different variants, and it depends on a heuristic function which also has to be designed and varied.

My advice is that you focus on the following questions, when you read it the first time.

1. What is a heuristic function? (page 102)
• Whas is an admissible heuristic function? (page 103)
2. How can you use A$$^*$$ to solve one problem?
Consider either the travel to Bucharest from the textbook, or a problem you have already studied.

In class, and when you reread the chapter, you may focus on the following questions.

1. How can you vary A$$^*$$ to solve other problems?
2. How can you vary the heuristic function $$h(x)$$ for different problems?

# AIMA Exercise 3.5

Taken from the exercises at github.

Suppose two friends live in different cities on a map, such as the Romania map shown in . On every turn, we can simultaneously move each friend to a neighboring city on the map. The amount of time needed to move from city i to neighbor j is equal to the road distance d(i,j) between the cities, but on each turn the friend that arrives first must wait until the other one arrives (and calls the first on his/her cell phone) before the next turn can begin. We want the two friends to meet as quickly as possible.

1. Write a detailed formulation for this search problem. (You will find it helpful to define some formal notation here.)
2. Let $$D(i,j)$$ be the straight-line distance between cities $$i$$ and $$j$$. Which of the following heuristic functions are admissible?
• $$D(i,j)$$;
• $$2\cdot D(i,j)$$;
• $$D(i,j)/2$$.
3. Are there completely connected maps for which no solution exists?
4. Are there maps in which all solutions require one friend to visit the same city twice?

# Exercises

• 11-puzzle
• It may be a good idea to test two different heuristics.
• What is the search depth in the test cases?
• How many nodes are created in the test cases?
• If you want a challenge, there are two more puzzles tagged with A$$^*$$.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://www.hg.schaathun.net/ai/Heuristic%20Search?revision=d9c7f7a9690c17652e727a295c398b8c83613e05", "fetch_time": 1701980201000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2023-50/segments/1700679100686.78/warc/CC-MAIN-20231207185656-20231207215656-00791.warc.gz", "warc_record_offset": 65475426, "warc_record_length": 3818, "token_count": 545, "char_count": 2225, "score": 4.125, "int_score": 4, "crawl": "CC-MAIN-2023-50", "snapshot_type": "latest", "language": "en", "language_score": 0.915675699710846, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00024-of-00064.parquet"}