示例#1
0
        public Meeting(int randomSeed, FlightDatabase db)
            : base(randomSeed)
        {
            FlightDatabase        = db;
            Location              = Airport.FindByCode("LHR");
            MaxBusTimeOnArrival   = new DateTime(2010, 7, 27, 17, 0, 0);
            MinBusTimeOnDeparture = new DateTime(2010, 8, 3, 15, 0, 0);
            Guests = new[]
            {
                new Guest(this, "Kaï", Airport.FindByCode("BER")),
                new Guest(this, "Erwan", Airport.FindByCode("CDG")),
                new Guest(this, "Robert", Airport.FindByCode("MRS")),
                new Guest(this, "Paul", Airport.FindByCode("LYS")),
                new Guest(this, "James", Airport.FindByCode("MAN")),
                new Guest(this, "Pedro", Airport.FindByCode("BIO")),
                new Guest(this, "John", Airport.FindByCode("JFK")),
                new Guest(this, "Abdel", Airport.FindByCode("TUN")),
                new Guest(this, "Isabella", Airport.FindByCode("MXP"))
            };
            // Initialize
            int[] spaceDimensions = new int[2 * Guests.Count];
            int   i = 0;

            foreach (var g in Guests)
            {
                spaceDimensions[i] = g.ArrivalFlights.Count;
                spaceDimensions[i + Guests.Count] = g.DepartureFlights.Count;
                ++i;
            }
            Initialize(spaceDimensions);
        }
示例#2
0
        public Meeting(int randomSeed, FlightDatabase fligthData)
            : base(randomSeed)
        {
            FlightDatabase        = fligthData;
            Location              = Airport.FindByCode("LHR");
            MaxBusTimeOnArrival   = new DateTime(2010, 7, 27, 17, 0, 0);
            MinBusTimeOnDeparture = new DateTime(2010, 8, 3, 15, 0, 0);
            Guests = new[] {
                new Guest(this, "Gunther", Airport.FindByCode("BER")),
                new Guest(this, "Jean", Airport.FindByCode("CDG")),
                new Guest(this, "Michel", Airport.FindByCode("MRS")),
                new Guest(this, "Léo", Airport.FindByCode("LYS")),
                new Guest(this, "Mike", Airport.FindByCode("MAN")),
                new Guest(this, "Miguel", Airport.FindByCode("BIO")),
                new Guest(this, "Ham", Airport.FindByCode("JFK")),
                new Guest(this, "Momo", Airport.FindByCode("TUN")),
                new Guest(this, "Michelangelo", Airport.FindByCode("MXP"))
            };
            int[] spaceDimentions = new int[Guests.Count * 2];
            int   i = 0;

            foreach (var g in Guests)
            {
                spaceDimentions[i] = g.ArrivalFlight.Count();
                spaceDimentions[i + Guests.Count] = g.DepartureFlight.Count();
                i++;
            }
        }
示例#3
0
 internal SimpleFlight(XElement e)
 {
     Price         = double.Parse(e.Descendants("price").First().Value);
     Stops         = int.Parse(e.Descendants("stops").First().Value);
     Origin        = Airport.FindByCode(e.Descendants("orig").First().Value);
     DepartureTime = DateTime.Parse(e.Descendants("depart").First().Value);
     Destination   = Airport.FindByCode(e.Descendants("dest").First().Value);
     ArrivalTime   = DateTime.Parse(e.Descendants("arrive").First().Value);
     Company       = e.Descendants("airline_display").First().Value;
 }
示例#4
0
 public Meeting()
 {
     Location = Airport.FindByCode("LHR");
 }
示例#5
0
        public Meeting(FlightDatabase db)
        {
            _db = db;

            Location = Airport.FindByCode("LHR");
            Guests   = new List <Guest>()
            {
                new Guest()
                {
                    Name = "Helmut", Location = Airport.FindByCode("BER")
                },
                new Guest()
                {
                    Name = "Bernard", Location = Airport.FindByCode("CDG")
                },
                new Guest()
                {
                    Name = "Marius", Location = Airport.FindByCode("MRS")
                },
                new Guest()
                {
                    Name = "Hubert", Location = Airport.FindByCode("LYS")
                },
                new Guest()
                {
                    Name = "Tom", Location = Airport.FindByCode("MAN")
                },
                new Guest()
                {
                    Name = "Maria", Location = Airport.FindByCode("BIO")
                },
                new Guest()
                {
                    Name = "Bob", Location = Airport.FindByCode("JFK")
                },
                new Guest()
                {
                    Name = "Ahmed", Location = Airport.FindByCode("TUN")
                },
                new Guest()
                {
                    Name = "Luigi", Location = Airport.FindByCode("MXP")
                }
            };
            MaxArrivalTime   = new DateTime(2010, 7, 27, 17, 0, 0);
            MinDepartureTime = new DateTime(2010, 8, 3, 15, 0, 0);

            int iGuest = 0;

            foreach (var g in Guests)
            {
                g.Index = iGuest++;
                var aFlights = _db.GetFlights(MaxArrivalTime.Date, g.Location, Location)
                               .Concat(_db.GetFlights(MaxArrivalTime.Date.AddDays(-1), g.Location, Location))
                               .Where(f => f.ArrivalTime <MaxArrivalTime &&
                                                          f.ArrivalTime> MaxArrivalTime.AddHours(-6));
                g.ArrivalFlights = aFlights.ToList();
                var dFlights = _db.GetFlights(MinDepartureTime.Date, Location, g.Location)
                               .Concat(_db.GetFlights(MinDepartureTime.Date.AddDays(1), Location, g.Location))
                               .Where(f => f.DepartureTime > MinDepartureTime &&
                                      f.DepartureTime < MinDepartureTime.AddHours(6));
                g.DepartureFlights = dFlights.ToList();
            }

            var dimensions = new int[18];

            for (int i = 0; i < 18; i++)
            {
                if (i < 9)
                {
                    dimensions[i] = Guests[i].ArrivalFlights.Count;
                }
                else
                {
                    dimensions[i] = Guests[i - 9].DepartureFlights.Count;
                }
            }
            Initialize(dimensions);
        }