public static int evaluateNewtonFormula(int from, int to, Time time)
        {
            double result;
            double midResult = KAPPA * from * to;

            result = (double)midResult / ((long)time.ToMinutes() * (long)time.ToMinutes());

            return((int)result);
        }
        /// <summary>
        /// Evaluates the transfer penalty function.
        /// </summary>
        /// <param name="transfer">The transfer.</param>
        /// <param name="time">The time for transfer.</param>
        /// <returns></returns>
        public static int evaluateTransferFunction(Transfer transfer, Time time)
        {
            // multiple constant
            const int FACTOR = 10;

            int result = time.ToMinutes() * transfer.passengers / FACTOR;

            //Console.Out.WriteLine("Rating: " + time.ToMinutes() + " * " + transfers.passengers + " / " + solutionFactor + " = " + result);
            return(result);
        }
예제 #3
0
        public static Time normalizeTime(Time time, Period period)
        {
            int minutes = time.ToMinutes();

            minutes %= (int)period;
            if (minutes < 0)
            {
                minutes += (int)period;
            }

            return(Time.ToTime(minutes));
        }
예제 #4
0
        private void updateConnectedLineShift(TrainLineVariable varLine)
        {
            // create choosen time window
            Time timeWindowLowerBound = new Time(TimeWindowLowerBoundHour, 0);

            // calculate in minutes

            // normalize with respect to the choosen window
            int shift = varLine.Line.OriginalDeparture.ToMinutes() - timeWindowLowerBound.ToMinutes();

            // move it into that window
            while (shift < 0)
            {
                shift += (int)varLine.Period;
            }
            while (shift >= (int)varLine.Period)
            {
                shift -= (int)varLine.Period;
            }

            // store the relative
            varLine.Line.ConnectedLineShift = Time.ToTime(shift);
        }