Algorithm Analysis and Design (approximately & Optimization & approximation algorithm is not & Miscellaneous)

First, the optimization problem (Optimization Problem)

Either an optimization problem is to minimize the problem either maximization problem, which mainly consists of three parts:

1) Set a problem instance; 2) is obtained as an example of all solutions all candidate solutions; 3) A method of detecting candidate solutions;

Solutions of candidate minimum (maximum) called minimal solution (maximum solution)

Second, the approximation algorithm (Approximation algorithm)

Absolute approximation algorithm (absolute algorithm): if an optimization algorithm for all instances have A solution, and the solution generated by the algorithm instance

A (I) and the optimal solution OPT (I) is satisfied for all instances | A (I) -OPT (I) | <= K, compared with the absolute approximation algorithm;

Relative approximation algorithm (relative algorithm): if none of the example of an algorithm for the solution of the optimization problem has A, and the solution algorithm generated instance

A (I) and the optimal solution OPT (I) is satisfied for all instances of A (I) / OPT (I) <= K, compared with the relative minimization algorithm; OPT (I) / A (I) <= K, was relatively maximization algorithm;

Third, several algorithms prove relatively similar (2-VC, 2-Bin Pack, 1.5-Metric TSP)

1) relative approximation algorithm VC problem proved A (I) / OPT (I ) <= 2;

For a graph G = (V, E), according to the algorithm described above is added to the set C of the midpoint between the corresponding edges mutually independent;

Where A (I) = | C | , OPT (I)> = | C | / 2; the above two simultaneous equations is proved A (I) / OPT (I ) <= 2;

The number of points out to solve with this algorithm | C | a, between the edges of the structure are independent, in order to cover the sides of the optimal solution OPT (I) determined

Point number must be greater than or equal | C | / 2; and

The above algorithm time complexity is O (| E |) , the time complexity of the algorithm is only related to the number of edges;

2) the relative approximation algorithm Bin Pack problem , proof A (I) / OPT (I ) <= 2;

Problem Description: The number n is not greater than one barrel into not more than 1, to determine the minimum number of barrels of how much?

For bucket algorithm required a number of up to 2A, A and these data;

The sum of the two adjacent buckets is greater than 1 (i.e.: U [k] + U [k + 1]> 1), the capacity of each sensory bucket is greater than 1/2, A (I) <= 2 | A |;

The number of buckets optimal solution OPT (I) required must be> = | A | (each number is an optimal situation, need a barrel A, but it must be greater than actual);

Two simultaneous equations obtained above OPT (I)> = A ( I) / 2, thereby obtaining license A (I) / OPT (I ) <= 2;

The above algorithm time complexity of O (n-) , the time complexity of the algorithm related to the number of input data;

. 3) the Metric the TSP problem proved A (I) / OPT (I ) <= 3/2;

 Description of the problem: In a complete graph G, the respective sides of the triangle meet the rules to find a Hamiltonian circuit in FIG minimize cost;

1) T to identify the minimum spanning tree of each graph; time complexity is O (eloge)

2) the vertices of the odd added to set Q; the time complexity of O (n)

3) calculation of the vertices of the best-matching set odd M; time complexity O (| Q | ^ 3)

4) The third step is to add the new edge added to T M, all points of such T corresponding to all even degree, this picture shows the Euler, in each pass

We are all the same point when walking shortest path to another point; time complexity of O (n)

In the presence of G in a new configuration enables Euler traverse all of these side edges and the length of d (T) + d (M ) ( Euler length )

Then the loop Hamiltonian path length (path algorithm) A (I) <= d (T) + d (M);

OPT (I)> = d (T) OPT (I) / 2> = d (M) of the three simultaneous equations derived 3OPT (I) / 2> = A (I), obtained A (I) / OPT (I) <= 3/2;

Deleting an edge this figure becomes a spanning tree in the optimal Hamiltonian circuit, apparently OPT (I)> d (T) was established;

( Length of a spanning tree must be greater than its minimum length of spanning tree )

Fourth, not approximate algorithm (Inapproximation algorithm)

The problem is solved by approximation can not be absolutely no problems or approximately constant ratio (i.e., can not be absolute and relative approximation Approximate Solution)

V. Other

1) a problem (program) consists of two parts factors: time and space; (a measure of how algorithms: problem size and frequency of statements)

2) time (time complexity) absolute factor for an algorithm is;

The only goal of an algorithm to consider is to solve the problem of high efficiency, then this requires algorithm execution time is short, but also during operation

Low memory occupied. The space generally depends on the complexity of the problem itself (problem size), regardless of the algorithm. Time complexity of the algorithm is the pursuit of

Efficiency, both for the complexity under normal circumstances opposites, the two can not in uniform, they often sacrifice space to pursue efficient on time

rate. And now with the computer's memory capacity is growing, prices are getting cheaper.

3) efficient algorithm is able to solve the problem in polynomial complexity of the algorithm;

Published 79 original articles · won praise 81 · views 5715

Guess you like

Origin blog.csdn.net/weixin_44638960/article/details/103561055