예제 #1
0
파일: Run.cs 프로젝트: whoaitsjoe/Research
        //returns true if candidate vertex can be decomposed in multiple ways from set of possible edges.
        private bool DoubleDecompositionHeuristic(Point2 candidateVertex, List <Point2> possibleEdges)
        {
            return(DoubleDecompositionBruteForce(candidateVertex, possibleEdges));

            //possibleEdges may not be required.

            var numberOfNonZeroCoordinates = candidateVertex.GetDimension();

            List <Point2> usedVectors = new List <Point2>();

            //create data structure to store (2) decompositions of candidate vertices.

            //make a copy of candidateVertex that will be modified (i.e. subtracting vectors).

            while (true)     //need to determine termination condition for loop
            {
                //find first nonzero coordinate of current vector
                var           firstNonZeroIndex = candidateVertex.FirstNonZeroIndex();
                List <Point2> splitVectors      = new List <Point2>();

                //generate corresponding unit vector
                Point2 unitVector = Point2.GenerateOnesVector(candidateVertex.GetDimension(), firstNonZeroIndex);

                //ensure unit vector is not in usedVector list, if vector is used, perform split. Check to make sure split vectors are not used before.
                if (usedVectors.Contains(unitVector))
                {
                    splitVectors = Point2.SplitVectors(unitVector, usedVectors);
                }

                if (splitVectors.Count == 0)
                {
                    //Cannot split the current vector, hence no decomposition possible
                }

                //subtract unit vector from current vector

                //add unit vector to usedVeectorList
            }
            return(DoubleDecompositionBruteForce(candidateVertex, possibleEdges));
        }