Пример #1
0
        /// <summary>
        ///     Reset the problem instance.
        /// </summary>
        private void ResetData()
        {
            _cities = new City[Size];
            _route  = new List <City>(Size);
            _bssf   = null;

            if (_mode == HardMode.Modes.Easy)
            {
                for (var i = 0; i < Size; i++)
                {
                    _cities[i] = new City(_rnd.NextDouble(), _rnd.NextDouble());
                }
            }
            else // Medium and hard
            {
                for (var i = 0; i < Size; i++)
                {
                    _cities[i] = new City(_rnd.NextDouble(), _rnd.NextDouble(), _rnd.NextDouble() * City.MaxElevation);
                }
            }

            var mm = new HardMode(_mode, _rnd, _cities);

            if (_mode == HardMode.Modes.Hard)
            {
                var edgesToRemove = (int)(Size * FractionOfPathsToRemove);
                mm.RemovePaths(edgesToRemove);
            }
            City.SetModeManager(mm);

            _cityBrushStyle          = new SolidBrush(Color.Black);
            _cityBrushStartStyle     = new SolidBrush(Color.Red);
            _routePenStyle           = new Pen(Color.Blue, 1);
            _routePenStyle.DashStyle = DashStyle.Solid;
        }