oILAB
Loading...
Searching...
No Matches
EvolutionAlgorithmImplementation.h
Go to the documentation of this file.
1//
2// Created by Nikhil Chandra Admal on 8/14/24.
3//
4
5#ifndef OILAB_EVOLUTIONALGORITHMIMPLEMENTATION_H
6#define OILAB_EVOLUTIONALGORITHMIMPLEMENTATION_H
7
8#include <randomInteger.h>
9#include <OrderedTuplet.h>
10#include <CanonicalTP.h>
11#include <LandauWangTP.h>
12#include <GbMesoState.h>
13
14namespace gbLAB {
15 template<typename StateType, typename SystemType, typename TransitionProbabilityType>
17 transitionProbability(static_cast<TransitionProbabilityType &>(*this))
18 { }
19
20 template<typename StateType, typename SystemType, typename TransitionProbabilityType>
21 bool EvolutionAlgorithm<StateType, SystemType, TransitionProbabilityType>::acceptMove(const std::pair<StateType,SystemType>& proposedStateSystem,
22 const std::pair<StateType,SystemType>& currentStateSystem) const
23 {
24 double probability = transitionProbability.probability(proposedStateSystem,currentStateSystem);
25 if (random<double>(0.0, 1.0) <= probability)
26 return true;
27 else
28 return false;
29 }
30
31}
32#endif
bool acceptMove(const std::pair< StateType, SystemType > &proposedStateSystem, const std::pair< StateType, SystemType > &currentStateSystem) const