Пример #1
0
        /*************************/
        // Algorithm for computing table values
        /*************************/
        // Returns the optimal value given a sigma,rho problem, and a binary decomposition tree of a graph
        public int Compute(IOptimal optimum, SigmaRhoInstance sigmaRhoInstance)
        {
            _sigmaRhoInstance = sigmaRhoInstance;
            _optimum = optimum;

            // Initialize the static parameters for our D-Neighborhoods class, i.e. the parameters that tell us how many neighbor we should check
            // in order to validate a sigma-rho set
            DNeighborhood.Initialize(sigmaRhoInstance);

            // Compute the full table of representatives
            // Cuts[A] gives us a list of all D-representatives at cut G(A, V\A))
            _cuts = new RepresentativeTable(_graph, _tree);

            // Initialize the empty table
            _tables = new Dictionary<BitSet, Table>();

            // Fill the entire table in a bottom up fashion
            FillTable(_graph.Vertices);

            // The final result will be found at T[V][empty, empty], since there is only one equivalence class at the root of the decomposition tree (namely the empty set)
            BitSet emptySet = new BitSet(0, _graph.Size);
            return _tables[_graph.Vertices][emptySet, emptySet];
        }
Пример #2
0
 /*************************/
 // General methods
 /*************************/
 // Calculating the boolean dimension is done by computing all representatives
 private long CalculateBooleanWidth()
 {
     DNeighborhood.Initialize(new IndependentSet(2));
     RepresentativeTable cuts = new RepresentativeTable(Graph, Tree);
     return cuts.MaxDimension;
 }