Class ExactModel
java.lang.Object
analytical.ExactModel
- All Implemented Interfaces:
ExactConstants
Model data structure of the exact JMVA algorithms: classes, stations, service demands and reference stations of a product form queueing network.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intdoubleFields inherited from interface ExactConstants
AGGREGATE_TYPES, AGGREGATE_TYPES_SET, CLASS_CLOSED, CLASS_OPEN, CLASS_TYPENAMES, DEBUG, DEFAULT_CLASS_PRIORITY, DESCRIPTION_CLASSES, DESCRIPTION_COMMENT, DESCRIPTION_GRAPH, DESCRIPTION_QUEUELENGTHS, DESCRIPTION_REFERENCESTATION, DESCRIPTION_RESIDENCETIMES, DESCRIPTION_RESPONSETIMES, DESCRIPTION_SERVICEDEMANDS, DESCRIPTION_SERVICETIMES, DESCRIPTION_STATIONS, DESCRIPTION_SYSRESPONSETIMES, DESCRIPTION_SYSTEMPOWERS, DESCRIPTION_THROUGHPUTS, DESCRIPTION_UTILIZATIONS, DESCRIPTION_VISITS, DESCRIPTION_WHATIF_ARRIVAL_ALL, DESCRIPTION_WHATIF_ARRIVAL_ONE, DESCRIPTION_WHATIF_CUSTOMERS_ALL, DESCRIPTION_WHATIF_CUSTOMERS_ONE, DESCRIPTION_WHATIF_DEMANDS_ALL, DESCRIPTION_WHATIF_DEMANDS_ONE, DESCRIPTION_WHATIF_MIX, DESCRIPTION_WHATIF_NONE, GRAY_E, GRAY_S, INDICES_TYPES, MAX_CLASSES, MAX_STATIONS, STATION_DELAY, STATION_HOL, STATION_LD, STATION_LI, STATION_PRS, STATION_TYPENAMES, WHAT_IF_ARRIVAL, WHAT_IF_CUSTOMERS, WHAT_IF_DEMANDS, WHAT_IF_MIX -
Constructor Summary
ConstructorsConstructorDescriptionmake an object with default valuescopy constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod areResultsOK.booleanThis method tells if visits were set or are all unitary (or zero if corresponding service time is zero).booleanChecks current model for reference station consistency: the reference station must be the same for all closed classesintThis function will check if one or more resources are in saturation.booleanChecks current model for reference station consistency: all the visits of closed class in the reference station must be different from zerovoidClears whatif algorithms selectionCreates a DOM representation of this objectvoiddeleteClass(int i) Deletes a classvoiddeleteStation(int i) Deletes a stationvoidDiscards all change elements but does not touch resultsvoidClears all the resultsdouble[]generateWhatIfValues(String type, double from, double to, int iterations, int ClassRef, int stationRef) This method is used to generate a suitable vector of values for what-if analysis.Map<SolverAlgorithm, int[]> int[]Returns the alg iterations.double[]Returns the class data.intReturns the classes.String[]Returns the class names.int[]Returns the class priorities.int[]Returns the class types.Gets the model descriptiondouble[]Returns global aggregate for queue lengthdouble[]getGlobalR(SolverAlgorithm alg, boolean with) Returns system response timedouble[]getGlobalSP(SolverAlgorithm alg, boolean with) double[]Returns global aggregate for throughputintintdouble[][]Returns per-class aggregate for queue lengthdouble[][]getPerClassR(SolverAlgorithm alg, boolean with) Returns per-class aggregate for residence timesdouble[][]getPerClassSP(SolverAlgorithm alg, boolean with) double[][]Returns per-class aggregate for throughputdouble[][]Returns per-station aggregate for queue lengthdouble[][]Returns per-station aggregate for residence timesdouble[][]Returns per-station aggregate for response timesdouble[][]double[][]Returns per-station aggregate for throughputMap<SolverAlgorithm, double[][][]> double[][][]Returns the queue len.int[]Returns the reference station.Map<SolverAlgorithm, double[][][]> double[][][]Returns the resid times.double[][][]Returns the resp times.double[][][]Returns the service times.String[]Returns the station names.intReturns the stations.int[]Returns the station servers.int[]Returns the station types.Map<SolverAlgorithm, double[][][]> double[][][]Returns the throughput.doubleintReturns the total pop.Map<SolverAlgorithm, double[][][]> double[][][]Returns the utilization.double[][]Returns the visits.intgetWhatifAlgorithmMaxSamples(SolverAlgorithm algorithm) Returns the max samples for a whatif algorithmReturns the whatif algorithms.doublegetWhatifAlgorithmTolerance(SolverAlgorithm algorithm) Returns the tolerance for a whatif algorithmintReturns index of class selected for what-if analysis or -1 if every class is selectedintReturns index of station selected for what-if analysis or -1 if every station is selectedReturns type of what-if analysisdouble[]Returns the array of values used for what-if analysisbooleanChecks whether results.booleanChecks whether changed.booleanisClosed()Checks whether closed.booleanisLd()Checks whether ld.booleanisMixed()Checks whether mixed.booleanChecks whether multi class.booleanChecks whether multiple servers.booleanisOpen()Checks whether open.booleanChecks whether priority.booleanChecks whether single class.booleanisWhatIf()Tells if this model includes a what-if analysisbooleanChecks whether whatif algorithms.booleanloadClasses(Node classNode) booleanloadDescription(Element desc) booleanloadDocument(Document doc) load the state of this object from the Document.booleanloadReferenceStation(Node ReferenceStationNode) booleanloadReferenceStationDefault(Node classNode) double[][]loadResultsMatrix(Element base, int len1, int len2, String res) booleanloadSolution(NodeList sol) Load solutions from xml filebooleanloadStations(Node stationNode) voidRandomizes model's service times and visits.voidThis method will recalculate whatif analysis values after the initial values were changed.voidremoveLD()Removes all LD stations, converting them into LI stationsvoidRemoves What-if analysis from current modelvoidResets all algorithms' arrays used to store resultsvoidResets a particular algorithm's arrays used to store resultsvoidresets the changed flag.voidResets arrays used to store resultsbooleanresize(int stations, int classes) Resizes the data structures according to specified parameters.booleanresize(int stations, int classes, boolean forceResize) Resizes the data structures according to specified parameters.voidsetAlgorithmType(SolverAlgorithm algType) voidflags the model as changed.booleansetClassData(double[] classData) sets the data for the classesbooleansetClassNames(String[] classNames) sets the names of the classes.booleansetClassPriorities(int[] classPriorities) sets the priorities of the classesbooleansetClassTypes(int[] classTypes) sets the type of the classesvoidInitialize the object with defaults: 1 closed class, 1 LI station, 0 customers, all visits to one, all service times to zero, no resultsbooleansetDescription(String description) Sets the model descriptiondoubleSets the log norm const.voidsetMaxSamples(int mSamples) booleansetReferenceStation(int[] ReferenceStation) sets the matrix of ReferenceStationvoidsetResults(SolverAlgorithm alg, int[] algIterations, double[][][] queueLen, double[][][] throughput, double[][][] resTimes, double[][][] util, double logNormConst) sets all the result data for this model.voidsetResults(SolverAlgorithm alg, int algIterations, double[][] queueLen, double[][] throughput, double[][] resTimes, double[][] util, double logNormConst) sets all the result data for this model.voidsetResults(SolverAlgorithm alg, int algIterations, double[][] queueLen, double[][] throughput, double[][] resTimes, double[][] util, double logNormConst, int iteration) sets all the result data for this model.voidsetResultsBooleans(boolean value) voidsetResultsOK(boolean value) Sets ResultsOK flagbooleansetServiceTimes(double[][][] serviceTimes) sets the matrix of service timesbooleansetStationNames(String[] stationNames) sets the names of the service centers.booleansetStationServers(int[] stationServers) sets the number of servers for each stationbooleansetStationTypes(int[] stationTypes) sets the type of the stationsvoidsetTolerance(double tol) booleansetVisits(double[][] visits) sets the matrix of visitsvoidsetWhatifAlgorithm(SolverAlgorithm algorithm, boolean compare) Set algorithm to perform whatif onvoidsetWhatifAlgorithmMaxSamples(SolverAlgorithm algorithm, int value) Sets the max samples for a whatif algorithmvoidsetWhatifAlgorithmTolerance(SolverAlgorithm algorithm, double value) Sets the tolerance for a whatif algorithmbooleansetWhatIfClass(int classNum) Sets class used for what-if analysisbooleansetWhatIfStation(int stationNum) Sets station used for what-if analysisbooleansetWhatIfType(String type) Sets type of what-if analysisbooleansetWhatIfValues(double[] values) Sets the array of values used for what-if analysistoString()Warning: Calling this on large systems *will* result in OutOfMemory errors.
-
Field Details
-
algorithmType
-
tolerance
public double tolerance -
NO_SATURATION
public static final int NO_SATURATION- See Also:
-
SATURATION
public static final int SATURATION- See Also:
-
SATURATION_WHATIF
public static final int SATURATION_WHATIF- See Also:
-
-
Constructor Details
-
ExactModel
public ExactModel()make an object with default values -
ExactModel
copy constructor
-
-
Method Details
-
getAlgorithmType
-
setAlgorithmType
-
getTolerance
public double getTolerance() -
setTolerance
public void setTolerance(double tol) -
getMaxSamples
public int getMaxSamples() -
setMaxSamples
public void setMaxSamples(int mSamples) -
getWhatifAlgorithms
Returns the whatif algorithms.- Returns:
- the set of algorithm to perform whatif on
-
setWhatifAlgorithm
Set algorithm to perform whatif on- Parameters:
algorithm- the algorithmcompare- true to do whatif, false otherwise
-
getWhatifAlgorithmTolerance
Returns the tolerance for a whatif algorithm- Parameters:
algorithm- the algorithm- Returns:
- the tolerance
-
setWhatifAlgorithmTolerance
Sets the tolerance for a whatif algorithm- Parameters:
algorithm- the algorithmvalue- the tolerance
-
getWhatifAlgorithmMaxSamples
Returns the max samples for a whatif algorithm- Parameters:
algorithm- the algorithm- Returns:
- the max samples
-
setWhatifAlgorithmMaxSamples
Sets the max samples for a whatif algorithm- Parameters:
algorithm- the algorithmvalue- the max samples
-
isWhatifAlgorithms
public boolean isWhatifAlgorithms()Checks whether whatif algorithms.- Returns:
- true if AMVA algorithm comparison was requested. false otherwise.
-
clearWhatifAlgorithms
public void clearWhatifAlgorithms()Clears whatif algorithms selection -
getIterations
public int getIterations() -
discardResults
public void discardResults()Clears all the results -
discardChanges
public void discardChanges()Discards all change elements but does not touch results -
setResults
public void setResults(SolverAlgorithm alg, int[] algIterations, double[][][] queueLen, double[][][] throughput, double[][][] resTimes, double[][][] util, double logNormConst) sets all the result data for this model.- Parameters:
alg- the algalgIterations- the alg iterationsqueueLen- the queue lenthroughput- the throughputresTimes- the res timesutil- the utillogNormConst- the log norm const- Throws:
IllegalArgumentException- if any argument is null or not of the correct size
-
setResults
public void setResults(SolverAlgorithm alg, int algIterations, double[][] queueLen, double[][] throughput, double[][] resTimes, double[][] util, double logNormConst) sets all the result data for this model. This is called when only one iteration is performed.- Parameters:
alg- the algalgIterations- the alg iterationsqueueLen- the queue lenthroughput- the throughputresTimes- the res timesutil- the utillogNormConst- the log norm const- Throws:
IllegalArgumentException- if any argument is null or not of the correct size
-
setResultsOK
public void setResultsOK(boolean value) Sets ResultsOK flag- Parameters:
value- value of ResultsOK flag
-
setResults
public void setResults(SolverAlgorithm alg, int algIterations, double[][] queueLen, double[][] throughput, double[][] resTimes, double[][] util, double logNormConst, int iteration) sets all the result data for this model. This is called on multiple iterations (what-if analysis)- Parameters:
alg- the algalgIterations- the alg iterationsqueueLen- the queue lenthroughput- the throughputresTimes- the res timesutil- the utillogNormConst- the log norm constiteration- the iteration- Throws:
IllegalArgumentException- if any argument is null or not of the correct size
-
setResultsBooleans
public void setResultsBooleans(boolean value) -
resetAlgResults
Resets a particular algorithm's arrays used to store results -
resetAlgResults
public void resetAlgResults()Resets all algorithms' arrays used to store results -
resetResults
public void resetResults()Resets arrays used to store results -
setDefaults
public void setDefaults()Initialize the object with defaults: 1 closed class, 1 LI station, 0 customers, all visits to one, all service times to zero, no results -
getDescription
-
setDescription
Sets the model description- Parameters:
description- the model description- Returns:
- true if data was changed, false otherwise
-
isSingleClass
public boolean isSingleClass()Checks whether single class.- Returns:
- true if this object describes a single class system
-
isMultiClass
public boolean isMultiClass()Checks whether multi class.- Returns:
- true if this object describes a multiclass system
-
isClosed
public boolean isClosed()Checks whether closed.- Returns:
- true if this object describes a closed system
-
isOpen
public boolean isOpen()Checks whether open.- Returns:
- true if this object describes an open system
-
isMixed
public boolean isMixed()Checks whether mixed.- Returns:
- true if this object describes a mixed system
-
isLd
public boolean isLd()Checks whether ld.- Returns:
- true if this object describes a system containing LD stations
-
isPriority
public boolean isPriority()Checks whether priority.- Returns:
- true if this object describes a system containing priority stations
-
getStations
public int getStations()Returns the stations.- Returns:
- number of service centers
-
getClasses
public int getClasses()Returns the classes.- Returns:
- number of classes
-
getReferenceStation
public int[] getReferenceStation()Returns the reference station.- Returns:
- get the matrix of ReferenceStations
-
getTotalPop
public int getTotalPop()Returns the total pop.- Returns:
- total population
-
getStationNames
-
getStationServers
public int[] getStationServers()Returns the station servers.- Returns:
- the number of servers for each station. For delay stations this parameter is unsensed.
-
isMultipleServers
public boolean isMultipleServers()Checks whether multiple servers.- Returns:
- true if this model contains multiple server for a station.
-
setStationServers
public boolean setStationServers(int[] stationServers) sets the number of servers for each station- Parameters:
stationServers- the number of servers of each station- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
setStationNames
sets the names of the service centers.- Parameters:
stationNames- the names of the service centers- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getClassNames
-
setClassNames
sets the names of the classes.- Parameters:
classNames- the names of the classes- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getClassData
public double[] getClassData()Returns the class data.- Returns:
- data for the classes.
-
setClassData
public boolean setClassData(double[] classData) sets the data for the classes- Parameters:
classData- the data for the classes- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getClassTypes
public int[] getClassTypes()Returns the class types.- Returns:
- type of the classes
-
setClassTypes
public boolean setClassTypes(int[] classTypes) sets the type of the classes- Parameters:
classTypes- the type of the classes- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getClassPriorities
public int[] getClassPriorities()Returns the class priorities.- Returns:
- priorities of the classes
-
setClassPriorities
public boolean setClassPriorities(int[] classPriorities) sets the priorities of the classes- Parameters:
classPriorities- the priority of the classes- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getStationTypes
public int[] getStationTypes()Returns the station types.- Returns:
- type of the stations
-
setStationTypes
public boolean setStationTypes(int[] stationTypes) sets the type of the stations- Parameters:
stationTypes- the type of the stations- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the array is not of the correct size
-
getVisits
public double[][] getVisits()Returns the visits.- Returns:
- the matrix of visits
-
setVisits
public boolean setVisits(double[][] visits) sets the matrix of visits- Parameters:
visits- the matrix of visits- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the matrix is not of the correct size
-
getServiceTimes
public double[][][] getServiceTimes()Returns the service times.- Returns:
- the matrix of service times
-
setServiceTimes
public boolean setServiceTimes(double[][][] serviceTimes) sets the matrix of service times- Parameters:
serviceTimes- the matrix of service times- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the matrix is not of the correct size
-
setReferenceStation
public boolean setReferenceStation(int[] ReferenceStation) sets the matrix of ReferenceStation- Parameters:
ReferenceStation- the matrix of ReferenceStation- Returns:
- true if data was changed, false otherwise
- Throws:
IllegalArgumentException- if the matrix is not of the correct size
-
resize
public boolean resize(int stations, int classes, boolean forceResize) Resizes the data structures according to specified parameters. Data is preserved as far as possible- Parameters:
stations- the stationsclasses- the classesforceResize- the force resize- Returns:
- true if data was changed, false otherwise
-
resize
public boolean resize(int stations, int classes) Resizes the data structures according to specified parameters. Data is preserved as far as possible- Parameters:
stations- the stationsclasses- the classes- Returns:
- true if data was changed, false otherwise
-
getAlgIterations
- Returns:
- algorithm iterations
-
getAlgIterations
Returns the alg iterations.- Parameters:
alg- the alg- Returns:
- algorithm iterations for the given algorithm
-
getQueueLen
- Returns:
- queue lengths
-
getQueueLen
Returns the queue len.- Parameters:
alg- the alg- Returns:
- queue lengths for the given algorithm
-
getResidTimes
- Returns:
- residence times
-
getResidTimes
Returns the resid times.- Parameters:
alg- the alg- Returns:
- response times for the given algorithm
-
getRespTimes
Returns the resp times.- Parameters:
alg- the alg- Returns:
- residence times for the given algorithm
-
getThroughput
- Returns:
- throughputs
-
getThroughput
Returns the throughput.- Parameters:
alg- the alg- Returns:
- throughputs for the given algorithm
-
getUtilization
- Returns:
- utilizations
-
getUtilization
Returns the utilization.- Parameters:
alg- the alg- Returns:
- utilizations for the given algorithm
-
getLogNormConst
- Returns:
- logarithms of normalising constants
-
setLogNormConst
Sets the log norm const.- Parameters:
alg- the alg- Returns:
- logarithm of normalising constant for the given algorithm
-
removeLD
public void removeLD()Removes all LD stations, converting them into LI stations -
toString
-
deleteClass
public void deleteClass(int i) Deletes a class- Parameters:
i- the index of the class
-
deleteStation
public void deleteStation(int i) Deletes a station- Parameters:
i- the index of the station
-
isChanged
public boolean isChanged()Checks whether changed.- Returns:
- true if the model has been changed
-
resetChanged
public void resetChanged()resets the changed flag.
WARNING: this enables change checking on parameter setting, which can be quite time-consuming. -
setChanged
public void setChanged()flags the model as changed. There is no need to call this, except to disable time-consuming change checking if you're not interested in it -
hasResults
public boolean hasResults()Checks whether results.- Returns:
- true if results are available
-
areResultsOK
public boolean areResultsOK()Method areResultsOK.- Returns:
- true if results are valid
-
createDocument
Creates a DOM representation of this object- Returns:
- a DOM representation of this object
-
loadDocument
load the state of this object from the Document.- Parameters:
doc- the doc- Returns:
- true if the operation was successful. WARNING: If the operation fails the object is left in an incorrect state and should be discarded.
-
loadDescription
-
loadClasses
-
loadStations
-
loadReferenceStation
-
loadReferenceStationDefault
-
loadSolution
Load solutions from xml file- Parameters:
sol- NodeList of solution elements- Returns:
- true if load was successful, false otherwise
-
loadResultsMatrix
-
getPerClassX
Returns per-class aggregate for throughput -
getPerStationX
Returns per-station aggregate for throughput -
getGlobalX
Returns global aggregate for throughput -
getPerClassQ
Returns per-class aggregate for queue length -
getPerStationQ
Returns per-station aggregate for queue length -
getGlobalQ
Returns global aggregate for queue length -
getPerClassR
Returns per-class aggregate for residence times -
getPerStationRespT
Returns per-station aggregate for response times -
getPerStationResidT
Returns per-station aggregate for residence times -
getGlobalR
Returns system response time -
getPerStationU
-
getPerClassSP
-
getGlobalSP
-
areVisitsSet
public boolean areVisitsSet()This method tells if visits were set or are all unitary (or zero if corresponding service time is zero). This is used to show correct panel layout upon loading- Returns:
- true iff visits were not set
-
randomizeModelData
public void randomizeModelData()Randomizes model's service times and visits. -
isWhatIf
public boolean isWhatIf()Tells if this model includes a what-if analysis- Returns:
- true if this model includes a what-if analysis
-
removeWhatIf
public void removeWhatIf()Removes What-if analysis from current model -
setWhatIfValues
public boolean setWhatIfValues(double[] values) Sets the array of values used for what-if analysis- Parameters:
values- vector with values to be used in iterations of what-if analysis- Returns:
- true if the operation is successful, false otherwise
-
setWhatIfClass
public boolean setWhatIfClass(int classNum) Sets class used for what-if analysis- Parameters:
classNum- ordered number of selected class or -1 for every class- Returns:
- true if data was changed, false otherwise
-
setWhatIfStation
public boolean setWhatIfStation(int stationNum) Sets station used for what-if analysis- Parameters:
stationNum- ordered number of selected station or -1 for every station- Returns:
- true if data was changed, false otherwise
-
setWhatIfType
Sets type of what-if analysis- Parameters:
type- WHAT_IF_ARRIVAL, WHAT_IF_CUSTOMERS, WHAT_IF_MIX, WHAT_IF_DEMANDS- Returns:
- true if data was changed, false otherwise
- See Also:
-
getWhatIfType
Returns type of what-if analysis- Returns:
- WHAT_IF_ARRIVAL, WHAT_IF_CUSTOMERS, WHAT_IF_MIX, WHAT_IF_DEMANDS
- See Also:
-
getWhatIfStation
public int getWhatIfStation()Returns index of station selected for what-if analysis or -1 if every station is selected- Returns:
- index of station selected for what-if analysis or -1 if every station is selected
-
getWhatIfClass
public int getWhatIfClass()Returns index of class selected for what-if analysis or -1 if every class is selected- Returns:
- index of class selected for what-if analysis or -1 if every class is selected
-
getWhatIfValues
public double[] getWhatIfValues()Returns the array of values used for what-if analysis- Returns:
- the array of values used for what-if analysis
-
generateWhatIfValues
public double[] generateWhatIfValues(String type, double from, double to, int iterations, int ClassRef, int stationRef) This method is used to generate a suitable vector of values for what-if analysis.- Parameters:
type- type of what-if analysis to be performed. (WHAT_IF_ARRIVAL, WHAT_IF_CUSTOMERS, WHAT_IF_MIX, WHAT_IF_DEMANDS)from- initial valueto- final valueiterations- expected number of iterations (will be adjusted to be compliant with specified from and to values in WHAT_IF_CUSTOMERS and WHAT_IF_MIX)ClassRef- index of class to be analyzed or -1 for all classesstationRef- index of station to be analyzed (only for WHAT_IF_DEMANDS)- Returns:
- suitable array of iterations to be performed
-
recalculateWhatifValues
public void recalculateWhatifValues()This method will recalculate whatif analysis values after the initial values were changed. At first detects changes, than applies modifications. If what-if analysis is no longer appliable, resets it. -
checkSaturation
public int checkSaturation()This function will check if one or more resources are in saturation. This will consider each iteration of what-if analysis if present.- Returns:
- NO_SATURATION if everything is okay, SATURATION if a class saturation is detected with specified parameters and SATURATION_WHATIF if a saturation will be caused by whatif values.
-
checkVisitReferenceStation
public boolean checkVisitReferenceStation()Checks current model for reference station consistency: all the visits of closed class in the reference station must be different from zero- Returns:
- true if model is consistent, false otherwise
-
checkClassesReferenceStation
public boolean checkClassesReferenceStation()Checks current model for reference station consistency: the reference station must be the same for all closed classes- Returns:
- true if model is consistent, false otherwise
-