Example #1
0
        /// <summary>
        ///
        /// </summary>
        public double CalculateV(ITrip trip)
        {
            double v      = 0;
            var    person = trip.TripChain.Person;

            if (trip.OriginalZone == trip.DestinationZone && UseIntrazonalRegression)
            {
                v += IntrazonalConstantWeight + trip.OriginalZone.InternalDistance * IntrazonalDistanceWeight;
            }
            else
            {
                //transit constant
                v += CTransit;
                //In vehicle Travel Time
                v += Data.InVehicleTravelTime(trip.OriginalZone, trip.DestinationZone, trip.ActivityStartTime).ToMinutes() * TravelTimeBeta;
                //Wait time
                v += Data.WaitTime(trip.OriginalZone, trip.DestinationZone, trip.ActivityStartTime).ToMinutes() * WaitTime;
                //walk time
                v += Data.WalkTime(trip.OriginalZone, trip.DestinationZone, trip.ActivityStartTime).ToMinutes() * WalkTime;
                //cost
                if (person.TransitPass != TransitPass.Metro | person.TransitPass != TransitPass.Combination)
                {
                    v += Data.TravelCost(trip.OriginalZone, trip.DestinationZone, trip.ActivityStartTime) * Fare;
                }
            }
            if (person.Occupation == Occupation.Retail)
            {
                v += OccSalesTransit;
            }
            if (person.Child)
            {
                v += ChildBus;
            }
            if (person.Occupation == Occupation.Office)
            {
                v += OccGeneralTransit;
            }
            if (trip.Purpose == Activity.Market | trip.Purpose == Activity.JointMarket)
            {
                v += DpurpShopDrive;
            }
            else if (trip.Purpose == Activity.IndividualOther | trip.Purpose == Activity.JointOther)
            {
                v += DpurpOthDrive;
            }
            return(v);
        }
        /// <summary>
        /// Compute the utility of taking a particular egress station
        /// </summary>
        /// <param name="interchange">The access station to start from</param>
        /// <param name="egress">The station to get off at</param>
        /// <param name="destination">The destination to end the trip</param>
        /// <returns>The utility of using the egress station, NaN if no real egress station is used.</returns>
        private float ComputeEgressStationUtility(int interchange, int egress, int destination)
        {
            var goIvtt = GoTransitNetwork.InVehicleTravelTime(interchange, egress, TimeOfDay);
            var goCost = GoTransitNetwork.TravelCost(interchange, egress, TimeOfDay);

            if (TransitNetwork.GetAllData(egress, destination, TimeOfDay, out Time ivtt, out Time walk, out Time wait, out Time boardings, out float cost))
            {
                if (ivtt <= Time.Zero)
                {
                    cost = 0f;
                }
                return(IvttFactor * (goIvtt + ivtt).ToMinutes()
                       + WaitTimeFactor * wait.ToMinutes()
                       + WalkTimeFactor * (walk).ToMinutes()
                       + BoardingFactor * boardings.ToMinutes()
                       + CostFactor * (cost + goCost));
            }
            return(float.NaN);
        }
Example #3
0
 public float Cost(IZone origin, IZone destination, Time time)
 {
     return(Network.TravelCost(origin, destination, time));
 }
Example #4
0
 public float Cost(IZone origin, IZone destination, Time time)
 {
     CheckInterchangeZone();
     return(First.TravelCost(origin, InterchangeZone, time) + Second.TravelCost(origin, InterchangeZone, time));
 }