Example #1
0
        public virtual object Clone()
        {
            RouteSet clone = new RouteSet();

            foreach (var item in this)
            {
                clone.Add((Route)(item.Clone()));
            }
            return(clone);
        }
Example #2
0
        public static RouteSet LoadFromXML(XElement document)
        {
            var routes = from r in document.Descendants("route")
                         select r;
            RouteSet solution = new RouteSet();

            foreach (var item in routes)
            {
                solution.Add(Route.LoadFromXML(item));
            }
            return(solution);
        }
Example #3
0
        public static RouteSet BuildEmptyRouteSet(Fleet fleet)
        {
            RouteSet solution = new RouteSet();

            foreach (var item in fleet)
            {
                for (int i = 0; i < item.Count; i++)
                {
                    solution.Add(new Route(item));
                }
            }
            return(solution);
        }
Example #4
0
 public bool IsCoincidentRouteSet(RouteSet solution)
 {
     if (Count != solution.Count)
     {
         return(false);
     }
     for (int i = 0; i < Count; i++)
     {
         if (!this[i].IsEqual(solution[i]))
         {
             return(false);
         }
     }
     return(true);
 }
Example #5
0
        public static RouteSet BuildSeedRouteSet(Fleet fleet, List <PickupDeliveryClient> seedClients, Random rdObj)
        {
            RouteSet solution = new RouteSet();

            foreach (var item in fleet)
            {
                for (int i = 0; i < item.Count; i++)
                {
                    Route r = new Route(item);
                    /*cuando se trate de flota heterogenea si hay q determinar quienes son los clientes factibles para la ruta*/
                    //var feasibles = from s in seedClients where s.Pickup <= item.Capacity && s.Delivery <= item.Capacity select s.ID;/*todos los clientes son validos en todos los vehiculos*/
                    int seedIndex = rdObj.Next(seedClients.Count);
                    int seedID    = seedClients[seedIndex].ID;
                    r.Add(seedID);
                    seedClients.RemoveAt(seedIndex);
                    solution.Add(r);
                }
            }
            return(solution);
        }