Disabling FIB-entry-limit decrease. Implementing probabilistic interest
acceptance based on accumulated statistics.
Statistics generation is changed to real 1-second averaging
diff --git a/model/fw/per-fib-limits.cc b/model/fw/per-fib-limits.cc
index ba11f7f..08ef66b 100644
--- a/model/fw/per-fib-limits.cc
+++ b/model/fw/per-fib-limits.cc
@@ -82,6 +82,28 @@
return false;
}
+ // check stats
+ Ptr<Face> inFace = pitEntry->GetIncoming ().begin ()->m_face;
+ // const ndnSIM::LoadStatsFace &stats = GetStatsTree ()[header->GetName ()].incoming ().find (inFace)->second;
+ const ndnSIM::LoadStatsFace &stats = GetStatsTree ()["/"].incoming ().find (inFace)->second;
+
+ if (stats.count ().GetStats ().get<0> () >= 0.5 * pitEntry->GetFibEntry ()->GetLimits ().GetMaxLimit ())
+ {
+ double ratio = std::min (1.0, stats.GetSatisfiedRatio ().get<0> ());
+ // NS_ASSERT_MSG (ratio > 0, "If count is a reasonable value, ratio cannot be negative");
+ UniformVariable randAccept (0, 1);
+ double dice = randAccept.GetValue ();
+ if (ratio < 0 || dice < ratio + 0.1)
+ {
+ // ok, accepting the interests
+ }
+ else
+ {
+ // boo. bad luck
+ return false;
+ }
+ }
+
if (pitEntry->GetFibEntry ()->GetLimits ().IsBelowLimit ())
{
if (outgoingFace->GetLimits ().IsBelowLimit ())
@@ -113,7 +135,7 @@
}
pitEntry->GetFibEntry ()->GetLimits ().RemoveOutstanding ();
- pitEntry->GetFibEntry ()->GetLimits ().DecreaseLimit (); // multiplicative decrease
+ // pitEntry->GetFibEntry ()->GetLimits ().DecreaseLimit (); // multiplicative decrease
if (!m_decayLimitsEvent.IsRunning ())
{
@@ -140,7 +162,7 @@
}
pitEntry->GetFibEntry ()->GetLimits ().RemoveOutstanding ();
- pitEntry->GetFibEntry ()->GetLimits ().IncreaseLimit (); // additive increase
+ // pitEntry->GetFibEntry ()->GetLimits ().IncreaseLimit (); // additive increase
}