[Ns-developers] Random Variables API changes
tomh at tomh.org
Fri Oct 24 07:40:53 PDT 2008
Raj Bhattacharjea wrote:
> Including ns-developers in the reply list for this off-list mail...
> On Thu, Oct 16, 2008 at 12:52 PM, Hadi Arbabi <hadiarbabi at gmail.com> wrote:
>> Dear Raj,
>> I have attached codes for ns3 random variable with changes done.
> I will post a repo with Hadi's changes for review.
>> -GetSingleValue() is removed
>> -There are some extensions like UseGlobalSeed, CheckGlobalSeed,
>> GetGlobalSeed (can be set by only one value also)
>> -Uniform variable have GetValue(min, max) now
>> As you already know Global Seed and Run Number are static members or random
>> variable class.
>> We'd like the user to be able to set their values from command line as well
>> (making them as system attributes).
>> I was playing with SetTypeID() and .Attribute(...) , but I couldn't get the
>> desired result. And I couldn't figure it out.
>> Could be please help us with that?
The reason that will not work is that class RandomVariable does not
inherit from ns3::ObjectBase.
> Another way to get this behavior is to add a runNumber and seed
> command line parameters to simulations which need it, and then pass
> these parameters along to the RNGs. This puts the onus on the
> simulation writer to manage the run number and seed if he wants to in
> a more manual fashion.
> If you want attributes instead, I can invest some cycles into looking
> into it. I am not sure how easy it is to give attribute powers to the
> RNG stuff, but I suspect Mathieu might know the answer to this
> question off the top of his head.
I think it would be preferable to enable this by default, not make the
user have to plumb it in manually.
From an API perspective, this is a pretty fundamental operation, to be
able to change the run number from a command line argument (e.g., when
running a bunch of simulations from a shell script). So, it might be
nice to make these two attributes (run number and global seed) into ns-3
globals, so user can type:
./waf --run "my-simulation-script --RunNumber=3"
./waf --run "my-simulation-script ns3::RandomVariable::RunNumber=3"
More information about the Ns-developers