[Ns-developers] Random Variables API changes
Tom Henderson
tomh at tomh.org
Tue Jan 20 22:06:09 PST 2009
>> One other API question I had was concerning the granularity of
>> controlling the seeding of the RandomVariables. Presently, there
>> seems to be no way to decouple some RandomVariables and hold their
>> generators constant while varying others. For instance, in a given
>> simulation scenario, there might be a lot of random variables in use.
>> A user might want to fix (e.g., use a static seed) the randomness of
>> nearly all of those variables while allowing one random variable to
>> vary across run numbers, in order to isolate the contribution of a
>> single random variable. I thought that this decoupling was a design
>> goal at some point. The current API seems to amount to requiring all
>> random variables to be fixed across different simulation runs, or all
>> to be reseeded (independently) across runs.
>
> This is definitely something that would be useful.
>
> Here's what I would propose:
> * create a runNumber variable in RandomVariable
> * create a setRun function in RandomVariable
> * upon initialization of the random variable, copy the value in
> SeedManager::runNumber to runNumber
>
> Then, for each random variable, the user can override the runNumber in
> SeedManager. We'd have to change the calls when initializing new RNGs
> (for instance, in GetValue) to use the RandomVariable version of
> runNumber instead of SeedManager::runNumber. We'd also want to ensure
> that once the RandomVariable was initialized (or used for the first
> time) that the run number couldn't change.
>
> Is this something we want to go ahead and add now while we're messing
> with the API, or something to add later?
I think now is better than later for any API changes, and the proposal
above.
- Tom
More information about the Ns-developers
mailing list