コード例 #1
0
ファイル: Algorithm.cs プロジェクト: artifact113/ants-tsp
        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();
        }
コード例 #2
0
        public FDrawForm(LoadTSP load, FInput owner)
        {
            InitializeComponent();
            _isClosed = false;

            _tspFile = load;

            Thread t = new Thread(new ThreadStart(ShowDrawForm));

            t.Start();
            _owner = owner;
            _owner.Invoke(new CityNumberInvoker(_owner.SetNumberOfCities), _tspFile.Koords.Count);
        }
コード例 #3
0
ファイル: FUeberwachung.cs プロジェクト: artifact113/ants-tsp
 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);
     }
 }