Thursday 10 December 2015

What is Heuristic algorithm?

HEURISTIC ALGORITHM

The term heuristic is used for algorithms which find solutions among all possible ones ,but they do not guarantee that the best will be found,therefore they may be considered as approximately and not accurate algorithms.These algorithms,usually find a solution close to the best one and they find it fast and easily.Sometimes these algorithms can be accurate,that is they actually find the best solution, but the algorithm is still called heuristic until this best solution is proven to be the best.The method used from a heuristic algorithm is one of the known methods,such as greediness,but in order to be easy and fast the algorithm ignores or even suppresses some of the problem's demands.

Heuristic Search

A heuristic is a method that

  • might not always find the best solution
  • but it is guaranteed to find a good solution in reasonable time.

  • By sacrificing completeness it increases efficiency.
  • Useful in solving tough problems which
    • could not be solved any other way.
    • solutions take an infinite time or very long time to compute.
The classic example of heuristic search methods is the travelling salesman problem.

Heuristic Search methods Generate and Test Algorithm

  1. generate a possible solution which can either be a point in the problem space or a path from the initial state.
  2. test to see if this possible solution is a real solution by comparing the state reached with the set of goal states.
  3. if it is a real solution, return. Otherwise repeat from 1.
This method is basically a depth first search as complete solutions must be created before testing. It is often called the British Museum method as it is like looking for an exhibit at random. A heuristic is needed to sharpen up the search. Consider the problem of four 6-sided cubes, and each side of the cube is painted in one of four colours. The four cubes are placed next to one another and the problem lies in arranging them so that the four available colours are displayed whichever way the 4 cubes are viewed. The problem can only be solved if there are at least four sides coloured in each colour and the number of options tested can be reduced using heuristics if the most popular colour is hidden by the adjacent cube.

Hill climbing

Here the generate and test method is augmented by an heuristic function which measures the closeness of the current state to the goal state.

  1. Evaluate the initial state if it is goal state quit otherwise current state is initial state.
  2. Select a new operator for this state and generate a new state.
  3. Evaluate the new state
    • if it is closer to goal state than current state make it current state
    • if it is no better ignore
  4. If the current state is goal state or no new operators available, quit. Otherwise repeat from 2.
In the case of the four cubes a suitable heuristic is the sum of the number of different colours on each of the four sides, and the goal state is 16 four on each side. The set of rules is simply choose a cube and rotate the cube through 90 degrees. The starting arrangement can either be specified or is at random.


No comments:

Post a Comment