![]() |
SystemOfBinaryEquations |
|
Let where be the boolean variables meaning package is installed. The system contains equations such as "at least" or "dependent on" or "incompatible" To solve, one can try all the possibility to see whether they satisfy the system or not. The calculation amount is (a) When solving this system, set a boolean value to , an equation related to must be either dummy true or implying the other variable to be a specific boolean value. For case of dummy true, simply this equation is removed from the system for further simpler system. For case of "implying the other variable", put the decision info by an arrow in the graph:
For , it is
For , it is
For , it is
(b) said in (a) already ( c) It is like spread of 殭屍病毒. Starting from a single node, it spreads and infects all nodes by the graph above. So a feasible configuration must be a collection of a connected area. Take an example, package is only relevant to package by the "at least" equation so a feasible configuration is like:
And every arrow is the only arrow in a connected area
But note that an occupying area in a connected is not necessarily feasible. It is possible an
and an (d) Beside the trivial algorithm mentioned above. It is possible to structure the algorithm recursively by leading a system of variables and equations to a smaller system of variables and equations where and . In fact, this algorithm is the same spirit when one tries to solve a system like substitution of variables taught in middle school about linear system. Internal in the algorithm, one must make use of the graph or equivalent construct to conduct the "reduction of the system" ( e) The both algorithms, this one in (d) and the trivial one mentioned before (a), must be correct. What else it could be? (f) The simple trivial algorithm is . For the recursive one, let denote the computation size, then by its recursive structure, it is where and is for trying setting some variable to be true and is for trying setting this variable to be false. When one of the or arguments of the function reaches zero, it is the base case. Therefore, for worst case it is :
So the size is total terms aka, where $[latex=
So the overall work size is
|
|