public void solveProblemGreedy()
        {
            //initialize BSSF with a greedy algorithm

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            Algorithms algorithms = new Algorithms();
            bssf = new TSPSolution(algorithms.greedy(Cities));

            stopwatch.Stop();

            Program.MainForm.tbCostOfTour.Text = " " + bssf.costOfRoute();
            Program.MainForm.tbElapsedTime.Text = " " + stopwatch.Elapsed.TotalSeconds;

            // do a refresh.
            Program.MainForm.Invalidate();
        }
        //Our TSP
        internal void solveProblemTabu()
        {
            int bssfUpdates = 0;
            Algorithms algorithms = new Algorithms();
            bssf = new TSPSolution(algorithms.greedy(Cities));
            TSPSolution currentSolution = new TSPSolution(bssf.Route);

            int size = Convert.ToInt32(Program.MainForm.textBoxTabuSize.Text);
            TabuList tabuList = new TabuList(size);//set capacity of tabuList
            int timeSeconds = Convert.ToInt32(Program.MainForm.textBoxTime.Text);
            double totalTime = 0;

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            while(stopwatch.Elapsed.TotalSeconds < timeSeconds)//run for 600 seconds, 10 minutes
            {
                currentSolution = findBestCandidate(currentSolution, tabuList);
                if(currentSolution.cost < bssf.cost)
                {
                    bssf = new TSPSolution(currentSolution.Route);
                    totalTime = stopwatch.Elapsed.TotalSeconds;
                    bssfUpdates++;
                }
                tabuList.addSolution(currentSolution);
            }

            stopwatch.Stop();

            Program.MainForm.tbCostOfTour.Text = " " + bssf.cost;
            Program.MainForm.tbElapsedTime.Text = " " + totalTime;
            //Program.MainForm.tbElapsedTime.Text = " " + stopwatch.Elapsed.TotalSeconds;
            Program.MainForm.toolStripTextBox1.Text = " " + bssfUpdates;

            //print bssf update number

            // do a refresh.
            Program.MainForm.Invalidate();
        }
        /// <summary>
        ///  solve the problem.  This is the entry point for the solver when the run button is clicked
        /// right now it just picks a simple solution. 
        /// </summary>
        public void solveProblemBandB()
        {
            //initialize BSSF with a greedy algorithm
            Algorithms algorithms = new Algorithms();
            bssf = new TSPSolution(algorithms.greedy(Cities));
            Node.bssf = bssf.costOfRoute();

            int maxQsize = 0;
            int totalStates = 0;

            int timeSeconds = Convert.ToInt32(Program.MainForm.textBoxTime.Text);

            //set up priority queue and stopwatch
            PriorityQueue PQ = new PriorityQueue();
            PQ.insert(new Node(Cities));
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            while(PQ.getSize() > 0 && stopwatch.Elapsed.TotalSeconds < timeSeconds)
            {
                //pop node off of queue and check lower bound against bssf
                Node node = PQ.deleteMin();
                if(node.lowerBound > Node.bssf)
                {
                    Node.prunes++;
                    break;
                }

                Node include = null;
                Node exclude = null;
                double maxDif = Double.NegativeInfinity;

                //search for include/exclude edge that gives max difference in lower bound
                double[,] matrix = node.rCmatrix;
                for (int i = 0; i < node.matrixLength; i++)
                {
                    if (node.exited[i] == -1)
                    {
                        for (int j = 0; j < node.matrixLength; j++)
                        {
                            if (matrix[i, j] == 0)
                            {
                                Node tempInclude = new Node(node, true, i, j);
                                Node tempExclude = new Node(node, false, i, j);
                                double potentialMaxDif = tempExclude.lowerBound - tempInclude.lowerBound;
                                if (potentialMaxDif > maxDif)
                                {
                                    maxDif = potentialMaxDif;
                                    include = tempInclude;
                                    exclude = tempExclude;
                                }
                            }
                        }
                    }

                }

                //check if found a bssf
                if(include.totalEdges == include.matrixLength && include.lowerBound < Node.bssf)
                {
                    Node.bssfUpdates++;
                    Node.bssf = include.lowerBound;
                    Node.bssfNode = include;
                }
                else if(include.lowerBound < Node.bssf)//add include node to queue
                {
                    PQ.insert(include);
                    int currentQSize = PQ.getSize();
                    if(currentQSize > maxQsize)
                    {
                        maxQsize = currentQSize;
                    }
                }
                else//prune include node
                {
                    Node.prunes++;
                }

                if(exclude.lowerBound < Node.bssf)//add exclude node to queue
                {
                    PQ.insert(exclude);
                    int currentQSize = PQ.getSize();
                    if (currentQSize > maxQsize)
                    {
                        maxQsize = currentQSize;
                    }
                }
                else//prune exclude node
                {
                    Node.prunes++;
                }

                totalStates += 2;//2 states are created per while-loop iteration

            }

            stopwatch.Stop();

            //if stopwatch is < 30, then we have found an optimal solution
            bool isOptimal = false;
            if(stopwatch.Elapsed.TotalSeconds < timeSeconds)
            {
                isOptimal = true;
            }

            //prune number of items left in the queue
            Node.prunes += PQ.getSize();

            //if a bssf has been found better than the greedy solution
            if(Node.bssfNode != null)
            {
                Node solution = Node.bssfNode;

                ArrayList route = solution.getRoute(Cities);

                // call this the best solution so far.  bssf is the route that will be drawn by the Draw method.
                bssf = new TSPSolution(route);
            }

            //display stats
            if (isOptimal)
            {
                Program.MainForm.tbCostOfTour.Text = " " + bssf.costOfRoute() + "*";
            }
            else
            {
                Program.MainForm.tbCostOfTour.Text = " " + bssf.costOfRoute();
            }

            Program.MainForm.tbElapsedTime.Text = " " + stopwatch.Elapsed.TotalSeconds;

            // do a refresh.
            Program.MainForm.Invalidate();

            //print more stats
            Console.WriteLine();
            Console.WriteLine("Max # of stored states: " + maxQsize);
            Console.WriteLine("# of BSSF updates: " + Node.bssfUpdates);
            Console.WriteLine("Total # of states created: " + totalStates);
            Console.WriteLine("Total # of states pruned: " + Node.prunes);

            Node.resetStaticVariables();
        }