|
openjij
Framework for the Ising model and QUBO.
|
Class for executing simulated annealing. More...
#include <sa_sampler.hpp>
Public Member Functions | |
| SASampler (const ModelType &model) | |
| Constructor for SASampler class. | |
| void | SetNumSweeps (const std::int32_t num_sweeps) |
| Set the number of sweeps. | |
| void | SetNumReads (const std::int32_t num_reads) |
| Set the number of samples. | |
| void | SetNumThreads (const std::int32_t num_threads) |
| Set the number of threads in the calculation. | |
| void | SetBetaMin (const ValueType beta_min) |
| Set the minimum inverse temperature. | |
| void | SetBetaMax (const ValueType beta_max) |
| Set the minimum inverse temperature. | |
| void | SetBetaMinAuto () |
| Set the minimum inverse temperature automatically. | |
| void | SetBetaMaxAuto () |
| Set the maximum inverse temperature automatically. | |
| void | SetUpdateMethod (const algorithm::UpdateMethod update_method) |
| Set update method used in the state update. | |
| void | SetRandomNumberEngine (const algorithm::RandomNumberEngine random_number_engine) |
| Set random number engine for updating initializing state. | |
| void | SetTemperatureSchedule (const utility::TemperatureSchedule schedule) |
| Set the cooling schedule. | |
| const ModelType & | GetModel () const |
| Get the model. | |
| std::int32_t | GetNumSweeps () const |
| Get the number of sweeps. | |
| std::int32_t | GetNumReads () const |
| Get the number of reads. | |
| std::int32_t | GetNumThreads () const |
| Get the number of threads. | |
| ValueType | GetBetaMin () const |
| Get the minimum inverse temperature. | |
| ValueType | GetBetaMax () const |
| Get the maximum inverse temperature. | |
| algorithm::UpdateMethod | GetUpdateMethod () const |
| Get the update method used in the state update. | |
| algorithm::RandomNumberEngine | GetRandomNumberEngine () const |
| Get the random number engine for updating and initializing state. | |
| utility::TemperatureSchedule | GetTemperatureSchedule () const |
| Get the temperature schedule. | |
| std::uint64_t | GetSeed () const |
| Get the seed to be used in the calculation. | |
| const std::vector< typename ModelType::IndexType > & | GetIndexList () const |
| const std::vector< std::vector< VariableType > > & | GetSamples () const |
| Get the samples. | |
| std::vector< ValueType > | CalculateEnergies () const |
| void | Sample () |
| Execute sampling. Seed to be used in the calculation will be set automatically. | |
| void | Sample (const std::uint64_t seed) |
| Execute sampling. | |
Private Types | |
| using | ValueType = typename ModelType::ValueType |
| The value type. | |
| using | VariableType = typename ModelType::VariableType |
| The variable type. | |
Private Member Functions | |
| template<typename RandType> | |
| std::vector< std::pair< typename RandType::result_type, typename RandType::result_type > > | GenerateSeedPairList (const typename RandType::result_type seed, const std::int32_t num_reads) const |
| template<class SystemType, class RandType> | |
| void | TemplateSampler () |
Private Attributes | |
| const ModelType | model_ |
| The model. | |
| std::int32_t | num_sweeps_ = 1000 |
| The number of sweeps. | |
| std::int32_t | num_reads_ = 1 |
| The number of reads (samples). | |
| std::int32_t | num_threads_ = 1 |
| The number of threads in the calculation. | |
| ValueType | beta_min_ = 1 |
| The start inverse temperature. | |
| ValueType | beta_max_ = 1 |
| The end inverse temperature. | |
| algorithm::UpdateMethod | update_method_ = algorithm::UpdateMethod::METROPOLIS |
| The update method used in the state update. | |
| algorithm::RandomNumberEngine | random_number_engine_ = algorithm::RandomNumberEngine::XORSHIFT |
| Random number engine for updating and initializing state. | |
| utility::TemperatureSchedule | schedule_ = utility::TemperatureSchedule::GEOMETRIC |
| Cooling schedule. | |
| std::uint64_t | seed_ = std::random_device()() |
| The seed to be used in the calculation. | |
| std::vector< std::vector< VariableType > > | samples_ |
| The samples. | |
Class for executing simulated annealing.
| ModelType | The type of models. |
|
private |
The value type.
|
private |
The variable type.
|
inline |
|
inline |
References model_, num_reads_, and samples_.
|
inlineprivate |
|
inline |
|
inline |
|
inline |
References model_.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the random number engine for updating and initializing state.
References random_number_engine_.
|
inline |
|
inline |
|
inline |
|
inline |
Get the update method used in the state update.
References update_method_.
|
inline |
|
inline |
Execute sampling.
| seed | The seed to be used in the calculation. |
References openjij::algorithm::MT, openjij::algorithm::MT_64, num_reads_, random_number_engine_, samples_, seed_, TemplateSampler(), and openjij::algorithm::XORSHIFT.

|
inline |
Set the minimum inverse temperature.
| beta_max | The minimum inverse temperature, which must be larger than zero. |
References beta_max_.
|
inline |
|
inline |
Set the minimum inverse temperature.
| beta_min | The minimum inverse temperature, which must be larger than zero. |
References beta_min_.
|
inline |
|
inline |
Set the number of samples.
| num_reads | The number of samples, which must be larger than zero. |
References num_reads_.
|
inline |
Set the number of sweeps.
| num_sweeps | The number of sweeps, which must be larger than zero. |
References num_sweeps_.
|
inline |
Set the number of threads in the calculation.
| num_threads | The number of threads in the calculation, which must be larger than zero. |
References num_threads_.
|
inline |
Set random number engine for updating initializing state.
| random_number_engine | The random number engine. |
References random_number_engine_.
|
inline |
|
inline |
Set update method used in the state update.
| update_method | The update method. |
References update_method_.
|
inlineprivate |
References beta_max_, beta_min_, openjij::utility::GenerateBetaList(), GenerateSeedPairList(), model_, num_reads_, num_sweeps_, samples_, schedule_, seed_, openjij::updater::SingleFlipUpdater(), and update_method_.
Referenced by Sample().


|
private |
The end inverse temperature.
Referenced by GetBetaMax(), SetBetaMax(), SetBetaMaxAuto(), and TemplateSampler().
|
private |
The start inverse temperature.
Referenced by GetBetaMin(), SetBetaMin(), SetBetaMinAuto(), and TemplateSampler().
|
private |
The model.
Referenced by CalculateEnergies(), GetIndexList(), GetModel(), SASampler(), SetBetaMaxAuto(), SetBetaMinAuto(), and TemplateSampler().
|
private |
The number of reads (samples).
Referenced by CalculateEnergies(), GetNumReads(), Sample(), SetNumReads(), and TemplateSampler().
|
private |
The number of sweeps.
Referenced by GetNumSweeps(), SetNumSweeps(), and TemplateSampler().
|
private |
The number of threads in the calculation.
Referenced by GetNumThreads(), and SetNumThreads().
|
private |
Random number engine for updating and initializing state.
Referenced by GetRandomNumberEngine(), Sample(), and SetRandomNumberEngine().
|
private |
The samples.
Referenced by CalculateEnergies(), GetSamples(), Sample(), and TemplateSampler().
|
private |
Cooling schedule.
Referenced by GetTemperatureSchedule(), SetTemperatureSchedule(), and TemplateSampler().
|
private |
The seed to be used in the calculation.
Referenced by GetSeed(), Sample(), and TemplateSampler().
|
private |
The update method used in the state update.
Referenced by GetUpdateMethod(), SetUpdateMethod(), and TemplateSampler().