private void SortUpdate()
        {
            var t0 = Stopwatch.GetTimestamp();

            try {
                if (this.rdoNoSort.Checked)
                {
                    this.Log("==== No Sort ====");
                    this.NoSort();
                }
                else if (this.rdoNearestNeighbor.Checked)
                {
                    this.Log("==== Nearest Neighbor ====");
                    this.SortNearestNeighbor();
                }
                else if (this.rdo2Opt.Checked)
                {
                    this.Log("==== 2-OPT ====");
                    this.NoSort();
                    this.Improve2Opt();
                }
                else if (this.rdo2OptNative.Checked)
                {
                    this.Log("==== 2-OPT ====");
                    this.NoSort();
                    AlgDll.Improve2Opt(this.visitOrder, this.visitOrder.Length, this.distTable);
                }
                else if (this.rdoNearestNeighbor2Opt.Checked)
                {
                    this.Log("==== Nearest Neighbor + 2-OPT====");
                    this.SortNearestNeighbor();
                    this.Improve2Opt();
                }
                else if (this.rdoNearestNeighbor2OptNative.Checked)
                {
                    this.Log("==== Nearest Neighbor + 2-OPT====");
                    this.SortNearestNeighbor();
                    AlgDll.Improve2Opt(this.visitOrder, this.visitOrder.Length, this.distTable);
                }
                else if (this.rdoGoogleRoute.Checked)
                {
                    string msg = string.Format("==== Google Route ====");
                    this.Log(msg);
                    RoutingSearchParameters srcPrms = (RoutingSearchParameters)this.grdPrm.SelectedObject;
                    this.SortGoogleRoute(srcPrms);
                }
            } catch (Exception ex) {
                this.visitOrder = new int[0];
                this.Log(ex.ToString());
            }

            var ms = (Stopwatch.GetTimestamp() - t0) / (double)Stopwatch.Frequency * 1000;

            float calcDist = CalcRouteDist(this.visitOrder);

            this.Log(string.Format("Route Dist : {0}", calcDist));
            this.Log(string.Format("Calc Time  : {0}ms", ms));

            this.pbxDraw.Invalidate();
        }
        private void DoBenchmark()
        {
            Log("==== Benchmark Started ====");
            Random rnd = new Random();

            int[] pointNums = { 100, 200, 500 };
            int   benchNum  = (int)numBenchMark.Value;

            foreach (var pointNum in pointNums)
            {
                this.Log(string.Format("== PointNum : {0}", pointNum));
                for (int benchIndex = 0; benchIndex < benchNum; benchIndex++)
                {
                    GeneratePoints(pointNum, rnd);
                    CalcDistTable();

                    long t0 = Stopwatch.GetTimestamp();
                    SortNearestNeighbor();
                    double ms0       = (Stopwatch.GetTimestamp() - t0) / (double)Stopwatch.Frequency * 1000;
                    float  calcDist0 = CalcRouteDist(this.visitOrder);
                    this.pbxDraw.Invalidate();

                    t0 = Stopwatch.GetTimestamp();
                    SortNearestNeighbor();
                    AlgDll.Improve2Opt(this.visitOrder, this.visitOrder.Length, this.distTable);
                    double ms1       = (Stopwatch.GetTimestamp() - t0) / (double)Stopwatch.Frequency * 1000;
                    float  calcDist1 = CalcRouteDist(this.visitOrder);
                    this.pbxDraw.Invalidate();

                    t0 = Stopwatch.GetTimestamp();
                    this.visitOrder = TspCities.Run(this.distTable, this.points.Length, 1, 0, (RoutingSearchParameters)this.grdPrm.SelectedObject);
                    double ms2       = (Stopwatch.GetTimestamp() - t0) / (double)Stopwatch.Frequency * 1000;
                    float  calcDist2 = CalcRouteDist(this.visitOrder);
                    this.pbxDraw.Invalidate();

                    this.Log(string.Format("Greedy : {0}, Time : {1}ms / Greedy+2OPT : {2}, Time : {3}ms / GoogleRoute : {4}, Time : {5}ms", calcDist0, ms0, calcDist1, ms1, calcDist2, ms2));
                }
            }
            Log("==== Benchmark Finished ====");
        }