jphase
Class AbstractContPhaseVar

java.lang.Object
  extended by jphase.AbstractContPhaseVar
All Implemented Interfaces:
JMarkovElement, ContPhaseVar, PhaseVar
Direct Known Subclasses:
DenseContPhaseVar, ErlangCoxianVar, HyperErlangVar, SparseContPhaseVar

public abstract class AbstractContPhaseVar
extends java.lang.Object
implements ContPhaseVar

Version:
0.1 Abstract class that defines the behaviour of Continuous Phase-Type Distributions
Author:
German Riaņo, Juan Fernando Perez

Constructor Summary
AbstractContPhaseVar()
           
 
Method Summary
 double cdf(double x)
          Evaluates the cumulative density function at x
 double[] cdf(int n, double delta)
          Evaluates the Cumulative Density Function at n values of x, starting with x=0, step delta
 double CV()
          Computes the Coefficient of Variation of the Phase variable
 java.lang.String description()
          This method return a complete verbal describtion of this element.
 ContPhaseVar eqResidualTime()
          Computes the Equilibrium Residual Distribution
 double expectedValue()
          Computes the Expected Value of the Phase variable
 no.uib.cipr.matrix.Vector getMat0()
          Returns the exit vector from the transient states to absorption
 double[] getMat0Array()
          Returns the exit vector in double[] format
 double[][] getMatrixArray()
          Returns the transition matrix in double format
 int getNumPhases()
          Returns the number of Phases of the Phase distribution
 double getVec0()
          Returns the probability mass at zero (alpha_0)
 double[] getVectorArray()
          Returns the initial probability mass vector in double[] format
 java.lang.String label()
          This method returns a short String used in the user interface to describe this element.
 double lossFunction1(double x)
          Evaluates the loss function of order 1 at x
 double lossFunction2(double x)
          Evaluates the loss function of order 2 at x
 ContPhaseVar max(ContPhaseVar v2)
          Returns the maximum between the variable B and the original: res = max(A,B)
 ContPhaseVar max(ContPhaseVar v2, ContPhaseVar res)
          Returns the maximum between the variable B and the original: res = max(A,B)
 double median()
          Compuetes the median of the distribution
 ContPhaseVar min(ContPhaseVar v2)
          Returns the minimum between the variable B and the original: res = min(A,B)
 ContPhaseVar min(ContPhaseVar v2, ContPhaseVar res)
          Returns the minimum between the variable B and the original: res = min(A,B)
 ContPhaseVar mix(double p, ContPhaseVar v2)
          Computes the distribution of the mix: res = A*p + B*(1-p)
 ContPhaseVar mix(double p, ContPhaseVar v2, ContPhaseVar res)
          Computes the distribution of the mix: res = A*p + B*(1-p)
 double moment(int k)
          Compuetes the k-th Moment of the Phase variable
 double pdf(double x)
          Evaluates the probability density function at x
 double[] pdf(int n, double delta)
          Evaluates the Probability Density Function at n values of x, starting with x=0, step delta
 double prob(double a, double b)
          Computes the probability that this variable takes a value between a and b
 double quantil(double p)
          Computes the quantile q of the distribution, such that F(q) = p
 ContPhaseVar residualTime(double x)
          Computes the Residual Time Distribution
 ContPhaseVar residualVar(double a)
          Computes the variable (X-a)+, i.e.
 double stdDeviation()
          Computes the Standard deviation of the Phase variable
 ContPhaseVar sum(ContPhaseVar v2)
          Computes the sum of variables: res = A +B
 ContPhaseVar sum(ContPhaseVar v2, ContPhaseVar res)
          Computes the sum of variables: res = A +B
 ContPhaseVar sumGeom(double p)
          Returns the sum of a geometric number of independent copies of this variable
 ContPhaseVar sumPH(DiscPhaseVar v2)
          Returns the sum of a Phase number of Continuous Phase-type distributions
 ContPhaseVar sumPH(DiscPhaseVar B, ContPhaseVar res)
          Returns the sum of a Phase number of Continuous Phase-type distributions
 double survival(double x)
          Evaluates the survival function at x
 double[] survival(int n, double delta)
          Evaluates the Survival Function at n values of x, starting with x=0, step delta
 ContPhaseVar times(double c)
          Returns a Phase continuous variable that is the original one times c
 java.lang.String toString()
          This method returns a short String used in the user interface to describe this element.
 double variance()
          Computes the Variance of the Phase variable
 ContPhaseVar waitingQ(double rho)
          Computes the distribution of the waiting time in queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jphase.ContPhaseVar
copy, newVar
 
Methods inherited from interface jphase.PhaseVar
getMatrix, getVector, setMatrix, setVector
 
Methods inherited from interface jmarkov.basic.JMarkovElement
equals
 

Constructor Detail

AbstractContPhaseVar

public AbstractContPhaseVar()
Method Detail

sumPH

public ContPhaseVar sumPH(DiscPhaseVar B,
                          ContPhaseVar res)
Description copied from interface: ContPhaseVar
Returns the sum of a Phase number of Continuous Phase-type distributions

Specified by:
sumPH in interface ContPhaseVar
Parameters:
B - Discrete-Phase Type Distribution that determines the number of Continuous Phase-Type Distributions to sum
res - Continuous Phase Variable to store the resulting distribution
Returns:
Sum of a Phase number of Continuous Phase-type distributions
See Also:
ContPhaseVar.sumPH(jphase.DiscPhaseVar, jphase.ContPhaseVar)

sumPH

public ContPhaseVar sumPH(DiscPhaseVar v2)
Description copied from interface: ContPhaseVar
Returns the sum of a Phase number of Continuous Phase-type distributions

Specified by:
sumPH in interface ContPhaseVar
Parameters:
v2 - Discrete-Phase Type Distribution that determines the number of Continuous Phase-Type Distributions to sum
Returns:
Sum of a Phase number of Continuous Phase-type distributions
See Also:
ContPhaseVar.sumPH(jphase.DiscPhaseVar)

getNumPhases

public int getNumPhases()
Description copied from interface: PhaseVar
Returns the number of Phases of the Phase distribution

Specified by:
getNumPhases in interface PhaseVar
Returns:
Number of Phases of the Phase distribution
See Also:
PhaseVar.getNumPhases()

getVec0

public double getVec0()
Description copied from interface: PhaseVar
Returns the probability mass at zero (alpha_0)

Specified by:
getVec0 in interface PhaseVar
Returns:
Probability mass at zero (alpha_0)
See Also:
PhaseVar.getVec0()

getMat0

public no.uib.cipr.matrix.Vector getMat0()
Description copied from interface: PhaseVar
Returns the exit vector from the transient states to absorption

Specified by:
getMat0 in interface PhaseVar
Returns:
Exit vector from the transient states to absorption
See Also:
PhaseVar.getMat0()

getMatrixArray

public double[][] getMatrixArray()
Description copied from interface: PhaseVar
Returns the transition matrix in double format

Specified by:
getMatrixArray in interface PhaseVar
Returns:
Transition matrix for transient states of the Phase-Type Distribution in double[][] format
See Also:
PhaseVar.getMatrixArray()

getVectorArray

public double[] getVectorArray()
Description copied from interface: PhaseVar
Returns the initial probability mass vector in double[] format

Specified by:
getVectorArray in interface PhaseVar
Returns:
Initial probability mass vector in double[] format
See Also:
PhaseVar.getVectorArray()

getMat0Array

public double[] getMat0Array()
Description copied from interface: PhaseVar
Returns the exit vector in double[] format

Specified by:
getMat0Array in interface PhaseVar
Returns:
Exit vector from the transient states to absorption in double[] format
See Also:
PhaseVar.getMat0Array()

expectedValue

public double expectedValue()
Description copied from interface: PhaseVar
Computes the Expected Value of the Phase variable

Specified by:
expectedValue in interface PhaseVar
Returns:
Expected Value of the Phase variable
See Also:
PhaseVar.expectedValue()

variance

public double variance()
Description copied from interface: PhaseVar
Computes the Variance of the Phase variable

Specified by:
variance in interface PhaseVar
Returns:
Variance of the Phase variable
See Also:
PhaseVar.variance()

stdDeviation

public double stdDeviation()
Description copied from interface: PhaseVar
Computes the Standard deviation of the Phase variable

Specified by:
stdDeviation in interface PhaseVar
Returns:
Standard deviation of the Phase variable
See Also:
PhaseVar.stdDeviation()

CV

public double CV()
Description copied from interface: PhaseVar
Computes the Coefficient of Variation of the Phase variable

Specified by:
CV in interface PhaseVar
Returns:
Coefficient of Variation of the Phase variable
See Also:
PhaseVar.CV()

moment

public double moment(int k)
Description copied from interface: PhaseVar
Compuetes the k-th Moment of the Phase variable

Specified by:
moment in interface PhaseVar
Parameters:
k - Moment
Returns:
k-th Moment of the Phase variable
See Also:
PhaseVar.moment(int)

cdf

public double cdf(double x)
Description copied from interface: PhaseVar
Evaluates the cumulative density function at x

Specified by:
cdf in interface PhaseVar
Parameters:
x - Evaluation point
Returns:
Cumulative density function at x
See Also:
PhaseVar.cdf(double)

cdf

public double[] cdf(int n,
                    double delta)
Description copied from interface: PhaseVar
Evaluates the Cumulative Density Function at n values of x, starting with x=0, step delta

Specified by:
cdf in interface PhaseVar
Parameters:
n - number of evaluation points
delta - distance between evaluation points
Returns:
Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
See Also:
PhaseVar.cdf(int, double)

pdf

public double pdf(double x)
Description copied from interface: ContPhaseVar
Evaluates the probability density function at x

Specified by:
pdf in interface ContPhaseVar
Parameters:
x - Evaluation point
Returns:
Probability density function at x
See Also:
ContPhaseVar.pdf(double)

pdf

public double[] pdf(int n,
                    double delta)
Description copied from interface: ContPhaseVar
Evaluates the Probability Density Function at n values of x, starting with x=0, step delta

Specified by:
pdf in interface ContPhaseVar
Parameters:
n - number of evaluation points
delta - distance between evaluation points
Returns:
Evaluation of the probability density function at x = 0,d,2d,..,(n-1)d
See Also:
ContPhaseVar.pdf(int, double)

prob

public double prob(double a,
                   double b)
Description copied from interface: PhaseVar
Computes the probability that this variable takes a value between a and b

Specified by:
prob in interface PhaseVar
Parameters:
a - inferior limit
b - superior limit
Returns:
Probability that this variable takes a value between a and b
See Also:
PhaseVar.prob(double, double)

survival

public double survival(double x)
Description copied from interface: PhaseVar
Evaluates the survival function at x

Specified by:
survival in interface PhaseVar
Parameters:
x - Evaluation point
Returns:
Evaluation of the survival Function at x = 1-F(x)=P(X>x)
See Also:
PhaseVar.survival(double)

survival

public double[] survival(int n,
                         double delta)
Description copied from interface: PhaseVar
Evaluates the Survival Function at n values of x, starting with x=0, step delta

Specified by:
survival in interface PhaseVar
Parameters:
n - number of evaluation points
delta - distance between evaluation points
Returns:
Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
See Also:
PhaseVar.survival(int, double)

lossFunction1

public double lossFunction1(double x)
Description copied from interface: PhaseVar
Evaluates the loss function of order 1 at x

Specified by:
lossFunction1 in interface PhaseVar
Parameters:
x - Evaluation point
Returns:
Evaluation of the loss function of order 1
See Also:
PhaseVar.lossFunction1(double)

lossFunction2

public double lossFunction2(double x)
Description copied from interface: PhaseVar
Evaluates the loss function of order 2 at x

Specified by:
lossFunction2 in interface PhaseVar
Parameters:
x - Evaluation point
Returns:
Evaluation of the loss function of order 2
See Also:
PhaseVar.lossFunction2(double)

quantil

public double quantil(double p)
Description copied from interface: PhaseVar
Computes the quantile q of the distribution, such that F(q) = p

Specified by:
quantil in interface PhaseVar
Parameters:
p - probability such that F(q) = p
Returns:
The quantile q of the distribution, such that F(q) = p
See Also:
PhaseVar.quantil(double)

median

public double median()
Description copied from interface: PhaseVar
Compuetes the median of the distribution

Specified by:
median in interface PhaseVar
Returns:
The median of the distribution
See Also:
PhaseVar.median()

sum

public ContPhaseVar sum(ContPhaseVar v2,
                        ContPhaseVar res)
Description copied from interface: ContPhaseVar
Computes the sum of variables: res = A +B

Specified by:
sum in interface ContPhaseVar
Parameters:
v2 - Variable to sum to the original
res - Variable to store the result
Returns:
Sum of Variables: res = A +B
See Also:
ContPhaseVar.sum(jphase.ContPhaseVar, jphase.ContPhaseVar)

sum

public ContPhaseVar sum(ContPhaseVar v2)
Description copied from interface: ContPhaseVar
Computes the sum of variables: res = A +B

Specified by:
sum in interface ContPhaseVar
Parameters:
v2 - Variable to sum to the original
Returns:
Sum of Variables: res = A +B
See Also:
ContPhaseVar.sum(jphase.ContPhaseVar)

sumGeom

public ContPhaseVar sumGeom(double p)
Description copied from interface: ContPhaseVar
Returns the sum of a geometric number of independent copies of this variable

Specified by:
sumGeom in interface ContPhaseVar
Parameters:
p - Parameter of the geometric variable
Returns:
Sum of a geometric number of independent copies of this variable
See Also:
ContPhaseVar.sumGeom(double)

mix

public ContPhaseVar mix(double p,
                        ContPhaseVar v2,
                        ContPhaseVar res)
Description copied from interface: ContPhaseVar
Computes the distribution of the mix: res = A*p + B*(1-p)

Specified by:
mix in interface ContPhaseVar
Parameters:
p - Portion of this variable in the mix (0<=p<=1)
v2 - Variable to mix with the original
res - Variable to store the resulting distribution with the same number of phases of the original distribution
Returns:
Distribution of the mix: res = A*p + B*(1-p)
See Also:
ContPhaseVar.mix(double, jphase.ContPhaseVar, jphase.ContPhaseVar)

mix

public ContPhaseVar mix(double p,
                        ContPhaseVar v2)
Description copied from interface: ContPhaseVar
Computes the distribution of the mix: res = A*p + B*(1-p)

Specified by:
mix in interface ContPhaseVar
Parameters:
p - Portion of this variable in the mix (0<=p<=1)
v2 - Variable to mix with the original
Returns:
Distribution of the mix: res = A*p + B*(1-p)
See Also:
ContPhaseVar.mix(double, jphase.ContPhaseVar)

min

public ContPhaseVar min(ContPhaseVar v2,
                        ContPhaseVar res)
Description copied from interface: ContPhaseVar
Returns the minimum between the variable B and the original: res = min(A,B)

Specified by:
min in interface ContPhaseVar
Parameters:
v2 - Variable to compare with the original
res - Variable to store the resulting distribution
Returns:
res = min(A,B)
See Also:
ContPhaseVar.min(jphase.ContPhaseVar, jphase.ContPhaseVar)

min

public ContPhaseVar min(ContPhaseVar v2)
Description copied from interface: ContPhaseVar
Returns the minimum between the variable B and the original: res = min(A,B)

Specified by:
min in interface ContPhaseVar
Parameters:
v2 - Variable to compare with the original
Returns:
res = min(A,B)
See Also:
ContPhaseVar.min(jphase.ContPhaseVar)

max

public ContPhaseVar max(ContPhaseVar v2,
                        ContPhaseVar res)
Description copied from interface: ContPhaseVar
Returns the maximum between the variable B and the original: res = max(A,B)

Specified by:
max in interface ContPhaseVar
Parameters:
v2 - Variable to compare with the original
res - Variable to store the resulting distribution
Returns:
res = max(A,B)
See Also:
ContPhaseVar.max(jphase.ContPhaseVar, jphase.ContPhaseVar)

max

public ContPhaseVar max(ContPhaseVar v2)
Description copied from interface: ContPhaseVar
Returns the maximum between the variable B and the original: res = max(A,B)

Specified by:
max in interface ContPhaseVar
Parameters:
v2 - Variable to compare with the original
Returns:
res = max(A,B)
See Also:
ContPhaseVar.max(jphase.ContPhaseVar)

times

public ContPhaseVar times(double c)
Description copied from interface: ContPhaseVar
Returns a Phase continuous variable that is the original one times c

Specified by:
times in interface ContPhaseVar
Parameters:
c - Scale factor to be applied to the original Phase continuous distribution
Returns:
Phase continuous variable that is the original one times c
See Also:
ContPhaseVar.times(double)

residualTime

public ContPhaseVar residualTime(double x)
Description copied from interface: ContPhaseVar
Computes the Residual Time Distribution

Specified by:
residualTime in interface ContPhaseVar
Parameters:
x - evaluation point
Returns:
Distribution of P(X - tau <= x | X > tau
See Also:
ContPhaseVar.residualTime(double)

eqResidualTime

public ContPhaseVar eqResidualTime()
Description copied from interface: ContPhaseVar
Computes the Equilibrium Residual Distribution

Specified by:
eqResidualTime in interface ContPhaseVar
Returns:
Fo(x) = integ(0,t,(1 - F(t))) / E(X)
See Also:
ContPhaseVar.eqResidualTime()

waitingQ

public ContPhaseVar waitingQ(double rho)
Description copied from interface: ContPhaseVar
Computes the distribution of the waiting time in queue

Specified by:
waitingQ in interface ContPhaseVar
Parameters:
rho - Server utilization
Returns:
Phase Variable that describes the waiting time in Queue
See Also:
ContPhaseVar.waitingQ(double)

residualVar

public ContPhaseVar residualVar(double a)
Description copied from interface: ContPhaseVar
Computes the variable (X-a)+, i.e. the distribution takes the value of the original distribution if it is greater or equal to a. Otherwise, it is equal to null.

Specified by:
residualVar in interface ContPhaseVar
Parameters:
a - Parameter for determining loss variable
Returns:
Phase Variable that describes (X-a)+
See Also:
ContPhaseVar.residualVar(double)

toString

public final java.lang.String toString()
Description copied from interface: JMarkovElement
This method returns a short String used in the user interface to describe this element. It is highly recommended that every class calls label(), using the following code:
 public final String toString() {
     return label();
 }
 

Specified by:
toString in interface JMarkovElement
Specified by:
toString in interface ContPhaseVar
Overrides:
toString in class java.lang.Object
Returns:
A String label.
See Also:
ContPhaseVar.toString()

label

public java.lang.String label()
Description copied from interface: JMarkovElement
This method returns a short String used in the user interface to describe this element.

Specified by:
label in interface JMarkovElement
Returns:
A String label.
See Also:
JMarkovElement.description()

description

public java.lang.String description()
Description copied from interface: JMarkovElement
This method return a complete verbal describtion of this element. This description may contain multiple text rows.

Specified by:
description in interface JMarkovElement
Returns:
A String describing this element.
See Also:
JMarkovElement.label()