Package jline.lang
Class Environment
java.lang.Object
jline.lang.Model
jline.lang.Ensemble
jline.lang.Environment
- All Implemented Interfaces:
Serializable,Copyable
- Direct Known Subclasses:
Env
An environment model defined by a collection of network sub-models coupled with an environment transition rule
that selects the active sub-model.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescriptor of a node breakdown/repair macro applied throughaddNodeBreakdown/addNodeRepair.static interfacestatic interfacestatic interfaceState-vector reset policy for the SolverENV state-vector analyzer (options.method='statevec'). -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Distribution[][]static final Environment.ResetStateFunctionThe default state-vector reset of every arc, the identity.double[][]MatrixCell[][]static final StringNamed reset policy emptying the queues on a transition.static final StringMarks a reset policy given as an arbitrary function, which cannot be serialized.static final StringNamed reset policy carrying the queue lengths across a transition unchanged. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib) Adds a KERNEL arc of the semi-Markov kernel Q(e,h,t) = prob * distrib(t): on entry to the source stage the next stage is the destination with probabilityprob, and the sojourn is then distributed asdistrib.voidaddKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun) Adds a kernel arc with a custom queue-length reset function; seeaddKernelTransition(int, int, double, Distribution).voidaddKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun, Environment.ResetEnvRatesFunction resetEnvRatesFun) Adds a kernel arc with custom queue-length and environment-rate reset functions; seeaddKernelTransition(int, int, double, Distribution).voidaddNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist) Adds a breakdown stage for a specific node in the network.voidaddNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist, String resetPolicy) Adds a breakdown with a named reset policy.voidaddNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetFun) Adds a breakdown stage for a specific node with a custom reset policy.voidaddNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist) Adds a breakdown stage for a specific node in the network.voidaddNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist, String resetPolicy) Adds a breakdown with a named reset policy.voidaddNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetFun) Adds a breakdown stage for a specific node with a custom reset policy.voidaddNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist) Convenience method to add both breakdown and repair for a node.voidaddNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String resetBreakdown, String resetRepair) Adds both breakdown and repair for a node with named reset policies.voidaddNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetBreakdown, Environment.ResetQueueLengthsFunction resetRepair) Adds both breakdown and repair for a node with custom reset policies.voidaddNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist) Convenience method to add both breakdown and repair for a node.voidaddNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String resetBreakdown, String resetRepair) Adds both breakdown and repair for a node with named reset policies.voidaddNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetBreakdown, Environment.ResetQueueLengthsFunction resetRepair) Adds both breakdown and repair for a node with custom reset policies.voidaddNodeRepair(String nodeName, Markovian repairDist) Adds a repair transition from DOWN to UP stage for a previously added breakdown.voidaddNodeRepair(String nodeName, Markovian repairDist, String resetPolicy) Adds a repair transition with a named reset policy.voidaddNodeRepair(String nodeName, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun) Adds a repair transition with a custom reset policy.voidaddNodeRepair(Node node, Markovian repairDist) Adds a repair transition from DOWN to UP stage for a previously added breakdown.voidaddNodeRepair(Node node, Markovian repairDist, String resetPolicy) Adds a repair transition with a named reset policy.voidaddNodeRepair(Node node, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun) Adds a repair transition with a custom reset policy.voidAdds a network model to a specific stage of the environment.voidaddTransition(int fromStageIdx, int toStageIdx, Distribution distrib) Adds a transition between two stages with default reset function (identity).voidaddTransition(int fromStageIdx, int toStageIdx, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun) Adds a transition between two stages with a custom reset function.voidaddTransition(int fromStageIdx, int toStageIdx, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun, Environment.ResetEnvRatesFunction resetEnvRatesFun) Adds a transition between two stages with custom reset functions for both queue lengths and environment rates.Alias offindSolver().findMethod(String metric, boolean showAll) Alias offindSolver(String, boolean).intfindNodeFailure(String nodeName) Finds the node-failure descriptor for a node.Every runnable (solver, method) pair; seefindSolver(String, boolean).findSolver(String metric, boolean showAll) Which solvers and solver methods can analyze this random environment, as MATLABEnvironment.findSolver.intfindStageByName(String stageName) Finds the stage index by name.intGets the number of stages in this environment.Computes system-wide reliability metrics (MTTF, MTTR, MTBF, Availability).getRelT()Short alias for getReliabilityTable.Short alias for getReliabilityTable.getSmpArcs(int e) The arcs of semi-Markov stage e as Smp_stage_cif takes them, or null for a Markovian stage (after init).double[]getSmpProbs(int e) The kernel probabilities of semi-Markov stage e, or null for a competing or Markovian one (after init).getStageArcs(int e) The transitions out of stage e in the form Smp_stage_cif takes: element h is the law of e->h or null where there is none (the self arc excluded).double[]getStageKernelProbs(int e) The kernel probabilities of stage e, or null for a competing stage.Model[]Stage models by absolute index; may hold Network or LayeredNetwork.getStageName(int stageIdx) Gets the name of the stage at the given index.Short alias for getStageTable.Returns a table of stage information for this environment.getStageType(int stageIdx) Gets the type classification of the stage at the given index.double[]holdTimeCdf(int e, double[] t) CDF of the holding time of stage e at the instants t (after init): the MAP of a Markovian stage, the arc race or kernel mixture of a semi-Markov one.doubleholdTimeMean(int e) Mean holding time of stage e (after init).voidinit()booleanisAbsorbingStage(int e) True if stage e has no outgoing transition: once entered, the environment stays there, with infinite holding time.booleanisKernelStage(int e) True if stage e's arcs are kernel arcs (addKernelTransition).booleanTrue if any stage is semi-Markov.booleanisSemiMarkovStage(int e) True if stage e's holding time has no Markovian (MAP) form: kernel arcs, or a competing non-Markovian arc.voidPrints a formatted table showing all stages, their properties, and transitions.voidregisterNodeFailure(String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String breakdownPolicy, String repairPolicy) Attaches a node breakdown/repair descriptor to stages that already exist.relT()Short alias for getReliabilityTable.relTable()Short alias for getReliabilityTable.resolveResetPolicy(String policyName) Resolves a named queue-length reset policy into its function.voidsetBreakdownResetPolicy(String nodeName, String resetPolicy) Sets a named reset policy for queue lengths when a node breaks down.voidsetBreakdownResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun) Sets the reset policy for queue lengths when a node breaks down.voidsetBreakdownResetPolicy(Node node, String resetPolicy) Sets a named reset policy for queue lengths when a node breaks down.voidsetBreakdownResetPolicy(Node node, Environment.ResetQueueLengthsFunction resetFun) Sets the reset policy for queue lengths when a node breaks down.voidsetRepairResetPolicy(String nodeName, String resetPolicy) Sets a named reset policy for queue lengths when a node is repaired.voidsetRepairResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun) Sets the reset policy for queue lengths when a node is repaired.voidsetRepairResetPolicy(Node node, String resetPolicy) Sets a named reset policy for queue lengths when a node is repaired.voidsetRepairResetPolicy(Node node, Environment.ResetQueueLengthsFunction resetFun) Sets the reset policy for queue lengths when a node is repaired.Methods inherited from class jline.lang.Ensemble
getEnsemble, getModel, merge, merge, setEnsemble, size, toNetworkMethods inherited from class jline.lang.Model
getAttribute, getName, getVersion, setAttribute, setName, setVersion
-
Field Details
-
env
-
proc
-
holdTime
-
kernelProb
public double[][] kernelProb -
probEmb
-
holdMean
-
probEnv
-
probOrig
-
resetQLFun
-
resetStateFun
-
resetEnvRatesFun
-
RESET_POLICY_KEEP
Named reset policy carrying the queue lengths across a transition unchanged.- See Also:
-
RESET_POLICY_CLEAR
Named reset policy emptying the queues on a transition.- See Also:
-
RESET_POLICY_CUSTOM
Marks a reset policy given as an arbitrary function, which cannot be serialized.- See Also:
-
IDENTITY_STATE_RESET
The default state-vector reset of every arc, the identity. An arc still holding this instance declares no resetStateFun (Python and MATLAB leave the entry empty), so a reader that gives a declared resetStateFun precedence over the queue-length reset, as the LAL embedding does, falls through toresetQLFunon it.
-
-
Constructor Details
-
Environment
-
Environment
-
-
Method Details
-
findSolver
Which solvers and solver methods can analyze this random environment, as MATLABEnvironment.findSolver.model.findSolver() every runnable (solver, method) pair model.findSolver("", true) also the refused pairs, and whyThe only family that admits an Environment is "env", whose stage models are solved by SolverAUTO per submodel;Methodof a row is the name to pass as a solver method.- Parameters:
metric- a measure group or the accessor that returns it; "" or "any" keeps every pairshowAll- keep the refused pairs too, with the reason each was refused- Returns:
- the matching rows
-
findSolver
Every runnable (solver, method) pair; seefindSolver(String, boolean). -
findMethod
Alias offindSolver(). -
findMethod
Alias offindSolver(String, boolean). -
addStage
Adds a network model to a specific stage of the environment. All stages must have networks with the same number of stateful nodes.- Parameters:
stageIdx- the index of the stage (0-based)name- the name of this stagetype- the type classification for this stagemodel- the network model to associate with this stage- Throws:
RuntimeException- if the model has a different number of stateful nodes than other stages
-
getStageModels
Stage models by absolute index; may hold Network or LayeredNetwork. -
addTransition
Adds a transition between two stages with default reset function (identity).- Parameters:
fromStageIdx- the source stage indextoStageIdx- the destination stage indexdistrib- the distribution governing this transition: a COMPETING arc, i.e. a latent clock started on entry to the stage, the first of the stage's clocks to ring picking the destination. A non-Markovian law makes the environment semi-Markov, which only SolverENV method 'smp' solves.
-
addTransition
public void addTransition(int fromStageIdx, int toStageIdx, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun) Adds a transition between two stages with a custom reset function.- Parameters:
fromStageIdx- the source stage indextoStageIdx- the destination stage indexdistrib- the distribution governing this transition (a competing arc)resetFun- function to apply when transitioning to reset queue lengths
-
addTransition
public void addTransition(int fromStageIdx, int toStageIdx, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun, Environment.ResetEnvRatesFunction resetEnvRatesFun) Adds a transition between two stages with custom reset functions for both queue lengths and environment rates.- Parameters:
fromStageIdx- the source stage indextoStageIdx- the destination stage indexdistrib- the distribution governing this transition (a competing arc)resetFun- function to apply when transitioning to reset queue lengthsresetEnvRatesFun- function to apply when transitioning to reset environment rates
-
addKernelTransition
public void addKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib) Adds a KERNEL arc of the semi-Markov kernel Q(e,h,t) = prob * distrib(t): on entry to the source stage the next stage is the destination with probabilityprob, and the sojourn is then distributed asdistrib. This is the sojourn-time parameterization (Approach I of Asanjarani et al.), beside addTransition's competing clocks (Approach II). A stage's arcs must be all kernel or all competing, and the probabilities of a kernel stage must sum to one. Only SolverENV method 'smp' solves an environment with kernel arcs.- Parameters:
fromStageIdx- the source stage indextoStageIdx- the destination stage indexprob- the probability of the transition, in (0,1]distrib- the conditional sojourn law of a visit that ends in the destination
-
addKernelTransition
public void addKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun) Adds a kernel arc with a custom queue-length reset function; seeaddKernelTransition(int, int, double, Distribution). -
addKernelTransition
public void addKernelTransition(int fromStageIdx, int toStageIdx, double prob, Distribution distrib, Environment.ResetQueueLengthsFunction resetFun, Environment.ResetEnvRatesFunction resetEnvRatesFun) Adds a kernel arc with custom queue-length and environment-rate reset functions; seeaddKernelTransition(int, int, double, Distribution). -
isKernelStage
public boolean isKernelStage(int e) True if stage e's arcs are kernel arcs (addKernelTransition). -
isSemiMarkovStage
public boolean isSemiMarkovStage(int e) True if stage e's holding time has no Markovian (MAP) form: kernel arcs, or a competing non-Markovian arc. -
isAbsorbingStage
public boolean isAbsorbingStage(int e) True if stage e has no outgoing transition: once entered, the environment stays there, with infinite holding time. -
isSemiMarkov
public boolean isSemiMarkov()True if any stage is semi-Markov. -
getStageArcs
The transitions out of stage e in the form Smp_stage_cif takes: element h is the law of e->h or null where there is none (the self arc excluded). -
getStageKernelProbs
public double[] getStageKernelProbs(int e) The kernel probabilities of stage e, or null for a competing stage. Validates that the stage does not mix kernel and competing arcs and that its probabilities sum to one. -
holdTimeCdf
public double[] holdTimeCdf(int e, double[] t) CDF of the holding time of stage e at the instants t (after init): the MAP of a Markovian stage, the arc race or kernel mixture of a semi-Markov one. -
holdTimeMean
public double holdTimeMean(int e) Mean holding time of stage e (after init). -
getSmpArcs
The arcs of semi-Markov stage e as Smp_stage_cif takes them, or null for a Markovian stage (after init). -
getSmpProbs
public double[] getSmpProbs(int e) The kernel probabilities of semi-Markov stage e, or null for a competing or Markovian one (after init). -
init
public void init() -
printStageTable
public void printStageTable()Prints a formatted table showing all stages, their properties, and transitions. Displays stage names, types, associated networks, and transition rates. -
findStageByName
Finds the stage index by name.- Parameters:
stageName- the name of the stage to find- Returns:
- the index of the stage, or -1 if not found
-
getStageName
Gets the name of the stage at the given index.- Parameters:
stageIdx- the index of the stage (0-based)- Returns:
- the name of the stage
- Throws:
ArrayIndexOutOfBoundsException- if stageIdx is out of range
-
getStageType
Gets the type classification of the stage at the given index.- Parameters:
stageIdx- the index of the stage (0-based)- Returns:
- the type of the stage, or an empty string when none was declared
- Throws:
ArrayIndexOutOfBoundsException- if stageIdx is out of range
-
getNumberOfStages
public int getNumberOfStages()Gets the number of stages in this environment.- Returns:
- the number of stages
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist) Adds a breakdown stage for a specific node in the network. This creates an UP stage (if not already present) and a DOWN stage where the specified node has a reduced service rate. A transition from UP to DOWN is added with the given breakdown distribution.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break downbreakdownDist- the distribution for time until breakdown (UP->DOWN transition)downServiceDist- the service distribution when the node is down- Throws:
RuntimeException- if the node is not found in the base model
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist) Adds a breakdown stage for a specific node in the network. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break downbreakdownDist- the distribution for time until breakdown (UP->DOWN transition)downServiceDist- the service distribution when the node is down
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetFun) Adds a breakdown stage for a specific node with a custom reset policy.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break downbreakdownDist- the distribution for time until breakdowndownServiceDist- the service distribution when the node is downresetFun- function to reset queue lengths on breakdown
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetFun) Adds a breakdown stage for a specific node with a custom reset policy. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break downbreakdownDist- the distribution for time until breakdowndownServiceDist- the service distribution when the node is downresetFun- function to reset queue lengths on breakdown
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist, String resetPolicy) Adds a breakdown with a named reset policy.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break downbreakdownDist- the distribution for time until breakdowndownServiceDist- the service distribution when the node is downresetPolicy- named reset policy, "keep" or "clear"
-
addNodeBreakdown
public void addNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist, String resetPolicy) Adds a breakdown with a named reset policy. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break downbreakdownDist- the distribution for time until breakdowndownServiceDist- the service distribution when the node is downresetPolicy- named reset policy, "keep" or "clear"
-
addNodeRepair
Adds a repair transition from DOWN to UP stage for a previously added breakdown.- Parameters:
nodeName- the name of the node that can be repairedrepairDist- the distribution for repair time (DOWN->UP transition)- Throws:
RuntimeException- if the DOWN stage for this node is not found
-
addNodeRepair
Adds a repair transition with a named reset policy.- Parameters:
nodeName- the name of the node that can be repairedrepairDist- the distribution for repair timeresetPolicy- named reset policy, "keep" or "clear"
-
addNodeRepair
Adds a repair transition with a named reset policy. Overload that accepts a Node object instead of a node name.- Parameters:
node- the node that can be repairedrepairDist- the distribution for repair timeresetPolicy- named reset policy, "keep" or "clear"
-
addNodeRepair
Adds a repair transition from DOWN to UP stage for a previously added breakdown. Overload that accepts a Node object instead of a node name.- Parameters:
node- the node that can be repairedrepairDist- the distribution for repair time (DOWN->UP transition)
-
addNodeRepair
public void addNodeRepair(String nodeName, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun) Adds a repair transition with a custom reset policy.- Parameters:
nodeName- the name of the node that can be repairedrepairDist- the distribution for repair timeresetFun- function to reset queue lengths on repair
-
addNodeRepair
public void addNodeRepair(Node node, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun) Adds a repair transition with a custom reset policy. Overload that accepts a Node object instead of a node name.- Parameters:
node- the node that can be repairedrepairDist- the distribution for repair timeresetFun- function to reset queue lengths on repair
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist) Convenience method to add both breakdown and repair for a node. This is the most common use case where a node can fail and be repaired.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is down
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String resetBreakdown, String resetRepair) Adds both breakdown and repair for a node with named reset policies.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is downresetBreakdown- named breakdown reset policy, "keep" or "clear"resetRepair- named repair reset policy, "keep" or "clear"
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String resetBreakdown, String resetRepair) Adds both breakdown and repair for a node with named reset policies. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is downresetBreakdown- named breakdown reset policy, "keep" or "clear"resetRepair- named repair reset policy, "keep" or "clear"
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist) Convenience method to add both breakdown and repair for a node. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is down
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetBreakdown, Environment.ResetQueueLengthsFunction resetRepair) Adds both breakdown and repair for a node with custom reset policies.- Parameters:
baseModel- the base network model with normal (UP) service ratesnodeName- the name of the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is downresetBreakdown- reset function for breakdown transitionresetRepair- reset function for repair transition
-
addNodeFailureRepair
public void addNodeFailureRepair(Network baseModel, Node node, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, Environment.ResetQueueLengthsFunction resetBreakdown, Environment.ResetQueueLengthsFunction resetRepair) Adds both breakdown and repair for a node with custom reset policies. Overload that accepts a Node object instead of a node name.- Parameters:
baseModel- the base network model with normal (UP) service ratesnode- the node that can break down and repairbreakdownDist- the distribution for time until breakdownrepairDist- the distribution for repair timedownServiceDist- the service distribution when the node is downresetBreakdown- reset function for breakdown transitionresetRepair- reset function for repair transition
-
setBreakdownResetPolicy
public void setBreakdownResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun) Sets the reset policy for queue lengths when a node breaks down.- Parameters:
resetFun- function to reset queue lengths: resetFun(q) -> q_new Common policies: - input -> input (keep all jobs, default) - input -> input.mult(0, null) (clear all queues)- Throws:
RuntimeException- if the breakdown transition is not found
-
setBreakdownResetPolicy
Sets the reset policy for queue lengths when a node breaks down. Overload that accepts a Node object instead of a node name.- Parameters:
resetFun- function to reset queue lengths: resetFun(q) -> q_new
-
setBreakdownResetPolicy
Sets a named reset policy for queue lengths when a node breaks down.- Parameters:
resetPolicy- named reset policy, "keep" or "clear"
-
setBreakdownResetPolicy
Sets a named reset policy for queue lengths when a node breaks down. Overload that accepts a Node object instead of a node name.- Parameters:
resetPolicy- named reset policy, "keep" or "clear"
-
setRepairResetPolicy
Sets the reset policy for queue lengths when a node is repaired.- Parameters:
resetFun- function to reset queue lengths: resetFun(q) -> q_new- Throws:
RuntimeException- if the repair transition is not found
-
setRepairResetPolicy
Sets the reset policy for queue lengths when a node is repaired. Overload that accepts a Node object instead of a node name.- Parameters:
resetFun- function to reset queue lengths: resetFun(q) -> q_new
-
setRepairResetPolicy
Sets a named reset policy for queue lengths when a node is repaired.- Parameters:
resetPolicy- named reset policy, "keep" or "clear"
-
setRepairResetPolicy
Sets a named reset policy for queue lengths when a node is repaired. Overload that accepts a Node object instead of a node name.- Parameters:
resetPolicy- named reset policy, "keep" or "clear"
-
getReliabilityTable
Computes system-wide reliability metrics (MTTF, MTTR, MTBF, Availability). Analyzes the breakdown/repair transitions configured using addNodeBreakdown() and addNodeRepair() to compute reliability metrics.- Returns:
- a Map containing reliability metrics with keys: "MTTF" - Mean Time To Failure (time from UP to DOWN) "MTTR" - Mean Time To Repair (time from DOWN to UP) "MTBF" - Mean Time Between Failures (MTTF + MTTR) "Availability" - Steady-state probability of being in UP state
- Throws:
RuntimeException- if the environment has not been initialized or if no breakdown/repair transitions are configured
-
relT
Short alias for getReliabilityTable.- Returns:
- a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
- See Also:
-
getRelT
Short alias for getReliabilityTable.- Returns:
- a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
- See Also:
-
relTable
Short alias for getReliabilityTable.- Returns:
- a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
- See Also:
-
getRelTable
Short alias for getReliabilityTable.- Returns:
- a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
- See Also:
-
resolveResetPolicy
Resolves a named queue-length reset policy into its function.- Parameters:
policyName- "keep" (identity) or "clear" (empty the queues), case-insensitive- Returns:
- the reset function implementing the policy
- Throws:
RuntimeException- if the policy name is not recognised
-
keepResetPolicy
- Returns:
- the reset function of the "keep" policy: the queue lengths are unchanged
-
clearResetPolicy
- Returns:
- the reset function of the "clear" policy: all queues are emptied
-
getNodeFailures
- Returns:
- the node breakdown/repair descriptors recorded on this environment
-
findNodeFailure
Finds the node-failure descriptor for a node.- Returns:
- the index of the descriptor, or -1 when absent
-
registerNodeFailure
public void registerNodeFailure(String nodeName, Markovian breakdownDist, Markovian repairDist, Markovian downServiceDist, String breakdownPolicy, String repairPolicy) Attaches a node breakdown/repair descriptor to stages that already exist. This is the counterpart of addNodeBreakdown/addNodeRepair for the case where the UP and DOWN_<node> stages and their transitions have already been built (for instance by LineModelIO reading the expanded stages/transitions form). It records the descriptor and applies the queue-length reset policies, which the expanded form cannot carry.- Parameters:
nodeName- the node that breaks downbreakdownDist- the time-to-breakdown distributionrepairDist- the repair-time distribution, or null when no repair is defineddownServiceDist- the service distribution while downbreakdownPolicy- named breakdown reset policy ("keep" or "clear")repairPolicy- named repair reset policy ("keep" or "clear")
-
getStageTable
Returns a table of stage information for this environment. Matches MATLAB Environment.getStageTable() which returns a Table with columns: Stage, Name, Type, Prob, HoldT, Model.- Returns:
- a formatted string table of stage information
-
getStageT
Short alias for getStageTable.- Returns:
- a formatted string table of stage information
- See Also:
-