Exemplo n.º 1
0
 private void CheckForPurePassengerTrips(PurePassengerTripChain DriverTripChain, ModeChoiceTripChainData PassengerTripChainData, int driverIndex, int passengerIndex, int passengerTripChainIndex, Random random)
 {
     for (int j = 0; j < PassengerTripChainData.TripData.Length; j++)
     {
         float passengerEpsilon = float.NegativeInfinity;
         float v;
         if (PassengerTripChainData.TripChain.Trips[j].Mode.RequiresVehicle != null)
         {
             continue;
         }
         if (PassengerMode.CalculateV(DriverTripChain.Trips[0], PassengerTripChainData.TripChain.Trips[j], out v))
         {
             if (passengerEpsilon <= float.NegativeInfinity)
             {
                 passengerEpsilon = GenerateEpsilon(random);
             }
             var deltaU = v + passengerEpsilon + GenerateEpsilon(random) - GetUtilityOfTrips(PassengerTripChainData, j);
             if (deltaU > 0)
             {
                 PotentialTrips.Add(new PotentialPassengerTrip(DriverTripChain.Trips[0],
                                                               PassengerTripChainData.TripChain.Trips[j], deltaU, driverIndex, passengerIndex, passengerTripChainIndex, j));
             }
         }
     }
 }
Exemplo n.º 2
0
        private PurePassengerTripChain CreateDriverTripChain(Time start, Time end, IZone homeZone, ITashaPerson driver)
        {
            var mode            = PassengerMode.AssociatedMode;
            var driverTrip      = PurePassengerTrip.MakeDriverTrip(homeZone, mode, start, end);
            var driverTripChain = new PurePassengerTripChain();

            driverTrip.TripChain = driverTripChain;
            driverTripChain.Trips.Add(driverTrip);
            driverTripChain.Person = driver;
            return(driverTripChain);
        }