public interface IStateCoder
To be able to efficiently explore a design space, a state that has been explored before through an other trajectory needs to be recognized and ignored accordingly.
This is done by generating a pseudo-unique value (object) that is only depended on the relevant parts of the model's internal state, that is, the values of two states can only be equal if the states themselves can be considered equal.
The processing engine however assumes, that any two states that share this pseudo-unique value has the same characteristics, meaning they have the same amount and type of outgoing transitions available, and firing the appropriate transitions from both states also result in states that share their pseudo-unique identifier. If this condition is not satisfied, the exploration process's result will be non-deterministic, and in consequence, solutions can be lost.
In addition to providing pseudo-unique identifiers to model states, the state coder must provide pseud-unique identifiers to the outgoing transitions as well, but they only need to be unique on the scope of the particular state, not globally. Global addressing thus can be achieved by considering the pseudo-unique identifier of the state and the pseudo-unique identifier of the transition together if needed.
Both identifiers can be arbitrary objects, and equality is checked by calling Object.equals(Object)
on the
two identifiers.
For any particular implementation an IStateCoderFactory
implementation must also be supplied that handles the
creation of IStateCoder
instances.
Usually it is unnecessary to represent everything from the model in a state code, only the parts which are modified by the transformation rules.
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
createActivationCode(org.eclipse.viatra.query.runtime.api.IPatternMatch match)
Returns a pseudo-unique identifier that describes the given
IPatternMatch in the context of the
underlying model's current internal state. |
java.lang.Object |
createStateCode()
Returns a pseudo-unique identifier that describes the underlying model's current internal state.
|
void |
init(org.eclipse.emf.common.notify.Notifier notifier)
Initializes the state coder on the given model.
|
void init(org.eclipse.emf.common.notify.Notifier notifier)
notifier
- java.lang.Object createStateCode()
Object
that can be used as the identifier.java.lang.Object createActivationCode(org.eclipse.viatra.query.runtime.api.IPatternMatch match)
IPatternMatch
in the context of the
underlying model's current internal state.Object
that can be used as the identifier in the given state.