Implements a probabilistic acceptance criterion for candidate solutions.
More...
#include <metropolis.h>
|
| Metropolis (double T) |
|
| ~Metropolis () |
|
bool | accept_reject (double cost_new, double cost_old) |
| Returns a bool whether to accept the candidate solution. More...
|
|
bool | operator() (double cost_new, double cost_old) |
| Calls the accept_reject function Accepts the candidate solution based on the function: /code double w = std::min(1.0, exp(-1.0*(cost_new - cost_old)*beta)); double r = (*random_num)(); return w >= r; /endcode. More...
|
|
Implements a probabilistic acceptance criterion for candidate solutions.
pallas::internal::Metropolis::Metropolis |
( |
double |
T | ) |
|
|
inline |
Constructor
- Parameters
-
T | double. "Temperature" –higher temperatures will result in higher cost functions being accepted with higher probability. |
pallas::internal::Metropolis::~Metropolis |
( |
| ) |
|
|
inline |
bool pallas::internal::Metropolis::accept_reject |
( |
double |
cost_new, |
|
|
double |
cost_old |
|
) |
| |
|
inline |
Returns a bool whether to accept the candidate solution.
Accepts the candidate solution based on the function: /code double w = std::min(1.0, exp(-1.0*(cost_new - cost_old)*beta)); double r = (*random_num)(); return w >= r; /endcode
- Parameters
-
cost_new | double. cost of the candidate solution. |
cost_old | cost of the current solution. |
- Returns
- Bool whether the candidate solution was accepted.
bool pallas::internal::Metropolis::operator() |
( |
double |
cost_new, |
|
|
double |
cost_old |
|
) |
| |
|
inline |
Calls the accept_reject function Accepts the candidate solution based on the function: /code double w = std::min(1.0, exp(-1.0*(cost_new - cost_old)*beta)); double r = (*random_num)(); return w >= r; /endcode.
- Parameters
-
cost_new | double. cost of the candidate solution. |
cost_old | cost of the current solution. |
- Returns
- Bool whether the candidate solution was accepted.
The documentation for this class was generated from the following file: