Hill Climbing in Artificial Intelligence
Hill Climbing Artificial Intelligence: Hill climbing is a variant of generate-and-test that uses feedback from test procedures to help the generator determine the direction in which to move through the search space. In the pure generate-and-test procedure, the test function responds with only yes or no. However, if the test function is augmented with a heuristic function that provides an estimate of how close the given state is to the goal state, the generation procedure can use it as shown in the following procedure I will. In many cases, this is especially useful, as computing a heuristic function can be done almost at the same time as the solution’s test is running.
Hill climbing is often used when excellent heuristic functions are available to evaluate the state, but other useful knowledge is not available. For example, suppose you are in an unfamiliar city with no map and want to go downtown. You are simply aiming for a skyscraper. The heuristic function is simply a distance between the current location and the location of the skyscraper and the desired state is where this distance is minimized.
Recall from section 2.3.4 that one way to characterize the problem is to follow the answer to the question “Is a good solution absolute or relative?” There is always an absolute solution when it is possible to recognize the target state by examining it. Making a downtown is an example of such a problem. With these problems, hill climbing can be ended each time the goal condition is reached. However, for a maximization (or minimization) problem like a travelling salesman problem, there is only a relative solution. In these problems, there is no a priori target state. In this type of problem, it is reasonable to stop hill climbing if there is no reasonable alternative condition to move.
This video from Sanjay Pathak Youtube channel
Simple Hill Climbing in AI
The easiest way to do simple Hill climbing is as follows.
Algorithm: Simple Hill Climbing
Hill Climbing Algorithm Artificial Intelligence
1. Evaluate the initial condition If that is also the target state, return it and exit.
2. Loop until a solution is found or until there are no new operators to be applied.
(A) Select and apply an operator that has not yet been applied to the current state and continue with the initial state as the current state. In the current state: it
(b) evaluates the new state to create a new state
- If it is in a goal state, return it and exit.
- If it is not the target state but it is better than the current state, we will make it the current state.
- If it is not better than the current state, continue the loop.
The main difference between this algorithm and the algorithms provided and generate-and-test is to use an evaluation function as a way to inject task-specific knowledge into the control process. Using this knowledge and other methods described in the remainder of this chapter as heuristic search methods are to use such knowledge and is a way to solve problems that can not be resolved in other ways.
In this algorithm, I asked a relatively ambiguous question “Is a state newer than another state?” In order for the algorithm to work, an accurate definition of hetter should be provided. In some cases, this is a high value of the heuristic function. It is not a problem as long as a specific mountaineering program is consistent with its interpretation to others. Let’s go back to the four coloured block puzzle to solve the problem, to see how mountaineering works. First, we need to define a heuristic function that shows how much a particular configuration will be a solution. One such function is simply the sum of four aspects. The puzzle solution will have a value of 16. Next, you need to define a set of rules that describe how to convert one configuration to another. In fact, one rule is enough. It simply chooses a block and rotates it 90 degrees in any direction. This provided definitions can be done randomly or with the help of the last section. You can start climbing it now. Select a block and rotate it to create a new state. If we are getting better we will protect it otherwise return to the previous state and try another perturbation.
Notice that during this algorithm, we’ve asked the relatively vague question, “Is one state hetter than another?” For the algorithm to work, an exact definition of hetter should be provided. In some cases, it means that a better value of the heuristic function. In others, t means that lower value. It doesn’t matter that, as long as a particular hill-climbing program is consistent in its interpretation.
To see however hill climbing works, let’s come back to the puzzle of the four coloured blocks to solve the problem, we tend to 1st must define a heuristic function that describes however shut a specific configuration is to be an answer. One such function is just the sum of the number of various colours on each of the four sides. a solution to the puzzle can have a value of sixteen. Next, we want to outline a set of rules that describe ways that of transforming one configuration into another. Actually, one rule can suffice. It says simply pick a block and rotate it ninety degrees in any direction. Having provided these definitions, the next step is to get a beginning configuration. this could either be done at random or with the aid of the heuristic function described within the last section. currently, hill climbing will begin. we tend to generate a new state by selecting a block and rotating it. If the resulting state is best, then we tend to keep it. If not, we tend to come to the previous state and take a look at a distinct perturbation.
Must to Read