/// <summary> /// Returns how close the city is to another city. /// </summary> /// <param name="cother">The other city.</param> /// <returns>A distance.</returns> public int Proximity(City cother) { return Proximity(cother.X, cother.Y); }
/// <summary> /// Place the cities in random locations. /// </summary> private void InitCities() { IGenerateRandom rnd = new MersenneTwisterGenerateRandom(); _cities = new City[Cities]; for (int i = 0; i < _cities.Length; i++) { int xPos = rnd.NextInt(MapSize); int yPos = rnd.NextInt(MapSize); _cities[i] = new City(xPos, yPos); } }
/// <summary> /// Place the cities in random locations. /// </summary> /// <param name="rnd">Random number.</param> private void InitCities(IGenerateRandom rnd) { _cities = new City[Cities]; for (int i = 0; i < _cities.Length; i++) { int xPos = rnd.NextInt(0, MapSize); int yPos = rnd.NextInt(0, MapSize); _cities[i] = new City(xPos, yPos); } }
/// <summary> /// The constructor. /// </summary> /// <param name="cities">The cities.</param> public TSPScore(City[] cities) { _cities = cities; }