Bug 2513 - ParetoRandomVariable needs a "scale", not a "mean" attribute.
ParetoRandomVariable needs a "scale", not a "mean" attribute.
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P5 enhancement
Assigned To: Peter Barnes
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-30 19:22 UTC by Tommaso Pecorella
Modified: 2016-11-07 20:08 UTC (History)
2 users (show)

See Also:


Attachments
New attribute and so on (15.05 KB, patch)
2016-10-01 06:26 UTC, Tommaso Pecorella
Details | Diff
new patch - fixed a bug and the tests (18.87 KB, patch)
2016-11-05 13:22 UTC, Tommaso Pecorella
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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