示例#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();
        }
示例#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
        public OutputData(double tau, double q, double rho, double alpha, double beta,
                          int antCount, int iterCount, ArrayList best, double bestL, double avrL, FInput owner)
        {
            _tau        = tau;
            _q          = q;
            _rho        = rho;
            _alpha      = alpha;
            _beta       = beta;
            _antCount   = antCount;
            _iterCount  = iterCount;
            _bestTour   = best;
            _bestLength = bestL;
            _avrLength  = avrL;
            _owner      = owner;

            _cityCount = _owner.GetNumberOfCities();
            TimeSpan span = _owner.GetTime();

            _bestTimeAsString = "" + span.Minutes + ":" + span.Seconds + ":" + span.Milliseconds;
        }