Program Listing for File simulated_annealing.hpp¶
↰ Return to documentation for file (include/cvrp/simulated_annealing.hpp
)
#ifndef SA_HPP
#define SA_HPP
#include "cvrp/utils.hpp"
class SimulatedAnnealingSolution : public Solution {
public:
SimulatedAnnealingSolution(
const std::vector<Node>& nodes, const std::vector<Vehicle>& vehicles,
const std::vector<std::vector<double>>& distanceMatrix,
const int stag_limit = 500000, const double init_temp = 5000,
const double cooling_rate = 0.9999, const int n_reheats = 20);
explicit SimulatedAnnealingSolution(const Problem& p,
const int stag_limit = 500000,
const double init_temp = 5000,
const double cooling_rate = 0.9999,
const int n_reheats = 20);
explicit SimulatedAnnealingSolution(const Solution& s,
int stag_limit = 500000,
double init_temp = 5000,
double cooling_rate = 0.9999,
const int n_reheats = 20);
void Solve() override;
private:
const int stag_limit_;
const double init_temp_;
const double cooling_rate_;
const int n_reheats_;
inline static bool AllowMove(const double delta, const double temp);
};
#endif // SA_HPP