Class State
-
- All Implemented Interfaces:
-
java.io.Serializable
public class State implements Serializable
Class modeling the state of Stateful nodes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
State.EventHandleResult
Result class for event handling methods
public class
State.StateMarginalStatistics
public class
State.StateSpaceGeneratorResult
public class
State.spaceGeneratorNodesResult
-
Field Summary
Fields Modifier and Type Field Description public final Map<StatefulNode, Matrix>
initialState
public final Map<StatefulNode, Matrix>
priorInitialState
public final Map<StatefulNode, Matrix>
initialStateSpace
-
Constructor Summary
Constructors Constructor Description State(Map<StatefulNode, Matrix> initialState, Map<StatefulNode, Matrix> priorInitialState, Map<StatefulNode, Matrix> initialStateSpace)
-
Method Summary
Modifier and Type Method Description static Ret.EventResult
afterEvent(NetworkStruct sn, int ind, Matrix inspace, EventType event, int jobClass, boolean isSimulation)
static Ret.EventResult
afterEvent(NetworkStruct sn, int ind, Matrix inspace, EventType event, int jobClass, boolean isSimulation, EventCache eventCache)
static Ret.EventResult
afterEventHashed(NetworkStruct sn, int ind, double inhash, EventType event, int Jobclass)
static Ret.afterEventHashedOrAddResult
afterEventHashedOrAdd(NetworkStruct sn, int ind, int inhash, EventType event, int jobclass)
Combination of afterEventHashed with automatic state space extension Migrated from MATLAB afterEventHashedOrAdd. static State.EventHandleResult
handleEnableEvent(NetworkStruct sn, int ind, GlobalSync glevent, List<Matrix> glspace, List<Matrix> outglspace, Matrix inspace, Matrix spaceBuf, Matrix spaceSrv, Matrix spaceVar, Matrix fK, Matrix fKs, int mode, TransitionNodeParam transParam, int R)
Handles ENABLE events for transitions in Stochastic Petri Net (SPN) event processing. static State.EventHandleResult
handleFireEvent(NetworkStruct sn, int ind, GlobalSync glevent, List<Matrix> glspace, List<Matrix> outglspace, Matrix inspace, Matrix spaceBuf, Matrix spaceSrv, Matrix spaceVar, Matrix fK, Matrix fKs, int mode, TransitionNodeParam transParam, int R)
Handles FIRE events for transitions in Stochastic Petri Net (SPN) event processing. static Ret.getHashOrAddResult
getHashOrAdd(NetworkStruct sn, int ind, Matrix inspace)
Get hash ID for a state space, or add the state to the space if not found Migrated from MATLAB getHashOrAdd. static boolean
isValid(Network sn, Matrix n, Matrix s)
static boolean
isValid(NetworkStruct sn, Matrix n, Matrix s)
static Ret.reachableSpaceGeneratorResult
reachableSpaceGenerator(NetworkStruct sn, SolverOptions options)
Generates state space restricted to states reachable from initial state Migrated from MATLAB reachableSpaceGenerator. static Matrix
spaceCachePublic(int n, Matrix m)
Make spaceCache method public Generates cache state space static Matrix
spaceClosedMulti(int M, Matrix N)
static Matrix
spaceClosedMultiCS(int M, Matrix N, Matrix chains)
static Matrix
spaceClosedSinglePublic(int M, int N)
Make spaceClosedSingle method public Generates state space for single-class closed networks static State.StateSpaceGeneratorResult
spaceGenerator(NetworkStruct sn, Matrix cutoff, SolverOptions options)
Generates the state space for a queueing network using a matrix cutoff. static State.spaceGeneratorNodesResult
spaceGeneratorNodes(NetworkStruct sn, Matrix cutoff, SolverOptions options)
static Matrix
spaceLocalVarsPublic(NetworkStruct sn, int ind)
Make spaceLocalVars method public Generates local variable state spaces -
-
Constructor Detail
-
State
State(Map<StatefulNode, Matrix> initialState, Map<StatefulNode, Matrix> priorInitialState, Map<StatefulNode, Matrix> initialStateSpace)
-
-
Method Detail
-
afterEvent
static Ret.EventResult afterEvent(NetworkStruct sn, int ind, Matrix inspace, EventType event, int jobClass, boolean isSimulation)
-
afterEvent
static Ret.EventResult afterEvent(NetworkStruct sn, int ind, Matrix inspace, EventType event, int jobClass, boolean isSimulation, EventCache eventCache)
-
afterEventHashed
static Ret.EventResult afterEventHashed(NetworkStruct sn, int ind, double inhash, EventType event, int Jobclass)
-
afterEventHashedOrAdd
static Ret.afterEventHashedOrAddResult afterEventHashedOrAdd(NetworkStruct sn, int ind, int inhash, EventType event, int jobclass)
Combination of afterEventHashed with automatic state space extension Migrated from MATLAB afterEventHashedOrAdd.m
- Parameters:
sn
- Network structureind
- Node indexinhash
- Input hash IDevent
- Event typejobclass
- Job class- Returns:
Ret.afterEventHashedOrAddResult containing output hash, rate, probability and updated network
-
handleEnableEvent
static State.EventHandleResult handleEnableEvent(NetworkStruct sn, int ind, GlobalSync glevent, List<Matrix> glspace, List<Matrix> outglspace, Matrix inspace, Matrix spaceBuf, Matrix spaceSrv, Matrix spaceVar, Matrix fK, Matrix fKs, int mode, TransitionNodeParam transParam, int R)
Handles ENABLE events for transitions in Stochastic Petri Net (SPN) event processing. This method processes the enabling phase of a transition firing, which checks if the transition can be enabled based on available tokens in input places and generates all possible state combinations when the transition becomes enabled. It implements the SPN semantics for transition enabling with support for multiple job classes and server allocation.
- Parameters:
sn
- Network structure containing the complete SPN model definitionind
- Node index of the transition being processedglevent
- Global synchronization event containing active and passive eventsglspace
- Current global state space (list of states for each stateful node)outglspace
- Output global state space to be updatedinspace
- Input state space matrix for the transition nodespaceBuf
- Buffer state space matrix (job queue states)spaceSrv
- Server state space matrix (server allocation states)spaceVar
- Variable state space matrix (phase variables)fK
- Firing phases matrix for the transitionfKs
- Cumulative firing phases matrixmode
- Current firing mode of the transitiontransParam
- Transition node parameters containing enabling/firing rulesR
- Number of job classes in the network
-
handleFireEvent
static State.EventHandleResult handleFireEvent(NetworkStruct sn, int ind, GlobalSync glevent, List<Matrix> glspace, List<Matrix> outglspace, Matrix inspace, Matrix spaceBuf, Matrix spaceSrv, Matrix spaceVar, Matrix fK, Matrix fKs, int mode, TransitionNodeParam transParam, int R)
Handles FIRE events for transitions in Stochastic Petri Net (SPN) event processing. This method processes the firing phase of a transition after it has been enabled, implementing the complete SPN firing semantics including: - Calculating the enabling degree (maximum number of concurrent firings) - Processing PRE events (token consumption from input places) - Processing POST events (token production to output places) - Managing server state transitions and phase changes - Generating all possible outcome states with their associated rates and probabilities The method supports multiple job classes, multi-server environments, and complex firing patterns through multinomial probability distributions for server allocation.
- Parameters:
sn
- Network structure containing the complete SPN model definitionind
- Node index of the transition being firedglevent
- Global synchronization event containing active and passive eventsglspace
- Current global state space (list of states for each stateful node)outglspace
- Output global state space to be updatedinspace
- Input state space matrix for the transition nodespaceBuf
- Buffer state space matrix (job queue states)spaceSrv
- Server state space matrix (server allocation states)spaceVar
- Variable state space matrix (phase variables)fK
- Firing phases matrix for the transitionfKs
- Cumulative firing phases matrixmode
- Current firing mode of the transitiontransParam
- Transition node parameters containing enabling/firing rulesR
- Number of job classes in the network
-
getHashOrAdd
static Ret.getHashOrAddResult getHashOrAdd(NetworkStruct sn, int ind, Matrix inspace)
Get hash ID for a state space, or add the state to the space if not found Migrated from MATLAB getHashOrAdd.m
- Parameters:
sn
- Network structureind
- Node indexinspace
- Input state space- Returns:
Ret.getHashOrAddResult containing hash IDs and updated network structure
-
isValid
static boolean isValid(NetworkStruct sn, Matrix n, Matrix s)
-
reachableSpaceGenerator
static Ret.reachableSpaceGeneratorResult reachableSpaceGenerator(NetworkStruct sn, SolverOptions options)
Generates state space restricted to states reachable from initial state Migrated from MATLAB reachableSpaceGenerator.m
- Parameters:
sn
- Network structureoptions
- Solver options- Returns:
Ret.reachableSpaceGeneratorResult containing reachable state spaces
-
spaceCachePublic
static Matrix spaceCachePublic(int n, Matrix m)
Make spaceCache method public Generates cache state space
- Parameters:
n
- Cache sizem
- Number of items- Returns:
Cache state space matrix
-
spaceClosedMulti
static Matrix spaceClosedMulti(int M, Matrix N)
-
spaceClosedMultiCS
static Matrix spaceClosedMultiCS(int M, Matrix N, Matrix chains)
-
spaceClosedSinglePublic
static Matrix spaceClosedSinglePublic(int M, int N)
Make spaceClosedSingle method public Generates state space for single-class closed networks
- Parameters:
M
- Number of stationsN
- Number of jobs- Returns:
State space matrix
-
spaceGenerator
static State.StateSpaceGeneratorResult spaceGenerator(NetworkStruct sn, Matrix cutoff, SolverOptions options)
Generates the state space for a queueing network using a matrix cutoff. Each element of the cutoff matrix specifies the maximum population for the corresponding station-class combination.
- Parameters:
sn
- Network structurecutoff
- Matrix of cutoff values with dimensions nstations × nclassesoptions
- Solver options- Returns:
State space generation result
-
spaceGeneratorNodes
static State.spaceGeneratorNodesResult spaceGeneratorNodes(NetworkStruct sn, Matrix cutoff, SolverOptions options)
-
spaceLocalVarsPublic
static Matrix spaceLocalVarsPublic(NetworkStruct sn, int ind)
Make spaceLocalVars method public Generates local variable state spaces
- Parameters:
sn
- Network structureind
- Node index- Returns:
Local variable state space
-
-
-
-