java.lang.Object
org.bigraphs.framework.simulation.modelchecking.ModelCheckingStrategySupport<B>
org.bigraphs.framework.simulation.modelchecking.SimulatedAnnealingFrontierStrategy<B>
- Type Parameters:
B- the type of bigraph elements processed by this strategy
- All Implemented Interfaces:
ModelCheckingStrategy<B>
public abstract class SimulatedAnnealingFrontierStrategy<B extends Bigraph<? extends Signature<?>>>
extends ModelCheckingStrategySupport<B>
This class is an abstraction of a model checking strategy
based on the Simulated Annealing algorithm.
This strategy is implemented using a cooling schedule, which helps in controlling the temperature of the annealing process. The temperature influences the probability of moving to a state of lower quality, allowing the algorithm to potentially escape local optima in the search space.
When computing state (bigraph) similarity via a kernel, the normalized kernel will be computed by this strategy afterward (kTilde(Bigraph, Bigraph).
The class is designed to be extended and requires subclasses to provide implementations for some specific methods such as:
graphKernel(Bigraph, Bigraph): Calculation of a graph kernel for computing similarity between two bigraphsSimulatedAnnealingFrontierStrategy.CoolingSchedules: Default implementations are provided such as linear, geometric and logarithmic cooling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface representing a cooling schedule used in simulated annealing processes.Nested classes/interfaces inherited from class org.bigraphs.framework.simulation.modelchecking.ModelCheckingStrategySupport
ModelCheckingStrategySupport.MatchResult<B extends Bigraph<? extends Signature<?>>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intCachesprotected doubleprotected final intCool temperature afterniterations of an epoch before starting a new epoch.protected intprotected final intFairness: every fairnessK expansions, do one FIFO expansion.Frontier as fairness queueGoal prototype statesprotected booleanprotected intintprotected doubleState variables of the SA algorithmsFields inherited from class org.bigraphs.framework.simulation.modelchecking.ModelCheckingStrategySupport
decoder, encoder, isRunning, logger, modelChecker, occurrenceCounter, predicateChecker, worklistFilter -
Constructor Summary
ConstructorsConstructorDescriptionSimulatedAnnealingFrontierStrategy(List<B> goalExemplars, double initialTemperature, int epochSize, int fairnessK) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToWorklist(Collection<B> worklist, B bigraph) protected BboltzmannPick(Collection<B> worklist, double t) protected doubleprotected doublegraphKernel(B graphA, B graphB) A bigraph kernel (e.g., Weisfeiler–Lehman) over the encoded graphs.protected doubleNormalized bigraph kernel for two bigraphs.protected BpopExistingInOpenFiFo(Collection<B> worklist) removeNext(Collection<B> worklist) Called when the framework wants the next state to expand.protected voidstopProcedure(B chosen) withModelChecker(BigraphModelChecker<B> modelChecker) Methods inherited from class org.bigraphs.framework.simulation.modelchecking.ModelCheckingStrategySupport
evaluatePredicates, getBigraphMatches, resetOccurrenceCounter, setFilter, synthesizeTransitionSystem
-
Field Details
-
energyEps
protected double energyEps -
internalStop
protected volatile boolean internalStop -
fairnessK
protected final int fairnessKFairness: every fairnessK expansions, do one FIFO expansion. -
epochSize
protected final int epochSizeCool temperature afterniterations of an epoch before starting a new epoch. -
goalExemplars
Goal prototype states -
fifoQueue
Frontier as fairness queue -
energyCache
Caches -
temperature
protected double temperatureState variables of the SA algorithms -
iterationInEpoch
protected int iterationInEpoch -
currentEpoch
protected int currentEpoch -
maxEpoch
public int maxEpoch -
fairnessCounter
protected int fairnessCounter
-
-
Constructor Details
-
SimulatedAnnealingFrontierStrategy
-
-
Method Details
-
withCooling
public SimulatedAnnealingFrontierStrategy<B> withCooling(SimulatedAnnealingFrontierStrategy.CoolingSchedule c) -
withModelChecker
-
createWorklist
- Specified by:
createWorklistin classModelCheckingStrategySupport<B extends Bigraph<? extends Signature<?>>>
-
removeNext
Called when the framework wants the next state to expand. State is picked from worklist using either fairness FIFO or SA Boltzmann sampling.- Specified by:
removeNextin classModelCheckingStrategySupport<B extends Bigraph<? extends Signature<?>>>
-
stopProcedure
-
addToWorklist
- Specified by:
addToWorklistin classModelCheckingStrategySupport<B extends Bigraph<? extends Signature<?>>>
-
graphKernel
A bigraph kernel (e.g., Weisfeiler–Lehman) over the encoded graphs. Return a non-negative similarity value. -
kTilde
Normalized bigraph kernel for two bigraphs.The specific kernel specified in
graphKernel(Bigraph, Bigraph)must be implemented via subclassing.- Parameters:
s- left bigraphg- right bigraph
-
popExistingInOpenFiFo
-
boltzmannPick
-
energy
-