Heuristic Function
Let us think what heuristic is in general. Heuristics are quick solutions to any problem. For example: Zuckerberg wears same dress everyday. If he had to wear different dress everyday, he had to choose his dresses everyday. In spite of this, he had chosen a default dress based on his past experiences. So this is the quickest solution of his everyday problem of what to wear.
Now let’s dive into the more theoretical approach. A heuristic function is a function that calculates the approximate cost to a problem. The purpose of a heuristic function is to guide towards the solution of a problem in the most profitable way possible. The solution may not be the best but works on approximately the best.
Let’s try an example.
Let’s say, we have to go from A to C. There are several ways to go there. Heuristic function will delineate the straight distance from A to C. In our case its the line in the blue color. We will not use the line to go from A to C. Hence, we will use it to find the appropriate path from A to C for us.