heuristics

What is the difference between monotonicity and the admissibility of a heuristic?

做~自己de王妃 提交于 2019-12-04 15:50:51
问题 I'm reading over my AI textbook and I'm curious about what the difference is between monotonicity and admissibility of heuristics (I know they aren't mutually exclusive). As far as I can tell, an admissible heuristic simply means you are ensured to get the shortest path to a solution if one exists. What I'm struggling with is the concept of the monotonic property. Can someone describe this to me in a way I might understand? Similarly, how can I determine if a given heuristic is monotonic

Manhattan Heuristic function for A-star (A*)

杀马特。学长 韩版系。学妹 提交于 2019-12-04 12:33:21
问题 I found this algorithm here. I have a problem, I cant seem to understand how to set up and pass my heuristic function. static public Path<TNode> AStar<TNode>(TNode start, TNode destination, Func<TNode, TNode, double> distance, Func<TNode, double> estimate) where TNode : IHasNeighbours<TNode> { var closed = new HashSet<TNode>(); var queue = new PriorityQueue<double, Path<TNode>>(); queue.Enqueue(0, new Path<TNode>(start)); while (!queue.IsEmpty) { var path = queue.Dequeue(); if (closed

Where are strings more useful than a StringBuilder?

北城余情 提交于 2019-12-04 08:23:21
Lot of questions has been already asked about the differences between string and string builder and most of the people suggest that string builder is faster than string. I am curious to know if string builder is too good so why string is there? Moreover, can some body give me an example where string will be more usefull than string builder? It's not a case of which is more useful... A String is a String - one or more characters next to eachother. If you want to change a string in someway, it will simply create more strings because they are immutable . A StringBuilder is a class which creates

How to optimize math operations on matrix in python

爱⌒轻易说出口 提交于 2019-12-04 03:47:29
问题 I am trying to reduce the time of a function that performs a serie of calculations with two matrix. Searching for this, I've heard of numpy, but I really do not know how apply it to my problem. Also, I Think one of the things is making my function slow is having many dots operators (I heard of that in this this page ). The math correspond with a factorization for the Quadratic assignment problem: My code is: delta = 0 for k in xrange(self._tam): if k != r and k != s: delta += self._data

Why A* is faster if i use 4xManhattan Distances as Heuristic for 15-Puzzle

♀尐吖头ヾ 提交于 2019-12-03 16:21:52
I have implemented an A* algorithm for solving the 15-puzzle. I made a research for finding some viable or admissible heuristics, looking for a fast solution, and i find that using 4*Manhattan Distance as heuristic always solve any 15-puzzle in less than a second. I tried this and effectively works. I tried to find a answer for that but i cant find it. Any one can explain this? 4* manhattan distance is not admissible heuristic, this makes the algorithm behave "closer" to greedy best first (where the algorithm chooses which node to develop solely based on the heuristic function). This makes the

Finding minimum cut-sets between bounded subgraphs

我与影子孤独终老i 提交于 2019-12-03 12:23:53
If a game map is partitioned into subgraphs, how to minimize edges between subgraphs? I have a problem, Im trying to make A* searches through a grid based game like pacman or sokoban, but i need to find "enclosures". What do i mean by enclosures? subgraphs with as few cut edges as possible given a maximum size and minimum size for number of vertices for each subgraph that act as a soft constraints. Alternatively you could say i am looking to find bridges between subgraphs, but its generally the same problem. Example Gridbased gamemap example http://dl.dropbox.com/u/1029671/map1.jpg Given a

What algorithm would you use to solve a very large tic-tac-toe game?

陌路散爱 提交于 2019-12-03 09:39:27
A small (3x3, 4x4) tic-tac-toe can be easily solved by considering all the cases. But for example, you have a 30x30 tic-tac-toe. What algorithm would you use to decide the next best move in that case? Minimax + alpha-beta pruning is one way that I know. Is there some other way that is more efficient/not more efficient but cooler? I know it would not be a very interesting game to play. I said 30x30 just to ask what I wanted to i.e. which algorithms work best at these sort of games where the number of cases to consider for a perfect solution is very very high and thus not feasible. I don't think

Manhattan Heuristic function for A-star (A*)

前提是你 提交于 2019-12-03 09:04:30
I found this algorithm here . I have a problem, I cant seem to understand how to set up and pass my heuristic function. static public Path<TNode> AStar<TNode>(TNode start, TNode destination, Func<TNode, TNode, double> distance, Func<TNode, double> estimate) where TNode : IHasNeighbours<TNode> { var closed = new HashSet<TNode>(); var queue = new PriorityQueue<double, Path<TNode>>(); queue.Enqueue(0, new Path<TNode>(start)); while (!queue.IsEmpty) { var path = queue.Dequeue(); if (closed.Contains(path.LastStep)) continue; if (path.LastStep.Equals(destination)) return path; closed.Add(path

15 Puzzle Heuristic

北城以北 提交于 2019-12-03 08:48:18
The 15 Puzzle is a classical problem for modelling algorithms involving heuristics. Commonly used heuristics for this problem include counting the number of misplaced tiles and finding the sum of the Manhattan distances between each block and its position in the goal configuration. Note that both are admissible, i.e., they never overestimate the number of moves left, which ensures optimality for certain search algorithms such as A*. What Heuristic do you think is proper, A* seems to work nice, do you have an example, maybe in c or java ? Margus Heuristic My heuristic of choice is to find if

A* admissible heuristics on a grid with teleporters?

旧时模样 提交于 2019-12-03 07:01:11
问题 Suppose that you have a 2D grid of cells, some of which are filled in with walls. Characters can take a step from one square to any square that is one step horizontal or vertical from it, but cannot cross walls. Given a start position and an end position, we can find the shortest path from the start position to the end position by using the A* algorithm with an admissible heuristic. In this current setup, the Manhattan distance would be admissible, since it never overestimates the distance to