public override void CompareAndReplace(RoutePath routePath) { if (BestRoutePath == null) { BestRoutePath = routePath; } else { if (BestRoutePath.NumHop == routePath.NumHop) { if (BestRoutePath.Cost > routePath.Cost) { BestRoutePath = routePath; } } else if (BestRoutePath.NumHop > routePath.NumHop) { BestRoutePath = routePath; } } }
public override bool BreakCondition(RoutePath routePath) { return(BestRoutePath != null && routePath.NumHop > BestRoutePath.NumHop); }
/// <summary> /// Điều kiện dừng tối ưu khi chạy đệ quy /// </summary> /// <param name="routePath"></param> /// <returns></returns> public abstract bool BreakCondition(RoutePath routePath);
public abstract void CompareAndReplace(RoutePath routePath);
public override bool BreakCondition(RoutePath routePath) { return(BestRoutePath != null && routePath.Cost > BestRoutePath.Cost); }
public override bool BreakCondition(List <Router> routePath) { return(BestRoutePath != null && RoutePath.CaculateCost(routePath) > BestRoutePath.Cost); }