Example #1
0
        private static void PrintWeights(GiftMatrix matrix)
        {
            Console.Write("\\/gives  to> ");
            foreach (string participant in matrix.Participants)
            {
                Console.Write("{0, -4}", participant.Substring(0, 3));
            }

            Console.WriteLine();

            foreach (string giver in matrix.Participants)
            {
                Console.Write("{0, -13}", giver);
                int giverIndex = matrix.GetIndex(giver);

                foreach (string recipient in matrix.Participants)
                {
                    int recipientIndex = matrix.GetIndex(recipient);
                    Console.Write("{0, -4}", matrix.GetWeight(giverIndex, recipientIndex));
                }

                Console.WriteLine();
            }
        }
Example #2
0
 private static void GenerateHamiltonean()
 {
     _lastHamiltonean = HamiltonianCircuitFinder.DoTravelingSalesman(_family.ThawedMatrix);
     PrintWeights(_lastHamiltonean);
     _family.ThawedMatrix = _family.ThawedMatrix + _lastHamiltonean;
 }