Beispiel #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);
        }
Beispiel #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++;
            }
        }
Beispiel #3
0
        public void GetFlights()
        {
            FlightDatabase db = new FlightDatabase( Path.Combine( TestHelper.SolutionFolder, @"ThirdParty\FlightData\" ) );

            {
                var f0 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "BER" ), Airport.FindByCode( "LHR" ) );
                var f1 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "CDG" ), Airport.FindByCode( "LHR" ) );
                var f2 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "MRS" ), Airport.FindByCode( "LHR" ) );
                var f3 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "LYS" ), Airport.FindByCode( "LHR" ) );
                var f4 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "MAN" ), Airport.FindByCode( "LHR" ) );
                var f5 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "BIO" ), Airport.FindByCode( "LHR" ) );
                var f6 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "JFK" ), Airport.FindByCode( "LHR" ) );
                var f7 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "TUN" ), Airport.FindByCode( "LHR" ) );
                var f8 = db.GetFlights( new DateTime( 2010, 7, 26 ), Airport.FindByCode( "MXP" ), Airport.FindByCode( "LHR" ) );
            }
            {
                var f0 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "BER" ), Airport.FindByCode( "LHR" ) );
                var f1 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "CDG" ), Airport.FindByCode( "LHR" ) );
                var f2 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "MRS" ), Airport.FindByCode( "LHR" ) );
                var f3 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "LYS" ), Airport.FindByCode( "LHR" ) );
                var f4 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "MAN" ), Airport.FindByCode( "LHR" ) );
                var f5 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "BIO" ), Airport.FindByCode( "LHR" ) );
                var f6 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "JFK" ), Airport.FindByCode( "LHR" ) );
                var f7 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "TUN" ), Airport.FindByCode( "LHR" ) );
                var f8 = db.GetFlights( new DateTime( 2010, 7, 27 ), Airport.FindByCode( "MXP" ), Airport.FindByCode( "LHR" ) );
            }

            {
                var f0 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "BER" ) );
                var f1 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "CDG" ) );
                var f2 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MRS" ) );
                var f3 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "LYS" ) );
                var f4 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MAN" ) );
                var f5 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "BIO" ) );
                var f6 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "JFK" ) );
                var f7 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "TUN" ) );
                var f8 = db.GetFlights( new DateTime( 2010, 8, 3 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MXP" ) );
            }
            {
                var f0 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "BER" ) );
                var f1 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "CDG" ) );
                var f2 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MRS" ) );
                var f3 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "LYS" ) );
                var f4 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MAN" ) );
                var f5 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "BIO" ) );
                var f6 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "JFK" ) );
                var f7 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "TUN" ) );
                var f8 = db.GetFlights( new DateTime( 2010, 8, 4 ), Airport.FindByCode( "LHR" ), Airport.FindByCode( "MXP" ) );
            }
        }
Beispiel #4
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);
        }