Exemplo n.º 1
0
        public Algorithm(
            FInput fInput, LoadTSP tsp,
            FDrawForm drawForm, double tau,
            double q, double rho,
            double alpha, double beta,
            int iter, int ants,
            double minTour, double optTour)
        {
            _tsp   = tsp;
            _owner = fInput;

            _tau           = tau;
            _q             = q;
            _rho           = rho;
            _alpha         = alpha;
            _beta          = beta;
            _antCount      = ants;
            _iterCount     = iter;
            _drawForm      = drawForm;
            _minTourLength = minTour;
            _optTourLength = optTour;

            // init
            InitCityList();
            InitCityListForAnt();
            InitAnts();
            _startTime = DateTime.Now;

            _bestTourGloabl = double.PositiveInfinity;
            _bestTourIter   = double.PositiveInfinity;

            Thread solveTSPThread = new Thread(new ThreadStart(TryToSolveTSP));

            solveTSPThread.Start();
        }
Exemplo n.º 2
0
 private void InitializeTSP(bool tspIsEmtpy)
 {
     if (_drawForm != null)
     {
         _drawForm.Invoke(new DrawFormCloseInvoker(_drawForm.Close));
     }
     if (tspIsEmtpy)
     {
         _tspFile = new LoadTSP(tspIsEmtpy);
     }
     else
     {
         _tspFile = new LoadTSP();
     }
     if (_tspFile._doNotOpenTSPForm == false)
     {
         _drawForm = new FDrawForm(_tspFile, this);
     }
 }