[Nfd-dev] strategy specific parameters

Junxiao Shi shijunxiao at email.arizona.edu
Wed Apr 22 10:06:44 PDT 2015


Hi Klaus

A major flaw of this solution is: you can't use the same strategy with
different parameters.
Consider the following setup:

   - namespace=/, strategy=/my-strategy/param=no
   - namespace=/A , strategy=/my-strategy/param=yes

StrategyChoice::getStrategy returns the same instance (from
m_strategyInstances), so that the second set of parameters would change the
state of that instance, and affect both namespaces.
Since most simulations only deal with one strategy, this shouldn't cause
big problems.

Given you are only using this in simulations, an easier approach is to pass
the parameters with a ns3::GlobalVariable.

Yours, Junxiao

On Sun, Apr 19, 2015 at 2:16 PM, Klaus Schneider <
klaus.schneider at uni-bamberg.de> wrote:

> Here is my quick and dirty solution for including parameters in the
> strategy name.
>
> 2. I changed StrategyChoice::getStrategy() in strategy-choice.cpp to
>
>  fw::Strategy*
>> StrategyChoice::getStrategy(const Name& strategyName) const
>> {
>>   fw::Strategy* candidate = nullptr;
>>   for (auto n : m_strategyInstances) {
>>     if (strategyName.isPrefixOf(n.first) ||
>> n.first.isPrefixOf(strategyName)) {
>>       switch (n.first.size() + 1 - strategyName.size()) {
>>       case 0: // Strategy with parameters (one element longer than exact
>> match)
>>         n.second->setParameters(strategyName.toUri().erase(0,
>> n.first.toUri().size() + 1));
>>         return n.second.get();
>>       case 1:  // exact match
>>         return n.second.get();
>>       case 2:  // unversioned strategyName matches versioned strategy
>>         candidate = n.second.get();
>>         break;
>>       }
>>     }
>>   }
>>   return candidate;
>> }
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20150422/27cf3c09/attachment.html>


More information about the Nfd-dev mailing list