Bug 2513

Summary: ParetoRandomVariable needs a "scale", not a "mean" attribute.
Product: ns-3 Reporter: Tommaso Pecorella <tommaso.pecorella>
Component: coreAssignee: Peter Barnes <pdbarnes>
Status: RESOLVED FIXED    
Severity: enhancement CC: ns-bugs, tomh
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: New attribute and so on
new patch - fixed a bug and the tests

Description Tommaso Pecorella 2016-09-30 19:22:43 UTC
Now that we have an attribute deprecation system...

The actual ParetoRandomVariable class has a "Mean" attribute, but it's limiting.

If we don't have a "Scale" attribute, the scale is calculated as:
double scale = mean * (shape - 1.0) / shape;

This works until shape is greater than one. If it's lower or equal to one... boom.

However, the problem is that the Pareto distribution parameters are the *Shape* and the *Scale*. It is totally legit for a Pareto distribution to not have a mean.

My proposal is to deprecate the Mean attribute and add a Scale attribute.
If the user sets the Mean, we have to check for the Shape to be greater than one (otherwise it's an error).
If the user doesn't set the Mean... well, all is fine.
Comment 1 Tommaso Pecorella 2016-10-01 06:26:08 UTC
Created attachment 2599 [details]
New attribute and so on
Comment 2 Tommaso Pecorella 2016-11-05 13:22:44 UTC
Created attachment 2653 [details]
new patch - fixed a bug and the tests
Comment 3 Tom Henderson 2016-11-05 17:02:50 UTC
(In reply to Tommaso Pecorella from comment #2)
> Created attachment 2653 [details]
> new patch - fixed a bug and the tests

OK by me; please update the 'changes to existing API' in CHANGES.html when pushed.
Comment 4 Tommaso Pecorella 2016-11-07 20:08:44 UTC
changeset 12397:6572761077e5