I'm slightly confused about diagonal movement in a grid using A* and the Manhattan distance metric. Can someone explain why using diagonal movement makes it inadmissible? Wouldn't going in diagonal movement find a better optimal solution as in take less steps to get to goal state than up down left right or am I missing something?
Why allowing diagonal movement would make the A* and Manhattan Distance inadmissible?
6.2k views Asked by Schonge At
2
There are 2 answers
1
philkark
On
While this topic is older I would like to add a different solution that uses the actual fastest free path to the goal if diagonal movement is allowed.
function heuristic(state):
delta_x = abs(state.x - goal.x)
delta_y = abs(state.y - goal.y)
return min(delta_x, delta_y) * sqrt(2) + abs(delta_x - delta_y)
This method returns a heuristic that moves the maximum amount diagonally and the remainder in a straight way to the goal and presents the largest possible heuristic that does not over-estimate the movement costs to the goal.
Related Questions in ARTIFICIAL-INTELLIGENCE
- Dots and Boxes with apha-beta pruning
- Node.js Chatbot Error: GoogleGenerativeAIError - Content should have 'parts' property with an array of Parts
- Integrating Mesonet algorithm with a webUI for deepfake detection model
- Pneumonia detection, using transfer learning
- Anybody knows where to learn AIMA python library?
- Training model for AirPassengers dataset
- I have question about the meanings of words coming out during training YOLOv7(WongKinYiu)
- LangChain OpenAI Agent with Sources
- recognize_google fails with WinError 10060
- combination of 2 classes
- How to Text To Speech a IA text generation that is streaming response
- How to integrate source section in chat gpt API in py?
- Why does this error keep showing, what am i missing? await message.channel.send(f"Answer: {bot_response}") IndentationError: unexpected indent
- How can I upload/attach file like PDF in Google Gemini AI API ? (Model Gemini 1.5 Pro)
- How to use Google Gemini API call to upload pdf, ppt, docs, etc files?
Related Questions in GRAPH-THEORY
- Algorithm for total flow through weighted directed acyclic graph
- Finding path with smallest GCD of nodes's weights in directed graph
- The plot function in the 'gRc' library gives an error (also in the demo)
- Color edges distinctly in network based on attribute value
- Make a stack of adjacency matrices from a dataframe in R
- What is an efficient algorithm to identify multi-degree email chains in a mock company network?
- Approximation Algorithms for the Longest Simple Path in a Directed Graph
- Eliminate edges in a routing graph which aren't used in the shortest path between a subset of nodes
- PageRank Algorithm on a Graph with a Sink Node
- Algorithm to cover time periods
- Prims minimum spanning
- DFS Maze generation
- Find the node with the minimum maximum distance in a graph
- Undirected connected graph - Finding edges with specific weight that belong to MST
- Why is my graph coloring code not coloring the graph correctly?
Related Questions in GRAPH-ALGORITHM
- Finding optimal swapping paths in employees moving to different cities
- How create an adjacency matrix of a Maze graph
- Convert python functions (shortestpath/ prediction function using nx.adamic_adar_index) into API
- How is a cut lonely if there are often multiple edges crossing a cut in a connected undirected graph?
- How to group nodes in a directed graph so that no two nodes in a group have paths between them?
- Is this total sink algorithm only for dags?
- What would be the best way to solve this maximum path graph problem, is Dijkstra possible even?
- Given undirected graph when removing edges one-by-one verify if removed one was a bridge and if so - the vertices of both parts
- Select n items from a set of subsets
- Implementing Kosaraju's Algorithm for SCC's
- modify current algorithm - APSP
- Does the removal of a few edges remove all paths to a node?
- Sliding Puzzle - DFS Issue
- Can we transform a graph in a way that applying DFS to the new graph would result in the same traversal order as applying BFS on the first graph?
- Advantages of linked lists in adjacency representation of a graph
Related Questions in HEURISTICS
- Optimising my C loop for a combinatorial problem
- How can the Minimax (or Negamax) algorithm be implemented in a game like Scotland Yard?
- How to specify a dummy model/heuristic rule as a model in tidymodels?
- How to improve Pong AI with limited game state checks?
- Color Maze AI with A* Search- Heuristic function
- Constraint Satisfaction Problem - Least constraining value question
- How to enable heuristics in Myers linear space Diff algorithm?
- Longest Palindromic Substring - Optimization
- How to tell if a bunch of shapes are all mirror images using OpenCV?
- I need help implementing Negascout (principal variation search) for Othello
- Looking for ways of clustering data acording to distance
- Choosing proper heuristic for A* algorithm in subway network
- OptaPlanner - How to configure a selectionFilter in construction heuristics phase?
- A* search in 8-puzzle prolog
- Intuition behind heuristic functions plus example
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Much as beaker's comment denotes, Manhattan Distance will over estimate the distance between a state and the states diagonally accessible to it. By definition, a heuristic that over estimates distances is not admissible.
Now, why exactly is this so?
Lets assume your Manhattan Distance procedure looks something like this:
Now, consider the case of applying that procedure to the state of (1,1), and assume the goal is at (3,3). This will return the value of 4, which over estimates the actual distance which is 2. Therefore, Manhattan Distance in this situation will not work as an admissible heuristic.
On game boards that allow for diagonal movement Chebyshev Distance is typically used instead. Why?
Consider this new procedure:
Returning to the previous example of (1,1) and (3,3), this procedure will return the value of 2, which is indeed not an overestimation of the actual distance.