Class SimulatedAnnealingSolution¶
- Defined in File simulated_annealing.hpp
Inheritance Relationships¶
Base Type¶
public Solution(Class Solution)
Class Documentation¶
-
class
SimulatedAnnealingSolution: public Solution¶ Public Functions
-
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)¶ Constructor.
Constructor for initial setup of problem, and solution using Simulated Annealing Algorithm
- Return
- No return parameter
- Parameters
nodes: Vector of nodesvehicles: Vector of vehiclesdistanceMatrix: Matrix containing distance between each pair of nodesstag_limit: Number of iterations without an improvement to the best solutioninit_temp: Initial temperaturecooling_rate: tempertaure multiplies with this variable to get the new temperature at every iterationn_reheats: number of reheats
-
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)¶ Constructor.
Constructor for initial setup of problem, and solution using Simulated Annealing Algorithm
- Return
- No return parameter
- Parameters
p: Instance of Problem class defining the problem parametersstag_limit: Number of iterations without an improvement to the best solutioninit_temp: Initial temperaturecooling_rate: tempertaure multipluies with this variable to get new temperature at every iterationn_reheats: number of reheats
-
SimulatedAnnealingSolution(const Solution &s, int stag_limit = 500000, double init_temp = 5000, double cooling_rate = 0.9999, const int n_reheats = 20)¶ Constructor.
Constructor for initial setup of problem, and solution using Simulated Annealing Algorithm
- Return
- No return parameter
- Parameters
s: Instance of Solution class containing a valid solution and problem parametersstag_limit: Number of iterations without an improvement to the best solutioninit_temp: Initial temperaturecooling_rate: tempertaure multipluies with this variable to get new temperature at every iterationn_reheats: number of reheats
-
void
Solve()¶ Function called to solve the given problem using a simulated annealing algorithm.
Generates random iniitial solutions. Applies selected algorithm. Prints cost of best solution, and its validity.
- Return
- void
-