Machine test method summary (to be updated)

Backtracking

Complete the following three steps by reading the title:

Description of the Solution of the form 1), all solutions of a solution space is defined, which contains the problem.

2) a state space tree structure.

3) Constraint constructor function (for killing node).

Then we would complete backtracking depth-first search through thought, the complete process is as follows:

1) Set Program initialized (initial value to a variable, the read data is known).

2) to test the conversion mode, if all of the test End switch (7).

3) whether or not this method is successful (by constraining function), the transfer is unsuccessful (2).

4) the success of the tentative step forward again tempted.

5) program has not yet found the right turn (2).

6) have found a program is recorded and printed.

7) a step back (back), if not then go to retreat the head (2).

8) has retreated to the head end or print no solution

 

Constraint function : characterized by a general description of the legal solutions Solutions for removing not legal, so as to avoid the remaining part of the continuing search for illegal solution. Thus, the constraint function is valid for any node tree state space, equivalent.

State-space tree : the state space tree is a graphic description of all solution. Solutions for each child node of the tree is only one part of the parent node different.

 

Depth-first traversal and breadth-first traversal

Questions categorized

Coordinate type search : This type of search is usually simple subject is relatively simple, complex usually more complex in terms of the discussion and the handling of the border situation, analyze these problems, we must first grasp the meaning of the topic, see the specific is how to establish a coordinate system (particularly important), then a careful analysis of each stage is to search for how to move to the next stage by the condition . Determine each recursive (for DFS) and in-depth retrospective conditions for BFS, pay attention to every note into the team's condition while heavy sentence . We must firmly grasp the target state is a state of what, at what time to end the search. And how DFS parameter setting process, is not with arguments or parameters, with each parameter, then we must be able to ensure full representation of a state, it will not be a state corresponding to a plurality of parameters, and this is for BFS went a little simpler, just you need to set some variables on it.

Value Type Search : This type of search would require careful analysis, in general the use of DFS, and its termination condition is usually obvious, the challenge is to grasp hold of the process, the process is similar to the type of coordinates search (re-sentenced, in-depth, enumeration), pay attention to this type of search usually have to use pruning optimized for those particular states clearly does not meet the requirements that we have to just get rid of it before, otherwise it will be like a snowball Like snowball, wasting our time. 
(Reprinted from https://blog.csdn.net/qq_41681241/article/details/81432634 )

 

how are you

The basic idea :

    1. mathematical model to describe the problem.

    2. Solving the problem into several sub-problems.

    3. For each sub-problem solving, get local optimal solutions to subproblems.

    Synthesis of a solution of the original solution to the problem solution handle 4. The local optimal solutions.

Guess you like

Origin blog.csdn.net/Mr_zhuo_/article/details/88426445