Exemplo n.º 1
0
 //Constructor for blank tour
 public Tour()
 {
     for (int i = 0; i < TourManager.NumberOfCities(); i++)
     {
         tour.Add(null);
     }
 }
Exemplo n.º 2
0
 // Creates random tour
 public void GenerateIndividual(double fuel)
 {
     for (int cityIndex = 0; cityIndex < TourManager.NumberOfCities(); cityIndex++)
     {
         SetCity(cityIndex, TourManager.GetCity(cityIndex));
     }
     SetMaxFuel(fuel);
 }
Exemplo n.º 3
0
 //Constructor for blank tour
 public Tour()
 {
     for (int i = 0; i < TourManager.NumberOfCities(); i++)
     {
         tour.Add(null);
     }
     this.trucksLoad = new double[TourManager.trucksLoad.Count()];
     for (int index = 0; index < TourManager.trucksLoad.Count(); index++)
     {
         this.trucksLoad[index] = TourManager.trucksLoad[index];
     }
 }
Exemplo n.º 4
0
 // Creates random tour
 public void GenerateIndividual(double fuel, Random random)
 {
     for (int cityIndex = 0; cityIndex < TourManager.NumberOfCities(); cityIndex++)
     {
         Boolean choosed = false;
         AlgCity algCity = new AlgCity(TourManager.GetCity(cityIndex));
         algCity.Truck = random.Next(1, 4);
         while (!choosed)
         {
             algCity.Truck = random.Next(1, 4);
             if (this.trucksLoad[algCity.Truck] >= algCity.Weight)
             {
                 if (this.tour[0] != null)
                 {
                     this.trucksLoad[algCity.Truck] -= algCity.Weight;
                 }
                 SetCity(cityIndex, algCity);
                 choosed = true;
             }
         }
     }
     SetMaxFuel(fuel);
 }