Term for a Heuristic for 2 Arbitrary Nodes - search

Is there a term or expression for a heuristic function (as in pathfinding, state space, or combinatorial search) which can estimate the distance between any two nodes (goal or non-goal nodes)?
Furthermore, is there a term for such a function which never overestimates the aforementioned distance?

In the context of the A* search algorithm, a heuristic estimate which never overestimates the distance is called "admissible".
Other than "heuristic" and "estimate", I don't think there's a consistent, distinguished term for the function itself.

Related

Pacman ai project - Suitable of combination of step cost and heuristic

As part of a project, I am trying to implement A* within the context of a pacman game (see UC Berkley pacman ai project). There are no ghosts or capsules, only a maze and the 'fruit'. I am having trouble, however, understanding the relationship between my heuristic function and my cost function.
As per the project, when defining the search problem, we need to specify a step cost that derives from:
score = -Nb Steps + 10*NbOfEatenDots + 200*NbOfEatenGhosts + (-500*isLoss) + (500*isWin)
This cost is supposed to be always positive and so, for simplicity, I have decided to take: 1.5 - (0.5*AteAFoodDot). I have ignored ghosts and capsules since they do not exist and I have given a preferential score for moves tht end up eating a dot. I have also ignored steps that result in a loss (since they do not exist) and steps that result in a win state.
Now as far as the A* algorithm itself is concerned, we have to implement a cost function and a heuristic function of our own:
As a cost function I have chosen: Cost = sum(step costs to current state) and as a heuristic: h = Manhattan distance between pacman and the dot closest to him + manhattan distance of this dot and another dot that is furthest away from it, as long as it exists, which is an admissible heuristic. I have also implemented this heuristic using real maze distances instead of manhattan distances, but this seemed too time consuming for mazes with many food dots.
Now if I have understood correctly if g(n) is my cost function and h(n) my heuristic, I must always have: g(n to goal) >= h(n) so that A* always returns an optimal path and the closest the values of g and h for a node n, the less nodes will be expanded.
In this respect, is it not in my interest to ignore how the score is computed, ignore the fact that a step results in eating a food dot or not and simply take step_cost = 1 for all steps?
This is how I obtain the best results with respect to computation time and nodes expanded, but ignoring the cost function of the game seems wrong.
Could someone clarify this for me? Is it a matter of rpeference/choice or is there an objective correct answer/best approach?

Black-box combinatorial optimization over permutations

I am solving general black-box optimization problems like:
x*: f(x) -> min, where x are permutations of length N (N = 50 for example, so brute force search is not possible). Objective function f(x) is represented by stand-alone computer code and x represents configuration of complex system with the response simulated by f(x).
I learned, that in this case I can use many heuristic methods. But, most of these methods use always some kind of local search, which require suitable distance metric at search space (space of permutations x in my case). Under suitable distance metric I mean the metric which fulfill the "locality" property, e.g. small change of permutation x produce small change of objective function f(x). In my case is not known any suitable distance metric with this property, so any kind of local search is nearly the random search.
I have a few questions:
Are there available any heuristic black-box combinatorial optimization methods, which does not use local search and/or any distance metric at search space? I need to overcome the low "locality" of the problem or simply the fact, that any suitable distance metric at search space is unknown.
Is the "locality" property really so restricted at combinatorial optimization in general? May be I miss something..., but the most of real-world black-box combinatorial problem has low or very low "locality" due to the fact, that the common permutation distance metrics (Hamming, Kendal, etc.) are not suitable metrics in general.
Is there any general method how to find suitable distance metric at search space to satisfy at least approximately the "locality"?
Additional remarks:
In real, the black-box function f(x) is realized by stand-alone deterministic simulation code, where x plays a role of discrete configuration of the simulated physical system. So, function f(x) has definitely well defined properties, but this properties are so difficult, that is not possible to simple exploit it.
Because of above mentioned complicated internal properties of function f(x) is not possible to find proper distance metric d(x,x') in search space which fulfill "locality" (similar x and x' in a sense of any distance metric produce similar responses f(x) and f(x'))
So, finally, I am looking for any optimization heuristics, which are able to find any suitable sub-optimal solutions only by informations available by properties of f(x) at fitness space. Like EDA's (Estimation of Distribution Algorithms) for example.
The main reason of this question is, what types of optimization heuristics are suitable to solve this kind of problems.

A* Search Advantages of Dynamic Weighting

I was reading about the variants of the A* search algorithm and I came across dynamic weighting. As I understand it, a weight is applied to the search equation, which decreases as the search gets closer to the goal node. I was specifically looking at this article : http://theory.stanford.edu/~amitp/GameProgramming/Variations.html
Can anyone tell me what the advantages of this would be? Why would you not care what nodes you expand at the start? Is it to help searches that don't necessarily have a good heuristic?
Thanks
For the TLDNR-crowd:
Dynamic weighting sacrifices solution optimality to speed up the search. The larger the weight, the more greedy the search.
For my fellow scholars:
Motivation
From the Wikipedia A-star article:
A-star's admissibility criterion guarantees an optimal solution path, but it also means that A* must examine all equally meritorious paths to find the optimal path. We can speed up the search at the expense of optimality by relaxing the admissibility criterion to obtain an approximate solution. Oftentimes we want to bound this relaxation, so that we can guarantee that the solution path is no worse than (1 + ε) times the optimal solution path. This new guarantee is referred to as ε-admissible.
Static Weighting
Before we talk about dynamic weighting, let's compare A-star to the simplest ε-admissible relaxation: static-weighted A-star.
In static-weighted A-star, f(n) = g(n) + w·h(n), with w=(1+ε) for some ε>0. To illustrate the effect on optimality and search speed, compare the number of nodes expanded in each of the following illustrations. Empty circles represent nodes in the open set; filled-in circles are in the closed set.
A-star (left) vs. Weighted A-star with ε=4 (right)
As you can see, weighted A-star expanded far fewer nodes and completed about 3x as fast. However, since we used ε=4, weighted A-star could theoretically return a solution that is (1+ε)=(1+4)=5x times as long as the optimal path.
Dynamic Weighting
Dynamic Weighting is a technique that makes the heuristic weight a function of the search state, i.e. f(n) = g(n) + w(n)·h(n), where w(n) = (1 + ε - (ε*d(n))/N), d(n) is the depth of the current search and N is an upper bound on the search depth.
In this way, dynamic-weight A-Star initially behaves very much like a Greedy Best First search, but as the search depth (i.e. the number of hops in the graph) increases, the algorithm takes a more conservative approach, behaving more like the traditional A-star algorithm.
Amit Patel's page says
With dynamic weighting, you assume that at the beginning of your
search, it’s more important to get (anywhere) quickly; at the end of
the search, it’s more important to get to the goal.
He is correct, but I would saythat with dynamic weighting, you assume that at the beginning of your search, it's more important to follow your heuristic; at the end of the search, it becomes equally important to consider the length of the path, too.
Additional Materials and Links:
Asst. Prof. Ira Pohl -- The Avoidance of (Relative)
Catastrophe, Heuristic Competence, Genuine DYnamic Weighting and
Computational Issues in Heuristic Problem Solving
Dynamic Weighting on Amit Patel's Variants of A*
Wikipedia -- Bounded Relaxation for the A* Search Algorithm

What is the difference between uniform-cost search and best-first search methods?

Both methods have a data structure which holds the nodes (with their cost) to expand. Both methods first expand the node with the best cost. So, what is the difference between them?
I was told that uniform-cost search is a blind method and best-first search is not, which confused me even more (both have information about node costs or not?).
The difference is in the heuristic function.
Uniform-cost search is uninformed search: it doesn't use any domain knowledge. It expands the least cost node, and it does so in every direction because no information about the goal is provided. It can be viewed as a function f(n) = g(n) where g(n) is a path cost ("path cost" itself is a function that assigns a numeric cost to a path with respect to performance measure, e.g. distance in kilometers, or number of moves etc.). It simply is a cost to reach node n.
Best-first search is informed search: it uses a heuristic function to estimate how close the current state is to the goal (are we getting close to the goal?). Hence our cost function f(n) = g(n) is combined with the cost to get from n to the goal, the h(n) (heuristic function that estimates that cost) giving us f(n) = g(n) + h(n). An example of a best-first search algorithm is A* algorithm.
Yes, both methods have a list of expanded nodes, but best-first search will try to minimize that number of expanded nodes (path cost + heuristic function).
There is a little misunderstanding in here. Uniform cost search, best first search and A* search algorithms are all different algorithms. Uniform cost is an uninformed search algorithm when Best First and A* search algorithms are informed search algorithms. Informed means that it uses a heuristic function for deciding the expanding node. Difference between best first search and A* is that best first uses f(n) = h(n) for expanding and A* uses f(n) = g(n)+h(n) for choosing the expanding node. h(n) is the heuristic function. g(n) is the actual cost from starting node to node n.
https://www.cs.utexas.edu/~mooney/cs343/slide-handouts/heuristic-search.4.pdf It can be seen here with more details.
Slight correction to the accepted answer
Best-first search does not estimate how close to goal the current state is, it estimates how close to goal each of the next states will be (from the current state) to influence the path selected.
Uniform-cost search expands the least cost node (regardless of heuristic), and best-first search expands the least (cost + heuristic) node.
f(n) is the cost function used to evaluate the potential nodes to
expand
g(n) is the cost of moving to a node n
h(n) is the estimated
cost that it will take to get to the final goal state from if we were
to go to n
The f(n) used in uniform-cost search
f(n) = g(n)
The f(n) used in best-first search (A* is an example of best-first search)
f(n) = h(n)
The f(n) used in A* search.
Note: The h(n) from best-first search above is expanded in A* so that it always includes g(n). It is still basically just a heuristic, but it is a heuristic that includes g(n).
f(n) = g(n) + h(n).
Each of these functions is evaluating the potential expansion nodes, not the current node when traversing the tree looking for an n that is a goal state
The differences are given below:
Uniform-cost search (UCS) expands the node with lowest path cost (i.e. with the lowest g(n)), whereas best-first search (BFS) expand the node with closest to the goal
UCS cannot deal with a heuristic function, whereas BFS can deal with a heuristic function
In UCS, f(n) = g(n), whereas, in BFS, f(n) = g(n) + h(n).
Uniform-cost search picks the unvisited node with the lowest distance, calculates the distance through it to each unvisited neighbor, and updates the neighbor's distance if smaller.
Best-first search is an heuristic-based algorithm that attempts to predict how close the end of a path (i.e. the last node in the path) is to the goal node, so that paths which are judged to be closer to a solution are expanded first.

DFS exploration of nodes vs A*

I'm trying to implement a search for a personal project in which the exploration of the nodes are relatively expensive. I was hesitant between using DFS(Dijkstra's Forward Search) or A*.
My question is, will there be a case where A* explores more nodes than DFS?
Dijkstra's original algorithm does not use a min-priority queue and runs in time |V|^2 (where |V| is the number of nodes). The implementation based on a min-priority queue implemented by a Fibonacci heap and running in O(|E|+|V|\log |V|) (where |E| is the number of edges) is due to (Fredman & Tarjan 1984). This is asymptotically the fastest known single-source shortest-path algorithm for arbitrary directed graphs with unbounded non-negative weights. However, specialized cases (such as bounded/integer weights, directed acyclic graphs etc) can indeed be improved further.
The time complexity of A* depends on the heuristic. In the worst case of an unbounded search space, the number of nodes expanded is exponential in the depth of the solution (the shortest path) d: O(b^d), where b is the branching factor (the average number of successors per state).This assumes that a goal state exists at all, and is reachable from the start state; if it is not, and the state space is infinite, the algorithm will not terminate.
The A* algorithm is a generalization of Dijkstra's algorithm that cuts down on the size of the subgraph that must be explored, if additional information is available that provides a lower bound on the "distance" to the target. This approach can be viewed from the perspective of linear programming: there is a natural linear program for computing shortest paths, and solutions to its dual linear program are feasible if and only if they form a consistent heuristic (speaking roughly, since the sign conventions differ from place to place in the literature). This feasible dual / consistent heuristic defines a non-negative reduced cost and A* is essentially running Dijkstra's algorithm with these reduced costs. If the dual satisfies the weaker condition of admissibility, then A* is instead more akin to the Bellman–Ford algorithm.
Worst case performance O(|E|)=O(b^{d})
and
Worst case space complexity O(|V|)=O(b^{d})
Dijkstra's algorithm can be viewed as a special case of A* where h(x)=0 for all x.
It should be noted, however, that Dijkstra's algorithm can be implemented more efficiently without including a h(x) value at each node.

Resources