Class Environment
-
- All Implemented Interfaces:
-
java.io.Serializable
public class Environment extends Ensemble
An environment model defined by a collection of network sub-models coupled with an environment transition rule that selects the active sub-model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEnvironment.ResetQueueLengthsFunctionpublic interfaceEnvironment.ResetEnvRatesFunction
-
Field Summary
Fields Modifier and Type Field Description public final Array<Array<Markovian>>envpublic Array<Array<MatrixCell>>procpublic Array<MatrixCell>holdTimepublic MatrixprobEnvpublic MatrixprobOrigpublic Array<Array<Environment.ResetQueueLengthsFunction>>resetQLFunpublic Array<Array<Environment.ResetEnvRatesFunction>>resetEnvRatesFunprotected List<Network>ensemble
-
Constructor Summary
Constructors Constructor Description Environment(String name, int numStages)
-
Method Summary
Modifier and Type Method Description voidaddStage(int stageIdx, String name, String type, Network model)Adds a network model to a specific stage of the environment. voidaddTransition(int fromStageIdx, int toStageIdx, Markovian distrib)Adds a transition between two stages with default reset function (identity). voidaddTransition(int fromStageIdx, int toStageIdx, Markovian distrib, Environment.ResetQueueLengthsFunction resetFun)Adds a transition between two stages with a custom reset function. voidaddTransition(int fromStageIdx, int toStageIdx, Markovian distrib, Environment.ResetQueueLengthsFunction resetFun, Environment.ResetEnvRatesFunction resetEnvRatesFun)Adds a transition between two stages with custom reset functions for both queue lengths and environment rates. voidinit()voidprintStageTable()Prints a formatted table showing all stages, their properties, and transitions. voidaddNodeBreakdown(Network baseModel, String nodeName, Markovian breakdownDist, Markovian downServiceDist)Adds a breakdown stage for a specific node in the network. voidaddNodeBreakdown(Network baseModel, Node node, Markovian breakdownDist, Markovian downServiceDist)Adds a breakdown stage for a specific node in the network. 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, Environment.ResetQueueLengthsFunction resetFun)Adds a breakdown stage for a specific node with a custom reset policy. voidaddNodeRepair(String nodeName, Markovian repairDist)Adds a repair transition from DOWN to UP stage for a previously added breakdown. voidaddNodeRepair(Node node, Markovian repairDist)Adds a repair transition from DOWN to UP stage for a previously added breakdown. voidaddNodeRepair(String nodeName, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun)Adds a repair transition with a custom reset policy. voidaddNodeRepair(Node node, Markovian repairDist, Environment.ResetQueueLengthsFunction resetFun)Adds a repair transition 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, Node node, 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, 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, Environment.ResetQueueLengthsFunction resetBreakdown, Environment.ResetQueueLengthsFunction resetRepair)Adds both breakdown and repair for a node with custom reset policies. voidsetBreakdownResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun)Sets the 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, Environment.ResetQueueLengthsFunction resetFun)Sets the 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. Map<String, Double>getReliabilityTable()Computes system-wide reliability metrics (MTTF, MTTR, MTBF, Availability). Map<String, Double>relT()Short alias for getReliabilityTable. Map<String, Double>getRelT()Short alias for getReliabilityTable. Map<String, Double>relTable()Short alias for getReliabilityTable. Map<String, Double>getRelTable()Short alias for getReliabilityTable. -
Methods inherited from class jline.lang.Ensemble
getEnsemble, getModel, merge, merge, setEnsemble, size, toNetwork -
Methods inherited from class jline.lang.Model
getName, getVersion, setName, setVersion -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Environment
Environment(String name, int numStages)
-
-
Method Detail
-
addStage
void addStage(int stageIdx, String name, String type, Network model)
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
-
addTransition
void addTransition(int fromStageIdx, int toStageIdx, Markovian distrib)
Adds a transition between two stages with default reset function (identity).
- Parameters:
fromStageIdx- the source stage indextoStageIdx- the destination stage indexdistrib- the Markovian distribution governing this transition
-
addTransition
void addTransition(int fromStageIdx, int toStageIdx, Markovian 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 Markovian distribution governing this transitionresetFun- function to apply when transitioning to reset queue lengths
-
addTransition
void addTransition(int fromStageIdx, int toStageIdx, Markovian 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 Markovian distribution governing this transitionresetFun- function to apply when transitioning to reset queue lengthsresetEnvRatesFun- function to apply when transitioning to reset environment rates
-
init
void init()
-
printStageTable
void printStageTable()
Prints a formatted table showing all stages, their properties, and transitions. Displays stage names, types, associated networks, and transition rates.
-
addNodeBreakdown
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
-
addNodeBreakdown
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
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
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
-
addNodeRepair
void addNodeRepair(String nodeName, Markovian repairDist)
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)
-
addNodeRepair
void addNodeRepair(Node node, Markovian repairDist)
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
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
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
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
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
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
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
void setBreakdownResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun)
Sets the reset policy for queue lengths when a node breaks down.
- Parameters:
nodeName- the name of the noderesetFun- function to reset queue lengths: resetFun(q) -> q_new Common policies: - input -> input (keep all jobs, default) - input -> input.
-
setBreakdownResetPolicy
void setBreakdownResetPolicy(Node node, Environment.ResetQueueLengthsFunction resetFun)
Sets the reset policy for queue lengths when a node breaks down. Overload that accepts a Node object instead of a node name.
- Parameters:
node- the noderesetFun- function to reset queue lengths: resetFun(q) -> q_new
-
setRepairResetPolicy
void setRepairResetPolicy(String nodeName, Environment.ResetQueueLengthsFunction resetFun)
Sets the reset policy for queue lengths when a node is repaired.
- Parameters:
nodeName- the name of the noderesetFun- function to reset queue lengths: resetFun(q) -> q_new
-
setRepairResetPolicy
void setRepairResetPolicy(Node node, Environment.ResetQueueLengthsFunction resetFun)
Sets the reset policy for queue lengths when a node is repaired. Overload that accepts a Node object instead of a node name.
- Parameters:
node- the noderesetFun- function to reset queue lengths: resetFun(q) -> q_new
-
getReliabilityTable
Map<String, Double> getReliabilityTable()
Computes system-wide reliability metrics (MTTF, MTTR, MTBF, Availability). This method 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
-
relT
Map<String, Double> relT()
Short alias for getReliabilityTable.
- Returns:
a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
-
getRelT
Map<String, Double> getRelT()
Short alias for getReliabilityTable.
- Returns:
a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
-
relTable
Map<String, Double> relTable()
Short alias for getReliabilityTable.
- Returns:
a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
-
getRelTable
Map<String, Double> getRelTable()
Short alias for getReliabilityTable.
- Returns:
a Map containing reliability metrics (MTTF, MTTR, MTBF, Availability)
-
-
-
-