a-star

How can the A* algorithm be applied to the traveling salesman problem? [duplicate]

旧时模样 提交于 2019-11-27 18:19:29
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Using A* to solve Travelling Salesman Problem I have recently learned that the A* algorithm can be applied to the travelling salesman problem. Bot how exactly do we define the start and the goal here, and how do we apply weights to nodes (what is the heuristic)? Would someone explain to me how A* can be applied here? 回答1: A* is a derivative of Dijsktra, which I don't think can be used in this fashion. First, the

Pathfinding - A* with least turns

烈酒焚心 提交于 2019-11-27 15:16:50
Is it possible to modify A* to return the shortest path with the least number of turns ? One complication: Nodes can no longer be distinguished solely by their location, because their parent node is relevant in determining future turns, so they have to have a direction associated with them as well. But the main problem I'm having, is how to work number of turns into the partial path cost (g). If I multiply g by the number of turns taken (t), weird things are happening like: A longer path with N turns near the end is favored over a shorter path with N turns near the beginning. Another less

Implementation of A Star (A*) Algorithm in Java

独自空忆成欢 提交于 2019-11-27 13:57:38
问题 Disclaimer: I have little background in Java, since I am predominantly a C# developer. Would like to have the java implementation of A* algorithm. Yes, I saw many versions of the same online and I am unable to choose between them. I am looking for an A* algorithm implementation that uses all new features of java that makes the algorithm faster(even if a tad bit). The reason is that we are implementing that for path-finding on an MMO and so, performance is the top priority. Any pointers ( on

A* heuristic, overestimation/underestimation?

一曲冷凌霜 提交于 2019-11-27 11:50:29
I am confused about the terms overestimation/underestimation. I perfectly get how A* algorithm works, but i am unsure of the effects of having a heuristic that overestimate or underestimate. Is overestimation when you take the square of the direct birdview-line? And why would it make the algorithm incorrect? The same heuristic is used for all nodes. Is underestimation when you take the squareroot of the direct birdview-line? And why is the algorithm still correct? I can't find an article which explains it nice and clear so I hope someone here has a good description. You're overestimating when

Using A* to solve Travelling Salesman

僤鯓⒐⒋嵵緔 提交于 2019-11-27 11:39:57
问题 I've been tasked to write an implementation of the A* algorithm (heuristics provided) that will solve the travelling salesman problem. I understand the algorithm, it's simple enough, but I just can't see the code that implements it. I mean, I get it. Priority queue for the nodes, sorted by distance + heuristic(node), add the closest node on to the path. The question is, like, what happens if the closest node can't be reached from the previous closest node? How does one actually take a "graph"

What is the difference between graph search and tree search?

ⅰ亾dé卋堺 提交于 2019-11-27 10:02:05
What is the difference between graph search and tree search versions regarding DFS, A* searches in artificial intelligence ? Judging from the existing answers, there seems to be a lot of confusion about this concept. The Problem Is Always a Graph The distinction between tree search and graph search is not rooted in the fact whether the problem graph is a tree or a general graph. It is always assumed you're dealing with a general graph. The distinction lies in the traversal pattern that is used to search through the graph, which can be graph-shaped or tree-shaped. If you're dealing with a tree

How to optimally solve the flood fill puzzle?

落爺英雄遲暮 提交于 2019-11-27 09:32:37
问题 I like playing the puzzle game Flood-It, which can be played online at: https://www.lemoda.net/javascript/flood-it/game.html It's also available as an iGoogle gadget. The aim is to fill the whole board with the least number of successive flood-fills. I'm trying to write a program which can solve this puzzle optimally. What's the best way to approach this problem? Ideally I want to use the A* algorithm, but I have no idea what should be the function estimating the number of steps left. I did

How to implement an A* algorithm? [closed]

杀马特。学长 韩版系。学妹 提交于 2019-11-27 07:13:40
Which should be the way to get a simple implementation of A* (A star) algorithm in C#? Derlin This article explains the basic implementation in length: The goal of this blog post is to show the fundamentals of A* through a really simple C# implementation. It also points to better implementations, more suitable for production use: As for ways to find better routes, there are plenty of C# examples around that are far better and richer than this one. CastorTiu has a really nice demo solution on CodeProject, A* algorithm implementation in C# , that animates the search algorithm and allows the user

Consistent and Admissible Heuristics

笑着哭i 提交于 2019-11-27 01:36:30
问题 Any consistent heuristic is also admissible. But when is a heuristic admissible but not consistent (monotone)? Please provide an example in which this is the case. 回答1: As Russel and Norvig point out in Artificial Intelligence: A Modern Approach (the most commonly used AI textbook) it is challenging to come up with a heuristic that is admissible but not consistent. Obviously, you can select values for nodes in a graph such that the heuristic they represent is admissible but not consistent.

How to implement an A* algorithm? [closed]

霸气de小男生 提交于 2019-11-26 22:16:13
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Which should be the way to get a simple implementation of A* (A star) algorithm in C#? 回答1: This article explains the basic implementation in length: The goal of this blog post is to show the fundamentals of A* through a really simple C# implementation. It also points to better