Differential constraint system

Source: Internet
Author: User
Tags constant

(This article assumes that the reader already has the following knowledge: The basic nature of the shortest path, the Bellman-ford algorithm.) )
For example, there is such a set of inequalities:

X1-X2 <= 0
X1-X5 <=-1
X2-X5 <= 1
X3-X1 <= 5
X4-X1 <= 4
X4-x3 <=-1
X5-X3 <=-3
X5-x4 <=-3

Inequalities Group (1)

It's all two unknowns. The difference is less than or equal to a constant (greater than or equal to, since left and right multiplied by-1 can be converted to less than or equal). Such an inequality group is called a differential constrained system.
This inequality group is either no solution, or there are countless groups of solutions. Because if there is a set of solutions {X1, X2, ..., Xn} words, then for any one constant k,{x1 + K, X2 + K, ..., Xn + k} must also be a set of solutions, since any two number is added to a number at the same time, their difference is constant, then all inequalities in this differential constrained system will not be destroyed.

The solution of the differential constraint system utilizes the triangular inequalities in the single source shortest path problem. That is, for any one edge U-V, there are: D (v) <= D (U) + w (U, v)

where D (U) and D (v) are the weights of the shortest path from the source point to the U and Point v respectively, W (U, v) is the weight of the edge U-V.
Obviously the above inequalities are D (v)-D (U) <= w (u, v). This form is exactly the same as the inequality form in the differential constrained system. So we can transform a differential constraint system into a graph, each unknown XI corresponds to a vertex vi in the graph, and all inequalities are turned into an edge in the graph. For inequality Xi-xj <= C, it is turned into a triangular inequality: Xi <= Xj + C, you can turn to the edge VJ--Vi, the weight of c. Finally, we find a single-source shortest path on this graph, and these triangular inequalities will all be satisfied, because it is the basic nature of the shortest path problem.
In other words, the so-called single-source shortest path, of course, to have a source point, and then seek this source point to all other points of the shortest path. So where is the source point? We might as well have made one ourselves. Taking the above inequality group as an example, we add an unknown X0. And then to the original each unknown to X0 arbitrarily add an inequality (this inequality of course and other inequalities form the same, that is, the difference of two unknowns is less than or equal to a certain constant). We simply wrote xn-x0 <= 0, so the following inequalities are found in this differential constraint system:

x1-x0 <= 0
x2-x0 <= 0
x3-x0 <= 0
x4-x0 <= 0
x5-x0 <= 0

Inequalities Group (2)

For these 5 inequalities, the corresponding edges are also built in the diagram. The resulting figure is as follows:

Figure 1

Each edge in the graph represents an inequality in the differential constrained system. Now take V0 as the source point, and find the shortest path of single source. The shortest path length obtained from V0 to VN is a solution of xn. As you can see from Figure 1, this set of solutions is {-5,-3, 0,-1,-4}. Of course, adding 10 to each number is also a set of solutions: {5, 7, 10, 9, 6}. But this set of solutions satisfies only the inequality group (1), which is the original differential constraint system, and does not satisfy the inequality group (2), which is the inequalities we add later. Of course this is irrelevant, because X0 is an outsider, we added to the later, full of not satisfied with the inequality of X0 we do not care.
There is also the possibility that there will be no solution, that is, there is no shortest path from the source point to a vertex. It is also said that there is a circle of negative power in the picture. I will not unfold this point, please see some basic theorems of the shortest path problem.
In fact, for Figure 1, it represents a set of solutions that are {0,-5,-3, 0, 1, 4}, meaning that the value of X0 is also in this set of solutions. But the value of X0 is undisputed, since it is the shortest path to the source, the shortest path length of the source point is of course 0. Therefore, in fact, we solve this differential constraint system virtually there is a condition:

X0 = 0

That is, in the inequality group (1), (2) composed of a differential constraint system, and then the value of one of the unknowns is determined to die. Such a situation is very common in practical problems. For example, a problem on the surface of some inequalities, but also hidden some inequalities, such as all unknowns are greater than or equal to 0, or not more than a certain limit. For example, the above inequality group (2) specifies that all unknowns are less than or equal to 0.

For this differential constrained system with an unknown value, there is also an interesting property, that is, the shortest path algorithm to find out a set of solutions, all unknowns are reached maximum. Let me give you a rough proof that this process of proving is to be illustrated by the process of combining the Bellman-ford algorithm.
Suppose X0 is dead; X1 to xn the maximum value that can be taken in cases where all constraints are met is M1, M2 、......、 Mn (of course we do not know what their values are); The shortest path length of the extracted source points to each point is D1, D2 、......、 Dn.
The basic Bellman-ford algorithm is the initial initialization of the D1 to the DN, which are infinitely large. Then we check all the edges corresponding to the triangle inequality, one but found that there is not satisfied with the triangle inequality, then update the corresponding D value. The last D1 to the DN is the shortest path length from the source point to each point.
If we initially initialized the values of D1, D2 、......、 dn to M1, M2 、......、 Mn respectively, then because they all satisfy the triangular inequalities (we have just assumed that M1 to Mn is a valid set of solutions), then the Bellman-ford algorithm will no longer be new to the D value, The final Solution is M1, M2 、......、 Mn.
Well, now you know, when the initial value is infinite, the D1, D2 、......、 Dn are calculated, and when the initial value is smaller, the M1, M2 、......、 Mn are calculated. We use the same algorithm, the same calculation process, it is not possible to calculate the initial value of a large number of results but small bar. So D1, D2 、......、 DN is M1, M2 、......、 Mn.

So what if the minimum value of all other unknowns is required in the case of a dead unknown. As long as the longest path in reverse is possible. The trigonometric inequalities in the longest path are reversed in the shortest path: D (v) >= D (U) + w (U, v)
i.e. d (v)-D (U) >= w (u, v)

Therefore, when you build the map, you must first put all the inequalities into greater than equals. Other processes, including proofs of why the minimum value was solved, are quite similar.

The problem with the differential constraint system is hdoj1384, good luck.

Reprinted from: HTTP://YCOOL.COM/POST/M2UYBBF

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.