<div><div dir="auto">Hi Lixia</div><div dir="auto"><br></div><div dir="auto">A strategy cannot keep states on its instance, because NFD can re-create the instance anytime. Once the instance is re-created, any states on the instance would be lost. This requirement is on the API docs since the beginning.</div><div dir="auto">NFD started doing the re-creating since sometime in 2016, when StrategyChoice table was refactored. Since then, every StrategyChoice entry has its own Strategy instance, instead of pointing to a global instance. Any changes in StrategyChoice table would cause the strategy in affected namespaces to lose any instance states.</div><div dir="auto"><br></div><div dir="auto">I know many experimenters are guilty of making a "stateful" strategy (myself included, in AccessStrategy::m_fit as OP noticed), but this is never supported in the API. AsfStrategy is a good example where all states are properly stored in Measurements.</div><div dir="auto"><br></div><div dir="auto">Yours, Junxiao</div><br><div class="gmail_quote"><div>On Sat, Jun 24, 2017 at 07:02 Lixia Zhang <<a href="mailto:lixia@cs.ucla.edu">lixia@cs.ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">this is just for my own understanding: I wonder why a strategy instance is not allowed to keep state?<div>to avoid the same measurement result replicated in multiple strategy instances?<br><div><br></div><div>whatever the reason, I feel it might be helpful if your reply also mentions it, to make everyone understand.</div><div><br></div><div><br><div><blockquote type="cite"></blockquote></div></div></div></div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div>On Jun 23, 2017, at 2:49 PM, Junxiao Shi <<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizona.edu</a>> wrote:</div><br class="m_8577411387444247823Apple-interchange-newline"></blockquote></div></div></div></div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div><div><div>Hi Johnson<br><br></div><div>Strategy should not keep states on its own instance. All states must be stored as StrategyInfo in a PIT or Measurements entry. Violating this rule triggers undefined behavior. See NFD developer guide "strategy storage" section for more information.<br></div><div><br></div>Yours, Junxiao<br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 23, 2017 at 2:43 PM, Olumide Akinwande <span><<a href="mailto:jolumideakinwande@yahoo.com" target="_blank">jolumideakinwande@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi ndnSim friends,<div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253493213"><br></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253496259">I am trying to create a custom strategy that keeps state and I need some help.</div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254089382"><br></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253648766">Going through the access-strategy in the ndnSim package, I'm a bit confused about how some of the data structures declared in the <span style="font-family:sans-serif" id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253674336">access-strategy.</span>hpp are initialized.</div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253682074"><br></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253683092">For example an unordered_map is defined called "m_fit" that maps FaceId to FaceInfo (class defined in the .hpp file) but in the <span id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253906019" style="font-family:sans-serif">access-strategy.cpp file, only access actions are performed on "m_fit" (which is performed twice). </span></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253683092"><font id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254119046" face="sans-serif"><br></font></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498253683092"><font id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254017510" face="sans-serif">I'm confused on how this map was initialised or its values set. <br></font><div id="m_8577411387444247823m_4018756654072327495ymail_android_signature">I think understanding the process is important for my programming and I will be glad for any help.</div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254177053"><br></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254177175">Thanks,</div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254188213"><br></div><div id="m_8577411387444247823m_4018756654072327495yMail_cursorElementTracker_1498254188388">Johnson<br></div></div></blockquote></div></div></div></div></div></div></blockquote></div></div></div></div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div>
_______________________________________________</div></blockquote></div></div></div></div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div><br>ndnSIM mailing list<br><a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br></div></blockquote></div></div></div></div></blockquote></div></div>