The heuristic function is used in Informed Search for finding the most promising path. This takes the present state of the agent as its input and produces the estimation of how close the agent is to the goal. However, it is represented by h(n), and it calculates the cost of an optimal path between the pair of states. The value of the heuristic function is always positive.