The local search algorithm in artificial intelligence

Source: Internet
Author: User

?? In the local search algorithm, we no longer care about the path from the initial node to the target node, but consider moving from the current node to its neighboring state until it reaches a reasonable target state. Compared with the non-information search algorithm and the information search algorithm, the local search algorithm can find a reasonable solution in a large or infinite state space with constant spatial complexity (no saving path).

Climbing method

The method of climbing continues to move in the direction of increased value until it reaches its peak.

function HillClimbing(problem) returns a local maximum state    current_state = initial_state    loop do        next_state = the highest neighbor        if (next_state is higher than current_state)           current_state = next_state        else           return current_state

The problem with mountain climbing is that it can only guarantee the arrival of the local maximum, but it cannot guarantee the maximum global value.

For example, we start at point C, then we stop at the local maximum of a, so there is no way to reach the global maximum B point.

Simulated annealing algorithm

?? The simulated annealing algorithm is similar to the mountain climbing method, except that we no longer move in the direction of increasing value, but move in the direction of decreasing the value in a certain probability, which makes it possible for us to step out from the local maximum point A and reach the global maximum of B.
?? This is called simulated annealing because the probability is relatively high at first, and as time increases, the probability decreases as the temperature fades.

function SimulatedAnnealing () returns a solution state    current_state = initial_state    for t = 1 to infinite do        T = schedule(t)        if T = 0 then            return current_state        next_state = a randomly selected neighbor        E = next_state.height - current_state.height        if E > 0 then            current_state = next_state        else             current_state = next_state with probability e^(E/T)
Genetic algorithm

?? Genetic algorithms mimic the genetic process in organisms, starting with the initial population, iterating through a series of hybridization and mutation until a suitable population is obtained and the best individual is selected from it.

function Geneticalgorithm (population, fitin) returns a solution state Inputs:population, a set of individuals  Fitness, a function that measures fitness of an individual repeat new_population = Empty_set for I = 1 to sizeof (population) does x = Randomselect (population, fitness) y = randomselect (population, fit ness) new_individual = reproduce (x, y) if (a probability) then new_individual = Mutat E (new_individual) add new_individual to new_population until some individuals is fit enough or time has ELA psed return the best individual in the Population----------------------------------------------------------------function reproduce (x, y) returns a new Individual inputs:x, Y, the parents of the new individual length = length (x) Mutation_point = Randomselectin   (1, length) New_individual = Sub (x, 1, mutation_point) + sub (y, mutation_point, length) Return new_individual 

Local search algorithms in AI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.