public TransportType ChooseNextTransportType( HashSet <Passenger> neighbors, TransportType currentTransportType, double currentSatisfaction, double deviationValue, TransportType[] availableTransportTypes) { var typeTransportInfos = neighbors .GroupBy(x => x.TransportType) .Select(GetTransportInfo); foreach (var info in typeTransportInfos) { if (info.Item2 > currentSatisfaction) { currentTransportType = info.Item1; currentSatisfaction = info.Item2; } } if (currentTransportType == TransportType.Car) { currentTransportType = randomizer.GetRandomDouble() < carAvailabilityProbability ? TransportType.Car : TransportTypes.GetRandomTransportWithoutType(TransportType.Car, randomizer, availableTransportTypes); } return(currentTransportType); }
public static TransportType GetBestNextTransportWithEpsilonMush(QFuncInfo qFuncInfo, TransportType[] availableTransportTypes) { var bestTransportType = qFuncInfo.GetBestTransportType(); return(randomizer.GetRandomDouble() > Epsilon ? bestTransportType : TransportTypes.GetRandomTransportWithoutType(bestTransportType, randomizer, availableTransportTypes)); }