コード例 #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;
     }
 }
コード例 #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();
        }
コード例 #3
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();
    }
コード例 #4
0
 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, IVRPProblemInstance problemInstance) {
   solution.Tours = new ItemList<Tour>(encoding.GetTours());
   solution.Repair();
 }
コード例 #5
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;
 }
コード例 #6
0
 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, IVRPProblemInstance problemInstance)
 {
     solution.Tours = new ItemList <Tour>(encoding.GetTours());
     solution.Repair();
 }