Print

Print


On Jul 20, 2012, at 7:58 PM, Eric 'Siggy' Scott wrote:

> It's true, however, that the need for this behavior is quite common -- so eventually it would be nice to have a more unified/integrated solution, IMO.  That may require rolling out own distributions library, though.

By this I presume you mean to add some common repeat-by-distribution options.  We could add those as factory functions, something like this:

public static RandomRepeat makeRepeatByPowerLaw(
	Steppable step, int ordering, boolean shouldSynchronize,
	double exponent,  double lowerCutOff)
	{
	return new RandomRepeat(step, ordering, shouldSynchronize)
		{
		protected double getNextTime(SimState state, double currentTime)
			{
             		 return currentTime + Distributions.nextPowLaw(2.0, 1.0, state.random);
			}
		};
	}

... or something like that.  Then you use it as:

RandomRepeat repeat = RandomRepeat.makeRepeatByPowerLaw(step, initialOrdering, false, 2.0, 1.0);
state.schedule.scheduleOnce(initialTIme, initialOrdering, repeat);

I'd need to know exactly what the common distribution options would be though.

Sean