Path to the Truth
A Fast Minimum Vertex Cover Approximation
0Although I think the discovery has a coincidence, I still love this algorithm. So I copied part of our final report and posted it here.
Optimal Solution by clique method
We came up with a method based on the observation that the minimum vertex cover of a clique is v-1, assuming the clique has v vertices, since the vertices in the clique are fully linked. Thus we call it clique method.
We use a greedy algorithm to separate the graph into cliques:
First of all, sort the vertices by their degrees in descending order. Start off with picking the first vertex in the sorted list of vertices, as a clique, then go along the list. If the union of a vertex in the list, besides the rst one being picked, with the clique remains clique, then this vertex is part of the clique. When coming to the end of the list, we obtain a clique of minimum size 1. Then
remove the vertices in the clique and all edges incident to the vertices from the graph G, we get a new graph G’ and a new sorted list of vertices by their degrees. Iterate this procedure until G is represented by a set of cliques. There could be some vertices of degree 0 left in G’, which should be treated as cliques one by one.
As we all know, after the graph is separated into several cliques (although single point clique may happen), whenever we remove vertices from the graph and check whether it still form a vertex cover, we can at most delete 1 vertex from each clique. In this phase, we try all the possible answers by brute force. Assign status to all the cliques: vi is deleted, or no vertex is deleted. So
for every clique that has n vertices, there are n+1 status.
We optimized the procedure of processing the cliques. Try to assign status from the first clique to the last one(choose which to delete or not delete). If in such an status that two deleted vertices from two distinct cliques share an edge, reject the status and change the status a little bit and try again. This helps avoid unnecessary iterations.
After the procedure is finished, all the possible vertex covers are compared, we can conclude with the minimum vertex cover. The complexity depends on how well we can separate the graph into cliques. Roughly speaking, if we can separate a graph with n points into m cliques, the complexity is O(( n/m)^m).
Essentially the procedure of translating the cliques into minimum vertex cover is numerating all vertex cover, no matter how we optimized it, it is time consuming, though it guarantees an optimal solution.
The reason it’s time costing is the input graph is too large, if it’s a small graph, the running time is acceptable. Thus we decide to preprocess the original graph to make it smaller, which can improve the effciency. This is how the following method comes from.
Approximation Solution by Preprocessing before Clique method
Sort the vertices by their degree in descending order.
Pick greedy 2-approximation from the sorted vertices list above, from the vertex who has most neighbours to the least.
Pick “boundary” vertices from the 2-approximation above. Evaluate the vertices in the 2-approximation, if there is an edge in the graph that one end point is in the 2-approximation, the other is not, we label the vertex in the 2-approximation as “boundary” vertex.
Remove all the boundary vertices from the graph along with the edges they can cover. Sort the vertices in the new graph and pick a greedy 2-approximation, nd the boundary vertices again and again, until there is a time that none of the vertices in the 2-approximation is a boundary vertex. Now we name the graph left as “core”. Usually core is very small.
Apply the clique method to the core of small size, find the minimum vertex cover of the core, union the boundary vertices we’ve already deleted, it is the minimum vertex cover this method can achieve. The complexity of the algorithm can be O(n^2).
The motive behind this method is that clique algorithm works better when there are more edges (in this case the graph can be translated to fewer cliques), and the greedy 2-approximation algorithm works better when the graph has fewer edges, which would lead to a faster approximation. Combining these two can achieve maximum performance on general graphs. It’s intuitive to find out that this method offers an approximation of the optimal solution, due to the preprocess. However, generally speaking, we confront a tradeo between optimal solution and efficiency. Since this method gives impressive approximation of the optimal solution, it gains more on efficiency than loss on solution.
The code and testing set:
After compiled the cpp file, you can use like that:
./greedy_appro < 450-420.g
Here 450 Means the number of vertices in the graph, 420 means the minimum vertex cover size. Our algorithm gives a approximation of size 427. If you want to see the 427 cover, you can use:
./greedy_appro -c <450-420.g
Link:
Run Debian inside Alpine
0It seems good that Alpine really saves plenty of RAM. After my server boot, only 50+ MB is used. At last the shortage of RAM does never belong to my server.
Everything has pros and cons. Alpine is a distribution to make every package as small and light as possible. It uses uClibc, not glibc used by other linux server distros, which leads incompatible with binary packages compiled with glibc(most binary packages are not compiled as static release). Here raises a question, how can I run these closed-source binaries in alpine?
“debootstarp” is a package running Debian inside Alpine. It can solve all the problems with chroot. By default, the kernel is compiled with grsec, which forbids chroot. The config of grsec should be changed before running debootstrap.
#apk add debootstrap
#echo 0 > /proc/sys/kernel/grsecurity/chroot_deny_mount
#echo 0 > /proc/sys/kernel/grsecurity/chroot_deny_chmod
#mkdir /mnt/debian
#debootstrap –arch=amd64 stable /mnt/debian
#chroot /mnt/debian /bin/bash
Wow, Debian inside Alpine!
Summer Note 2-The Adjoint Method
0The outline can be listed below:
1. The bounded linear operator, and the continuity definition of a linear operator, which is equivalent to: bounded or continuous at the origin.
2. The dual space, which is defined as a real bounded linear function. The adjoint operator definition:
Let [latex]T:X \to Y[/latex] be a bounded linear operator between Banach spaces X and Y. The adjoint operator [latex]T^{*} : X^{*} \to Y^{*}[/latex] can be constructed as: [latex]T^{*} (F)(x)=F(T(x))[/latex] for all [latex]x\in X, F\in Y^*[/latex]
Because every bounded linear operator over a Banach space X can be reconsidered as inner product:
[latex]F(x)=<x,y>[/latex]for all [latex]x\in X[/latex] and [latex]||F||=||y||[/latex] Here y is only linked with F.
So it is a comparatively simple step to define the inner product form of an adjoint operator [latex]y^*[/latex] instead of the function form[latex]T^*[/latex]:
[latex]F_T(x):=<T(x),y>=<x,y^*>[/latex] for all [latex]x\in H[/latex]
3. The differentiability definition in a Banach Space:
Gateaux differentiable at [latex]x_0[/latex]
[latex]DT(x_0;h):=\lim_{\epsilon \to 0} \frac{T(x_0+\epsilon h)-T(x_0)}{\epsilon}[/latex]
Frechet differentiable:
[latex]\lim_{||\delta x||\to 0}\frac{||T(x_0+\delta x)-T(x)-T’(x_0)\delta x||}{||\delta x||}=0[/latex]
They are equal when the two equations exist on all [latex]x,\delta x \in X[/latex]
The partial Frechet derivative [latex]D_x(x_0,y)[/latex]of an operator:
[latex]\lim_{||\delta x|| \to 0}\frac{||U(x_0+\delta x,y)-U(x_0,y)-D_x(x_0,y)(\delta x)||}{||\delta x||}=0[/latex]
Because the differentiability is defined by limit equations, the notion of the chain rule applies to operators that are continuously Frechet differentiable.
Then it comes the optimal question, I had the problem on figuring out the two functions given: [latex]J(\rho,\lambda),E(\rho,\lambda)[/latex]. [latex]J(\rho,\lambda)[/latex]is the cost function and [latex]E(\rho,\lambda)=0[/latex] is the solution of [latex]\frac{\partial \rho(x,t)}{\partial t}+\frac{\partial}{\partial x}(v(\rho)\rho(x,t))=0[/latex] with conditions.
Because [latex]\rho[/latex] is a function of [latex]\lambda[/latex], [latex]J(\rho,\lambda)[/latex] can be seen as [latex]j(\lambda)[/latex]. Then the book gives 3 conditions assumed, which assume everything is continuously Frechet differentiable. I have some problems here. I can’t understand how he find these 3 assumptions. Hope it will be clear when I reading the calculation part.
I should look up the details on Lagrangian operator. The only thing I know in calculating minimum is Lagrange multipliers. Which is said not work during the semiconductor factory problem. I will update the Algorithm For Solving when I am ready.
Summer Note 1 – Mathematical Models for Control Systems
1It has become a problem that nowadays control system is getting complex. To describe, calculate, and optimize production, 3 classical mathematical models are introduced.
1.Discrete event simulation: very accurate but hard to calculate complex models. Probability distribution calculation needed. Distribution functions calculability limited by sample accessibility.
2.Queueing networks: fairly accurate (using average data) but hard to calculate complex models. Only works with steady models (time infinite).
3.Fluid Models (ODE): [latex]\frac{dq(t)}{dt}=\lambda(t)-\sigma(t)[/latex]
It describes queue change rate is influx rate minus outflux rate.
It is easy to calculate. But it uses average data (no possibility included), which may lead to trivial results. And [latex]\lambda(t)[/latex] and [latex]\sigma(t)[/latex] are not easy to find.
So the author introduced a new model: Continuum Model
It uses a totally new view. The model doesn’t put too much attention on the physical position. A new attribute is introduced for each item, stage x, from 0% to 100%. Then the completion of a item can be involved into mathematical calculation.
The core equation is:
[latex]\frac{\partial \rho (x,t)}{\partial t}+\frac{\partial}{\partial t}(v(\rho)\rho (x,t))=0[/latex]
The function [latex]\rho (x,t)[/latex]is the density, when the stage is x and time is t.
It took me some time to understand the equation. I think it is just like the flood in Yangtze River now. The height of water is the function [latex]\rho (x,t)[/latex], over position x and time t.
The equation is setup up like this because the change of [latex]\rho (x,t)[/latex] over time(x fixed) is just like the change of the height of water. It is caused by the different velocity of water over position x. The different velocity is describe as the [latex]-\frac{\partial}{\partial t}(v(\rho)\rho (x,t))[/latex].
Here the author uses [latex]v(\rho)[/latex], which describe moving speed of 1 item (just like 1 water molecule in Yangtze River).
The velocity [latex]v(\rho)[/latex] is defined by: [latex]v(\rho)=\frac{v_{max}}{1+\int_0^{1}\rho (s, t) ds}[/latex]
or by [latex]v(\rho)=v_{max}(1-\frac{\int_0^{1}\rho (s,t) ds}{L_{max}})[/latex]. Here [latex]L_{max}[/latex] is the max load.
I haven’t looking up the article where these two definition come from. But it can be concluded from experience I think.
In this model, the changing chain: influx–WIP–velocity–outflux
BOP
2The balance of Payments
These are the accounts used in the balance of payments
- Current Account
- Net export/imports of goods (balance of trade)
- Net exports/imports of services
- Net income (investment income from direct and portfolio investment plus employee compensation)
- Net transfers (sums sent home by migrants and permanent workers abroad, gifts, grants, and pensions)
- Capital Account
- Capital transfers related to the purchase and sale of fixed assets such as real estate
- Financial Account
- Net foreign direct investment
- Net portfolio investment
- Other financial items
- Net Errors and Omissions
- Missing data such as illegal transfers
- Reserves and Related Items
- Changes in official monetary reserves including gold, foreign exchange and IMF position.








