12 #ifndef MLPACK_CORE_OPTIMIZERS_SA_SA_HPP
13 #define MLPACK_CORE_OPTIMIZERS_SA_SA_HPP
20 namespace optimization {
60 template<
typename CoolingScheduleType = ExponentialSchedule>
80 SA(CoolingScheduleType& coolingSchedule,
81 const size_t maxIterations = 1000000,
82 const double initT = 10000.,
83 const size_t initMoves = 1000,
84 const size_t moveCtrlSweep = 100,
85 const double tolerance = 1e-5,
86 const size_t maxToleranceSweep = 3,
87 const double maxMoveCoef = 20,
88 const double initMoveCoef = 0.3,
89 const double gain = 0.3);
101 template<
typename FunctionType>
102 double Optimize(FunctionType&
function, arma::mat& iterate);
130 double Gain()
const {
return gain; }
132 double&
Gain() {
return gain; }
141 CoolingScheduleType& coolingSchedule;
143 size_t maxIterations;
149 size_t moveCtrlSweep;
153 size_t maxToleranceSweep;
177 template<
typename FunctionType>
178 void GenerateMove(FunctionType&
function,
184 size_t& sweepCounter);
204 void MoveControl(
const size_t nMoves, arma::mat& accept, arma::mat& moveSize);
210 #include "sa_impl.hpp"
size_t & MaxIterations()
Modify the maximum number of iterations.
Simulated Annealing is an stochastic optimization algorithm which is able to deliver near-optimal res...
double & Gain()
Modify the gain.
SA(CoolingScheduleType &coolingSchedule, const size_t maxIterations=1000000, const double initT=10000., const size_t initMoves=1000, const size_t moveCtrlSweep=100, const double tolerance=1e-5, const size_t maxToleranceSweep=3, const double maxMoveCoef=20, const double initMoveCoef=0.3, const double gain=0.3)
Construct the SA optimizer with the given parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Gain() const
Get the gain.
size_t & MoveCtrlSweep()
Modify sweeps per move control.
double Optimize(FunctionType &function, arma::mat &iterate)
Optimize the given function using simulated annealing.
size_t MoveCtrlSweep() const
Get sweeps per move control.
size_t InitMoves() const
Get the initial moves.
double Tolerance() const
Get the tolerance.
size_t MaxToleranceSweep() const
Get the maxToleranceSweep.
double & Tolerance()
Modify the tolerance.
size_t & InitMoves()
Modify the initial moves.
size_t & MaxToleranceSweep()
Modify the maxToleranceSweep.
size_t MaxIterations() const
Get the maximum number of iterations.
double Temperature() const
Get the temperature.
double & Temperature()
Modify the temperature.