Exemple #1
0
 protected TourEncoding(TourEncoding original, Cloner cloner)
     : base(original, cloner)
 {
     this.Tours = (ItemList <Tour>)cloner.Clone(original.Tours);
     if (original.ProblemInstance != null && cloner.ClonedObjectRegistered(original.ProblemInstance))
     {
         this.ProblemInstance = (IVRPProblemInstance)cloner.Clone(original.ProblemInstance);
     }
     else
     {
         this.ProblemInstance = original.ProblemInstance;
     }
 }
Exemple #2
0
        public static void ConvertFrom(List <int> route, TourEncoding solution)
        {
            solution.Tours = new ItemList <Tour>();

            Tour tour = new Tour();

            for (int i = 0; i < route.Count; i++)
            {
                if (route[i] <= 0)
                {
                    if (tour.Stops.Count > 0)
                    {
                        solution.Tours.Add(tour);
                        tour = new Tour();
                    }
                }
                else
                {
                    tour.Stops.Add(route[i]);
                }
            }

            solution.Repair();
        }
    public static void ConvertFrom(List<int> route, TourEncoding solution) {
      solution.Tours = new ItemList<Tour>();

      Tour tour = new Tour();
      for (int i = 0; i < route.Count; i++) {
        if (route[i] <= 0) {
          if (tour.Stops.Count > 0) {
            solution.Tours.Add(tour);
            tour = new Tour();
          }
        } else {
          tour.Stops.Add(route[i]);
        }
      }

      solution.Repair();
    }
 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, IVRPProblemInstance problemInstance) {
   solution.Tours = new ItemList<Tour>(encoding.GetTours());
   solution.Repair();
 }
 protected TourEncoding(TourEncoding original, Cloner cloner)
   : base(original, cloner) {
   this.Tours = (ItemList<Tour>)cloner.Clone(original.Tours);
   if (original.ProblemInstance != null && cloner.ClonedObjectRegistered(original.ProblemInstance))
     this.ProblemInstance = (IVRPProblemInstance)cloner.Clone(original.ProblemInstance);
   else
     this.ProblemInstance = original.ProblemInstance;
 }
Exemple #6
0
 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, IVRPProblemInstance problemInstance)
 {
     solution.Tours = new ItemList <Tour>(encoding.GetTours());
     solution.Repair();
 }