Class RecursiveSolver
java.lang.Object
solvers.queueingnet.QNSolver
solvers.queueingnet.RecursiveSolver
- All Implemented Interfaces:
QNSolverInterface
- Direct Known Subclasses:
ConvolutionSolver, RECALNonRecursiveSolver, RECALSolver
This class implements the RecursiveSolver object, which contains common
methods for the Convolution and RECAL algorithms.
- Author:
- Michail Makaronidis, 2010
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<Integer, BigRational> The factorials for some numbers are pre-computed for efficiency reasons.protected Map<PopulationVector, Map<MultiplicitiesVector, BigRational>> Here is stored every normalising constant computed.Fields inherited from class QNSolver
G, memUsage, qnm, totalTimer -
Constructor Summary
ConstructorsConstructorDescriptionRecursiveSolver(QNModel qnm) Creates and initialises a RecursiveSolver object. -
Method Summary
Modifier and TypeMethodDescriptionprotected BigRationalComputes any normalising constant using a simple recursion and taking advantage of any already computed and stored value.voidComputes and stores the performance measures (mean throughputs and mean queue lengths for the current model.protected BigRationalSearches for a normalising constant in the memory.protected BigRationalReturns the initial condition corresponding to a particular PopulationVector object.protected BigRationalSearches for a normalising constant in the memory.protected voidstoreG(MultiplicitiesVector m, PopulationVector p, BigRational Gval) Stores a computed normalising constant value for future re-use.protected voidstoreG(MultiplicitiesVector m, PopulationVector p, BigRational Gval, Map<PopulationVector, Map<MultiplicitiesVector, BigRational>> map) Stores at a particular Map<PopulationVector, Map<MultiplicitiesVector, BigRational>> data structure a computed normalising constant value for future re-use.Methods inherited from class QNSolver
computeNormalisingConstant, getNormalisingConstant, printMemUsage, printTimeStatistics, printWelcome
-
Field Details
-
Gmap
Here is stored every normalising constant computed. This speeds up the computation. -
factorial
The factorials for some numbers are pre-computed for efficiency reasons.
-
-
Constructor Details
-
RecursiveSolver
Creates and initialises a RecursiveSolver object.- Parameters:
qnm- The QNModel object that we are working on- Throws:
InternalErrorException- Thrown when the solver cannot be initialised
-
-
Method Details
-
initialConditionFor
Returns the initial condition corresponding to a particular PopulationVector object.- Parameters:
n- The PopulationVector object- Returns:
- The corresponding initial condition
-
storeG
Stores a computed normalising constant value for future re-use.- Parameters:
m- The MultiplicitiesVectorp- The PopulationVectorGval- The corresponding normalising constant that has been computed
-
storeG
protected void storeG(MultiplicitiesVector m, PopulationVector p, BigRational Gval, Map<PopulationVector, Map<MultiplicitiesVector, BigRational>> map) Stores at a particular Map<PopulationVector, Map<MultiplicitiesVector, BigRational>> data structure a computed normalising constant value for future re-use.- Parameters:
m- The MultiplicitiesVectorp- The PopulationVectorGval- The corresponding normalising constant that has been computedmap- The data structure at which the constant will be stored
-
recallG
Searches for a normalising constant in the memory. If it's not found, it returns null.- Parameters:
m- The MultiplicitiesVectorp- The PopulationVector- Returns:
- The normalising constant as a BigRational object. Null if it has not been precomputed in the past.
-
findG
protected BigRational findG(MultiplicitiesVector m, PopulationVector p) throws InternalErrorException Searches for a normalising constant in the memory. If it's not found, it computes and returns it.- Parameters:
m- The MultiplicitiesVectorp- The PopulationVector- Returns:
- The normalising constant as a BigRational object
- Throws:
InternalErrorException- An exception is thrown if any internal error is encountered during computations.
-
compute
protected BigRational compute(MultiplicitiesVector m, PopulationVector p) throws InternalErrorException Computes any normalising constant using a simple recursion and taking advantage of any already computed and stored value.- Parameters:
m- The MultiplicitiesVectorp- The PopulationVector- Returns:
- The normalising constant as a BigRational object
- Throws:
InternalErrorException- An exception is thrown if any internal error is encountered during computations.
-
computePerformanceMeasures
Description copied from class:QNSolverComputes and stores the performance measures (mean throughputs and mean queue lengths for the current model.- Specified by:
computePerformanceMeasuresin interfaceQNSolverInterface- Overrides:
computePerformanceMeasuresin classQNSolver- Throws:
InternalErrorException- Thrown when any computation fails
-