Current location - Education and Training Encyclopedia - Resume - What are the examples of reverse search method and mountain climbing method?
What are the examples of reverse search method and mountain climbing method?
Reverse search

Computer science terminology

Popular Science China | This entry is reviewed by the entry writing and application project of Popular Science China.

Review expert Yao Yuan

Reverse search is a search from the target state, which is usually carried out simultaneously with forward search (two-way search). If the newly expanded state appears in the reverse search during the forward search, a solution (usually the solution with the least search steps) is found by connecting two search paths. If the newly expanded state in the reverse search has already appeared in the forward search, it is also the optimal solution, as mentioned above. Reverse search is not only a technology, but also a kind of thinking, which is widely used in computer software, internet technology, telecommunications technology, industrial general technology, trade economy and other fields.

Chinese name

Reverse search

Foreign name

Backward search

relative

Forward search

subject

computer technology

nature

Reverse thinking

Examples of artificial intelligence, examples of Internet applications, examples of railway transportation, examples of Internet trade, examples of computer software, and examples of reference materials mentioned by TA.

Examples of artificial intelligence

In artificial intelligence, two-way production system is a production system that applies both forward and reverse search methods. In this system, the state description and the target description are merged into a database, in which the state description applies the F rule and the target description applies the B rule. [1] For example, intelligent robots have the ability to solve problems automatically in order to make action plans. It can use a set of special production rules to search for solutions in the state space. In order to get the operation sequence, we can start from the current state set, make a forward search, or start from the target state set, make a reverse search, or choose the appropriate operation according to the difference between the target state and the current state (means-purpose analysis). [2]

Examples of Internet applications

The main work of search engine optimization (SEO) is to understand how various search engines grab Internet pages, how to index them, and how to determine their ranking of search results for a specific keyword, so as to optimize SEO pages, change their own websites, learn from websites with top search results, and thus improve the ranking of search engines, thereby increasing the number of visits to websites, and ultimately improving the sales or publicity capabilities of websites, thus achieving the purpose of SEO. This process of trying to figure out the search engine is a reverse search process.

An example of railway transportation

Reverse path search algorithm is an important algorithm in railway transportation system. The algorithm takes advantage of the similarity between site map and binary tree, and establishes binary tree model through site information. However, the search process of this algorithm is contrary to the traditional binary tree search algorithm, and it is the target sub-search root node. This reverse search can quickly and effectively complete the search of all paths without traversing the search. That is, the search for the basic route and the changed route between any pair of station buttons is completed in the station map. In order to meet some special requirements (solving the problem of train tracking), this search can also complete the basic route and change route search between any pair of station equipment.

For example, Internet trade.

The idea of establishing the reverse search model of network target market is: firstly, analyze the principle, function and use of a specific product, consider its main technical specifications, price and other factors, and determine the sample characteristics of the product; Based on the above analysis of product sample characteristics, the effective market is inferred; Formulate a set of retrieval steps to retrieve the business websites that need this product, so as to find the customers such as enterprises and companies that need this product.

Examples of computer software

Reverse search system, a system that checks whether one or several words in a given list exist from an input substring. The word list is stored in a memory array that includes a comparator for storing each memory cell of a sub-word. A string of molecules. Each substring is loaded into the comparison register many times, scrolling one subword at a time. In each memory cell, it is simultaneously compared with the input substring. A logic circuit of each memory cell detects the continuous matching of the sub-words of the string and the sub-words of the list word. As long as a complete word in the list matches, a signal is set for this word. Set a list of matching signals, which the priority encoder can use to output the address (location) of one of the matching words. [3] 1. Introduction to mountaineering methods

Mountain climbing method is an optimization algorithm, which generally starts with a random solution and then gradually finds an optimal solution (local optimum). Assuming that the problem has multiple parameters, we can increase or decrease the value of one parameter by one unit in the process of getting the optimal solution step by step by climbing the mountain. For example, three integer parameters, x 1, x2 and x3, are needed to solve a problem. At first, these three parameters are set to (2, 2, -2), x 1 increase/decrease 1 and two solutions are obtained (1, 2, -2), (3). Increase/decrease x2 by 1 and get two solutions (2,3, -2), (2, 1,-2); X3 increases/decreases 1 and obtains two solutions (2,2,-1), (2,2, -3), thus obtaining a solution set:

(2,2,-2), ( 1, 2,-2), (3, 2,-2), (2,3,-2), (2, 1,-2), (2,2,- 1), (2,2,-3)

Find the optimal solution from the above solution set, then construct another solution set based on the above method, and then find the optimal solution. In this way, the "climbing" will not end until the previous optimal solution is the same as the next optimal solution.

Second, Python example

Let the equation y = x 1+x2-x3, where x 1 is an integer in the interval [-2,5], x2 is an integer in the interval [2,6], and x3 is an integer in the interval [-5,2]. Use the mountain climbing method to find the solution that minimizes the y value.

The code is as follows:

Random import

Definition evaluation (x 1, x2, x3):

Returns x 1+x2-x3.

if__name__== '__main__ ':

x_range = [ [-2,5],[2,6],[-5,2] ]

best _ sol =[random . randint(x _ range[0][0],x_range[0][ 1]),

random . randint(x _ range[ 1][0],x_range[ 1][ 1]),

random.randint(x_range[2][0],x_range[2][ 1])]

Although correct:

best _ evaluate = evaluate(best _ sol[0],best_sol[ 1],best_sol[2])

Current Best Value = Best Evaluation Value

sols = [best_sol]

For I in xrange(len(best_sol)):

if best _ sol[I]& gt; x_range[i][0]:

sols . append(best _ sol[0:I]+[best _ sol[I]- 1]+best _ sol[I+ 1:])

if best _ sol[I]& lt; x_range[i][ 1]:

sols . append(best _ sol[0:I]+[best _ sol[I]+ 1]+best _ sol[I+ 1:])

Printing sol

For s:

el = evaluate(s[0],s[ 1],s[2])

If el<'s best assessment:

best_sol = s

best_evaluate = el

If Best Evaluation = = Current Best Value:

break

Print "Best Solution:", Current Best Value, Best Solution

The result of the operation is as follows:

[[0, 5, 1], [- 1, 5, 1], [ 1, 5, 1], [0, 4, 1], [0, 6, 1], [0, 5, 0], [0, 5, 2]]

[[- 1, 5, 1], [-2, 5, 1], [0, 5, 1], [- 1, 4, 1], [- 1, 6, 1], [- 1, 5, 0], [- 1, 5, 2]]

[[-2, 5, 1], [- 1, 5, 1], [-2, 4, 1], [-2, 6, 1], [-2, 5, 0], [-2, 5, 2]]

[[-2, 4, 1], [- 1, 4, 1], [-2, 3, 1], [-2, 5, 1], [-2, 4, 0], [-2, 4, 2]]

[[-2, 3, 1], [- 1, 3, 1], [-2, 2, 1], [-2, 4, 1], [-2, 3, 0], [-2, 3, 2]]

[[-2, 2, 1], [- 1, 2, 1], [-2, 3, 1], [-2, 2, 0], [-2, 2, 2]]

[[-2, 2, 2], [- 1, 2, 2], [-2, 3, 2], [-2, 2, 1]]

Optimal solution:-2 [-2,2,2]

It can be seen that the optimal solution is -2, x 1, and the corresponding values of x2 and x3 are -2, 2 and 2 respectively.

Third, how to find the global optimum.

The optimal solution obtained by mountain climbing method may be a local optimal solution. If we want to get a better solution, we must use the mountain climbing algorithm many times (starting from different initial solutions) to find the optimal solution from multiple local optimal solutions, which may also be the global optimal solution.

In addition, simulated annealing algorithm is also an algorithm trying to find the global optimal solution.

An example of implementing Kmeans++ algorithm with Python

1, from Kmeans, Kmeans is a very basic clustering algorithm, which uses the idea of iteration, so I won't talk about its principle here. Let's talk about how to use kmeans algorithm in matlab. Create seven two dimensions.

Analysis of Mapping, Reduction and Filtering in Python

1. Let's see what an iterative object is. Take the built-in max function as an example, and look at its Doc: Print Max. _ _ Doc _ Max (iterative [,key = func])-Value Max (a, b, c, ... [,key = func])-ValueWithSingleiteraParameter.

Introduction to Numpy in Python

1, what is Numpy is simple. Numpy is Python's scientific computing library, which provides the function of matrix operation. It is usually used with Scipy and matplotlib. In fact, list has provided a matrix-like