Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
0ce6cda0
Commit
0ce6cda0
authored
May 15, 2018
by
Björn Richerzhagen
Browse files
updating apache math to v3
parent
826d3956
Changes
20
Show whitespace changes
Inline
Side-by-side
pom.xml
View file @
0ce6cda0
...
...
@@ -235,10 +235,18 @@
<version>
3.0
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-math3
</artifactId>
<version>
3.6.1
</version>
</dependency>
<!-- OLD Math for some outdated classes -->
<!-- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
</dependency>-->
<dependency>
<groupId>
commons-net
</groupId>
<artifactId>
commons-net
</artifactId>
...
...
src/de/tud/kom/p2psim/impl/analyzer/metric/filter/StatisticsFilter.java
View file @
0ce6cda0
...
...
@@ -24,7 +24,7 @@ import java.util.Arrays;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.commons.math.stat.StatUtils
;
import
org.apache.commons.math
3
.stat.StatUtils
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.common.metric.Metric
;
...
...
src/de/tud/kom/p2psim/impl/analyzer/metric/output/MetricOutputDAO.java
View file @
0ce6cda0
...
...
@@ -28,7 +28,7 @@ import java.util.Map;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
org.apache.commons.math.stat.descriptive.DescriptiveStatistics
;
import
org.apache.commons.math
3
.stat.descriptive.DescriptiveStatistics
;
import
de.tud.kom.p2psim.api.common.SimHost
;
import
de.tud.kom.p2psim.impl.util.db.dao.DAO
;
...
...
src/de/tud/kom/p2psim/impl/churn/ExponentialChurnModel.java
View file @
0ce6cda0
...
...
@@ -26,8 +26,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.math
.MathExcep
tion
;
import
org.apache.commons.math
.distribution.ExponentialDistributionImpl
;
import
org.apache.commons.math
3.distribution.ExponentialDistribu
tion
;
import
org.apache.commons.math
3.exception.OutOfRangeException
;
import
de.tud.kom.p2psim.api.churn.ChurnModel
;
import
de.tud.kom.p2psim.api.common.SimHost
;
...
...
@@ -42,11 +42,11 @@ public class ExponentialChurnModel implements ChurnModel {
TRANSIENT
(
MEAN_SESSION_LENGTH
),
NORMAL
(
10
*
MEAN_SESSION_LENGTH
),
LONG_LASTING
(
100
*
MEAN_SESSION_LENGTH
);
public
final
ExponentialDistribution
Impl
expDist
;
public
final
ExponentialDistribution
expDist
;
private
UserType
(
long
length
)
{
double
meanLength
=
Double
.
parseDouble
(
Long
.
toString
(
length
));
expDist
=
new
ExponentialDistribution
Impl
(
meanLength
);
expDist
=
new
ExponentialDistribution
(
meanLength
);
Long
.
toString
(
length
);
}
...
...
@@ -113,7 +113,7 @@ public class ExponentialChurnModel implements ChurnModel {
* .inverseCumulativeProbability(Simulator.getRandom()
* .nextDouble()); data.setOnlineTime((long) value);
*/
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
e
.
printStackTrace
();
}
return
data
.
onlineTime
;
...
...
src/de/tud/kom/p2psim/impl/churn/HerreraChurnModel.java
View file @
0ce6cda0
...
...
@@ -24,8 +24,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.math
.MathExcep
tion
;
import
org.apache.commons.math
.distribution.ExponentialDistributionImpl
;
import
org.apache.commons.math
3.distribution.ExponentialDistribu
tion
;
import
org.apache.commons.math
3.exception.OutOfRangeException
;
import
de.tud.kom.p2psim.api.churn.ChurnModel
;
import
de.tud.kom.p2psim.api.common.SimHost
;
...
...
@@ -39,11 +39,11 @@ public class HerreraChurnModel implements ChurnModel {
TRANSIENT
(
MEAN_SESSION_LENGTH
),
NORMAL
(
10
*
MEAN_SESSION_LENGTH
),
LONG_LASTING
(
100
*
MEAN_SESSION_LENGTH
);
public
final
ExponentialDistribution
Impl
expDist
;
public
final
ExponentialDistribution
expDist
;
private
UserType
(
long
length
)
{
double
meanLength
=
Double
.
parseDouble
(
Long
.
toString
(
length
));
expDist
=
new
ExponentialDistribution
Impl
(
meanLength
);
expDist
=
new
ExponentialDistribution
(
meanLength
);
Long
.
toString
(
length
);
}
...
...
@@ -81,7 +81,7 @@ public class HerreraChurnModel implements ChurnModel {
data
.
setOnlineTime
(
Math
.
round
(
data
.
type
.
expDist
.
inverseCumulativeProbability
(
Randoms
.
getRandom
(
HerreraChurnModel
.
class
).
nextDouble
())));
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
e
.
printStackTrace
();
}
// Simulator.getMonitor().nextSessionTime(data.onlineTime);
...
...
src/de/tud/kom/p2psim/impl/churn/KadChurnModel.java
View file @
0ce6cda0
...
...
@@ -22,7 +22,7 @@ package de.tud.kom.p2psim.impl.churn;
import
java.util.List
;
import
org.apache.commons.math.distribution.WeibullDistribution
Impl
;
import
org.apache.commons.math
3
.distribution.WeibullDistribution
;
import
de.tud.kom.p2psim.api.churn.ChurnModel
;
import
de.tud.kom.p2psim.api.common.SimHost
;
...
...
@@ -53,11 +53,11 @@ import de.tudarmstadt.maki.simonstrator.api.Time;
*/
public
class
KadChurnModel
implements
ChurnModel
{
public
WeibullDistribution
Impl
sessionTime
,
interSessionTime
;
public
WeibullDistribution
sessionTime
,
interSessionTime
;
public
KadChurnModel
()
{
sessionTime
=
new
WeibullDistribution
Impl
(
0.61511
,
169.5385
);
interSessionTime
=
new
WeibullDistribution
Impl
(
0.47648
,
413.6765
);
sessionTime
=
new
WeibullDistribution
(
0.61511
,
169.5385
);
interSessionTime
=
new
WeibullDistribution
(
0.47648
,
413.6765
);
}
/**
...
...
@@ -67,8 +67,8 @@ public class KadChurnModel implements ChurnModel {
* @param lambda
*/
public
void
setLambdaFactor
(
double
lambda
)
{
sessionTime
=
new
WeibullDistribution
Impl
(
0.61511
,
169.5385
*
lambda
);
interSessionTime
=
new
WeibullDistribution
Impl
(
0.47648
,
sessionTime
=
new
WeibullDistribution
(
0.61511
,
169.5385
*
lambda
);
interSessionTime
=
new
WeibullDistribution
(
0.47648
,
413.6765
*
lambda
);
}
...
...
src/de/tud/kom/p2psim/impl/network/gnp/topology/GnpSpace.java
View file @
0ce6cda0
...
...
@@ -27,7 +27,7 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
org.apache.commons.math.stat.StatUtils
;
import
org.apache.commons.math
3
.stat.StatUtils
;
/**
* Implements the downhill simplx algorithm for positioning host in an
...
...
src/de/tud/kom/p2psim/impl/network/modular/st/latency/NormalDistributionLatency.java
View file @
0ce6cda0
...
...
@@ -25,8 +25,8 @@ import java.util.List;
import
java.util.Random
;
import
java.util.Vector
;
import
org.apache.commons.math
.MathExcep
tion
;
import
org.apache.commons.math
.distribution.NormalDistributionImpl
;
import
org.apache.commons.math
3.distribution.NormalDistribu
tion
;
import
org.apache.commons.math
3.exception.OutOfRangeException
;
import
de.tud.kom.p2psim.api.network.NetMessage
;
import
de.tud.kom.p2psim.impl.network.AbstractNetLayer
;
...
...
@@ -68,7 +68,7 @@ public class NormalDistributionLatency implements LatencyStrategy {
*/
private
long
standardDeviation
=
2
*
Time
.
MICROSECOND
;
// 2ms
private
NormalDistribution
Impl
normalDistribution
=
new
NormalDistribution
Impl
(
private
NormalDistribution
normalDistribution
=
new
NormalDistribution
(
propagationMeanDelay
,
standardDeviation
);
/**
...
...
@@ -109,7 +109,7 @@ public class NormalDistributionLatency implements LatencyStrategy {
try
{
delay
=
(
long
)
normalDistribution
.
inverseCumulativeProbability
(
rnd
.
nextDouble
());
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
delay
<=
0
)
{
...
...
@@ -125,13 +125,13 @@ public class NormalDistributionLatency implements LatencyStrategy {
"Bad PropagationMeanDelay. It should be positiv!"
);
}
this
.
propagationMeanDelay
=
delay
;
this
.
normalDistribution
=
new
NormalDistribution
Impl
(
this
.
normalDistribution
=
new
NormalDistribution
(
this
.
propagationMeanDelay
,
this
.
standardDeviation
);
}
public
void
setStandardDeviation
(
long
standardDeviation
)
{
this
.
standardDeviation
=
standardDeviation
;
this
.
normalDistribution
=
new
NormalDistribution
Impl
(
this
.
normalDistribution
=
new
NormalDistribution
(
this
.
propagationMeanDelay
,
this
.
standardDeviation
);
}
...
...
src/de/tud/kom/p2psim/impl/simengine/Simulator.java
View file @
0ce6cda0
...
...
@@ -30,8 +30,8 @@ import java.util.Locale;
import
java.util.Map
;
import
java.util.Random
;
import
org.apache.commons.math.random.JDKRandomGenerator
;
import
org.apache.commons.math.random.RandomGenerator
;
import
org.apache.commons.math
3
.random.JDKRandomGenerator
;
import
org.apache.commons.math
3
.random.RandomGenerator
;
import
de.tud.kom.p2psim.api.scenario.ConfigurationException
;
import
de.tud.kom.p2psim.api.scenario.Configurator
;
...
...
src/de/tud/kom/p2psim/impl/topology/views/visualization/ui/MetricCDFAdapter.java
View file @
0ce6cda0
...
...
@@ -27,7 +27,7 @@ import java.util.Map;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
org.apache.commons.math.stat.Frequency
;
import
org.apache.commons.math
3
.stat.Frequency
;
import
org.jfree.data.xy.YIntervalSeries
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
...
...
src/de/tud/kom/p2psim/impl/topology/views/wifi/phy/errormodel/NistErrorRateModel.java
View file @
0ce6cda0
...
...
@@ -20,8 +20,7 @@
package
de.tud.kom.p2psim.impl.topology.views.wifi.phy.errormodel
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.special.Erf
;
import
org.apache.commons.math3.special.Erf
;
import
de.tud.kom.p2psim.api.topology.views.wifi.phy.WifiMode
;
import
de.tud.kom.p2psim.impl.util.NotSupportedException
;
...
...
@@ -130,13 +129,7 @@ public class NistErrorRateModel extends AbstractErrorRateModel {
}
private
double
getErfc
(
double
z
)
{
try
{
return
Erf
.
erfc
(
z
);
}
catch
(
MathException
e
)
{
Monitor
.
log
(
NistErrorRateModel
.
class
,
Level
.
ERROR
,
"Unable to compute the complimentary error function! Returning '0'..."
);
}
return
0
;
}
private
double
getBpskBer
(
double
snr
)
{
...
...
src/de/tud/kom/p2psim/impl/topology/views/wifi/phy/errormodel/YansErrorRateModel.java
View file @
0ce6cda0
...
...
@@ -22,8 +22,7 @@ package de.tud.kom.p2psim.impl.topology.views.wifi.phy.errormodel;
import
java.util.HashMap
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.special.Erf
;
import
org.apache.commons.math3.special.Erf
;
import
de.tud.kom.p2psim.api.topology.views.wifi.phy.WifiMode
;
import
de.tud.kom.p2psim.impl.util.NotSupportedException
;
...
...
@@ -200,13 +199,7 @@ public class YansErrorRateModel extends AbstractErrorRateModel {
}
private
double
getErfc
(
double
z
)
{
try
{
return
Erf
.
erfc
(
z
);
}
catch
(
MathException
e
)
{
Monitor
.
log
(
YansErrorRateModel
.
class
,
Level
.
ERROR
,
"Unable to compute the complimentary error function! Returning '0'..."
);
}
return
0
;
}
private
double
getQamBer
(
double
snr
,
int
m
,
int
signalSpread
,
int
phyRate
)
{
...
...
src/de/tud/kom/p2psim/impl/topology/waypoints/strong/OSMHotspotStrategy.java
View file @
0ce6cda0
...
...
@@ -38,8 +38,8 @@ import java.util.Vector;
import
javax.swing.JComponent
;
import
org.apache.commons.math.random.JDKRandomGenerator
;
import
org.apache.commons.math.random.RandomGenerator
;
import
org.apache.commons.math
3
.random.JDKRandomGenerator
;
import
org.apache.commons.math
3
.random.RandomGenerator
;
import
com.vividsolutions.jts.geom.Coordinate
;
import
com.vividsolutions.jts.geom.Geometry
;
...
...
src/de/tud/kom/p2psim/impl/util/db/dao/metric/MeasurementDAO.java
View file @
0ce6cda0
...
...
@@ -22,7 +22,7 @@ package de.tud.kom.p2psim.impl.util.db.dao.metric;
import
java.util.List
;
import
org.apache.commons.math.stat.descriptive.DescriptiveStatistics
;
import
org.apache.commons.math
3
.stat.descriptive.DescriptiveStatistics
;
import
de.tud.kom.p2psim.impl.util.db.dao.DAO
;
import
de.tud.kom.p2psim.impl.util.db.metric.CustomMeasurement
;
...
...
src/de/tud/kom/p2psim/impl/util/db/metric/MeasurementStatistic.java
View file @
0ce6cda0
...
...
@@ -30,7 +30,7 @@ import javax.persistence.JoinColumn;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
org.apache.commons.math.stat.descriptive.DescriptiveStatistics
;
import
org.apache.commons.math
3
.stat.descriptive.DescriptiveStatistics
;
/**
*
...
...
src/de/tud/kom/p2psim/impl/util/stat/distributions/ExponentialDistribution.java
View file @
0ce6cda0
...
...
@@ -22,8 +22,7 @@
package
de.tud.kom.p2psim.impl.util.stat.distributions
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.distribution.ExponentialDistributionImpl
;
import
org.apache.commons.math3.exception.OutOfRangeException
;
import
de.tud.kom.p2psim.api.scenario.ConfigurationException
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
...
...
@@ -32,13 +31,13 @@ import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
public
class
ExponentialDistribution
implements
Distribution
{
private
ExponentialDistribution
Impl
distr
=
null
;
private
org
.
apache
.
commons
.
math3
.
distribution
.
ExponentialDistribution
distr
=
null
;
private
double
mu
;
@XMLConfigurableConstructor
({
"mu"
})
public
ExponentialDistribution
(
double
mu
)
{
this
.
mu
=
mu
;
this
.
distr
=
new
ExponentialDistribution
Impl
(
mu
);
this
.
distr
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
ExponentialDistribution
(
mu
);
}
/**
...
...
@@ -56,7 +55,7 @@ public class ExponentialDistribution implements Distribution {
try
{
result
=
distr
.
inverseCumulativeProbability
(
random
);
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
result
=
0
;
...
...
@@ -73,11 +72,11 @@ public class ExponentialDistribution implements Distribution {
*/
public
static
double
returnValue
(
double
_mu
)
{
try
{
ExponentialDistribution
Impl
d
=
new
ExponentialDistribution
Impl
(
_mu
);
org
.
apache
.
commons
.
math3
.
distribution
.
ExponentialDistribution
d
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
ExponentialDistribution
(
_mu
);
return
d
.
inverseCumulativeProbability
(
Randoms
.
getRandom
(
ExponentialDistribution
.
class
)
.
nextDouble
());
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
0
;
...
...
src/de/tud/kom/p2psim/impl/util/stat/distributions/LimitedNormalDistribution.java
View file @
0ce6cda0
...
...
@@ -22,15 +22,14 @@
package
de.tud.kom.p2psim.impl.util.stat.distributions
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.distribution.NormalDistributionImpl
;
import
org.apache.commons.math3.distribution.NormalDistribution
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.util.Distribution
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
public
class
LimitedNormalDistribution
implements
Distribution
{
private
NormalDistribution
Impl
limitedNormal
;
private
NormalDistribution
limitedNormal
;
private
double
mu
;
...
...
@@ -77,7 +76,7 @@ public class LimitedNormalDistribution implements Distribution {
limitedMin
=
dc
.
isLimitedMin
();
limitedMax
=
dc
.
isLimitedMax
();
limitedNormal
=
new
NormalDistribution
Impl
(
mu
,
sigma
);
limitedNormal
=
new
NormalDistribution
(
mu
,
sigma
);
if
(
limitedMin
==
false
)
{
if
(
limitedMax
==
false
)
{
...
...
@@ -86,23 +85,14 @@ public class LimitedNormalDistribution implements Distribution {
// only max is limted
limitType
=
LIMIT_NORMAL_DIST_MAX
;
max
=
dc
.
getMax
();
try
{
pmax
=
limitedNormal
.
cumulativeProbability
(
max
);
}
catch
(
MathException
e
)
{
e
.
printStackTrace
();
}
}
}
else
{
if
(
limitedMax
==
false
)
{
// only min is limited.
limitType
=
LIMIT_NORMAL_DIST_MIN
;
min
=
dc
.
getMin
();
try
{
pmin
=
limitedNormal
.
cumulativeProbability
(
min
);
}
catch
(
MathException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
else
{
// both sides limited.
limitType
=
LIMIT_NORMAL_DIST_BOTH
;
...
...
@@ -117,15 +107,9 @@ public class LimitedNormalDistribution implements Distribution {
}
// get min and max probabilites that are possible
try
{
pmin
=
limitedNormal
.
cumulativeProbability
(
min
);
pmax
=
limitedNormal
.
cumulativeProbability
(
max
);
pfactor
=
pmax
-
pmin
;
}
catch
(
MathException
e
)
{
e
.
printStackTrace
();
}
}
}
pfactor
=
pmax
-
pmin
;
...
...
@@ -137,13 +121,7 @@ public class LimitedNormalDistribution implements Distribution {
.
nextDouble
()
*
pfactor
;
double
result
;
try
{
result
=
limitedNormal
.
inverseCumulativeProbability
(
random
);
}
catch
(
MathException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
result
=
0
;
}
return
result
;
}
...
...
@@ -178,7 +156,7 @@ public class LimitedNormalDistribution implements Distribution {
double
lpmin
=
0
;
double
lpfactor
;
NormalDistribution
Impl
llimitedNormal
=
new
NormalDistribution
Impl
(
_mu
,
NormalDistribution
llimitedNormal
=
new
NormalDistribution
(
_mu
,
_sigma
);
if
(
_min
==
null
)
{
if
(
_max
==
null
)
{
...
...
@@ -187,23 +165,14 @@ public class LimitedNormalDistribution implements Distribution {
// only max is limted
llimitType
=
LIMIT_NORMAL_DIST_MAX
;
lmax
=
_max
.
doubleValue
();
try
{
lpmax
=
llimitedNormal
.
cumulativeProbability
(
lmax
);
}
catch
(
MathException
e
)
{
e
.
printStackTrace
();
}
}
}
else
{
if
(
_max
==
null
)
{
// only min is limited.
llimitType
=
LIMIT_NORMAL_DIST_MIN
;
lmin
=
_min
.
doubleValue
();
try
{
lpmin
=
llimitedNormal
.
cumulativeProbability
(
lmin
);
}
catch
(
MathException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
else
{
// both sides limited.
llimitType
=
LIMIT_NORMAL_DIST_BOTH
;
...
...
@@ -218,15 +187,10 @@ public class LimitedNormalDistribution implements Distribution {
}
// get min and max probabilites that are possible
try
{
lpmin
=
llimitedNormal
.
cumulativeProbability
(
lmin
);
lpmax
=
llimitedNormal
.
cumulativeProbability
(
lmax
);
lpfactor
=
lpmax
-
lpmin
;
}
catch
(
MathException
e
)
{
e
.
printStackTrace
();
}
}
}
lpfactor
=
lpmax
-
lpmin
;
...
...
@@ -237,13 +201,8 @@ public class LimitedNormalDistribution implements Distribution {
*
lpfactor
;
double
lresult
;
try
{
lresult
=
llimitedNormal
.
inverseCumulativeProbability
(
lrandom
);
}
catch
(
MathException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
lresult
=
0
;
}
return
lresult
;
...
...
src/de/tud/kom/p2psim/impl/util/stat/distributions/NormalDistribution.java
View file @
0ce6cda0
...
...
@@ -24,8 +24,7 @@ package de.tud.kom.p2psim.impl.util.stat.distributions;
import
java.util.Random
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.distribution.NormalDistributionImpl
;
import
org.apache.commons.math3.exception.OutOfRangeException
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.util.Distribution
;
...
...
@@ -33,7 +32,7 @@ import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
public
class
NormalDistribution
implements
Distribution
{
private
NormalDistribution
Impl
normal
;
private
org
.
apache
.
commons
.
math3
.
distribution
.
NormalDistribution
normal
;
private
Random
randomGen
=
Randoms
.
getRandom
(
NormalDistribution
.
class
);
...
...
@@ -45,7 +44,7 @@ public class NormalDistribution implements Distribution {
public
NormalDistribution
(
double
mu
,
double
sigma
)
{
this
.
mu
=
mu
;
this
.
sigma
=
sigma
;
normal
=
new
NormalDistribution
Impl
(
mu
,
sigma
);
normal
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
NormalDistribution
(
mu
,
sigma
);
}
@Override
...
...
@@ -56,7 +55,7 @@ public class NormalDistribution implements Distribution {
try
{
result
=
normal
.
inverseCumulativeProbability
(
random
);
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
result
=
0
;
...
...
@@ -80,7 +79,7 @@ public class NormalDistribution implements Distribution {
*/
public
static
double
returnValue
(
double
_mu
,
double
_sigma
)
{
try
{
NormalDistribution
Impl
d
=
new
NormalDistribution
Impl
(
_mu
,
_sigma
);
org
.
apache
.
commons
.
math3
.
distribution
.
NormalDistribution
d
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
NormalDistribution
(
_mu
,
_sigma
);
return
d
.
inverseCumulativeProbability
(
Randoms
.
getRandom
(
NormalDistribution
.
class
)
.
nextDouble
());
...
...
src/de/tud/kom/p2psim/impl/util/stat/distributions/PoissonDistribution.java
View file @
0ce6cda0
...
...
@@ -22,8 +22,7 @@
package
de.tud.kom.p2psim.impl.util.stat.distributions
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.distribution.PoissonDistributionImpl
;
import
org.apache.commons.math3.exception.OutOfRangeException
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.util.Distribution
;
...
...
@@ -32,12 +31,12 @@ import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
public
class
PoissonDistribution
implements
Distribution
{
private
double
lambda
;
private
PoissonDistribution
Impl
poisson
;
private
org
.
apache
.
commons
.
math3
.
distribution
.
PoissonDistribution
poisson
;
@XMLConfigurableConstructor
({
"lambda"
})
public
PoissonDistribution
(
double
lambda
){
this
.
lambda
=
lambda
;
this
.
poisson
=
new
PoissonDistribution
Impl
(
lambda
);
this
.
poisson
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
PoissonDistribution
(
lambda
);
}
// returns the x-value for a random value in the cdf
...
...
@@ -48,7 +47,7 @@ public class PoissonDistribution implements Distribution {
try
{
result
=
poisson
.
inverseCumulativeProbability
(
random
);
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
result
=
0
;
...
...
@@ -64,10 +63,10 @@ public class PoissonDistribution implements Distribution {
*/
public
static
double
returnValue
(
double
_lamda
)
{
try
{
PoissonDistribution
Impl
d
=
new
PoissonDistribution
Impl
(
_lamda
);
org
.
apache
.
commons
.
math3
.
distribution
.
PoissonDistribution
d
=
new
org
.
apache
.
commons
.
math3
.
distribution
.
PoissonDistribution
(
_lamda
);
return
d
.
inverseCumulativeProbability
(
Randoms
.
getRandom
(
PoissonDistribution
.
class
).
nextDouble
());
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
0
;
...
...
src/de/tud/kom/p2psim/impl/util/stats/ConfidenceInterval.java
View file @
0ce6cda0
...
...
@@ -20,9 +20,8 @@
package
de.tud.kom.p2psim.impl.util.stats
;
import
org.apache.commons.math.MathException
;
import
org.apache.commons.math.distribution.TDistribution
;
import
org.apache.commons.math.distribution.TDistributionImpl
;
import
org.apache.commons.math3.distribution.TDistribution
;
import
org.apache.commons.math3.exception.OutOfRangeException
;
/**
* As it is not possible to get a perfect estimate of the population mean from
...
...
@@ -55,14 +54,14 @@ public class ConfidenceInterval {
* @return the upper/lower bound as positiv number
*/
public
static
double
getDeltaBound
(
double
sdev
,
int
n
,
double
alpha
)
{
TDistribution
tDist
=
new
TDistribution
Impl
(
n
-
1
);
TDistribution
tDist
=
new
TDistribution
(
n
-
1
);
double
errorConfCoeff
=
1
d
-
(
alpha
/
2
);
double
delta
;
try
{
double
t
=
Math
.
abs
(
tDist
.
inverseCumulativeProbability
(
errorConfCoeff
));
delta
=
t
*
sdev
/
Math
.
sqrt
(
n
);
}
catch
(
Math
Exception
e
)
{
}
catch
(
OutOfRange
Exception
e
)
{
throw
new
IllegalStateException
(
e
);
}
return
delta
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment