Class SimulatedAnnealingSolution

Inheritance Relationships

Base Type

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 nodes
  • vehicles: Vector of vehicles
  • distanceMatrix: Matrix containing distance between each pair of nodes
  • stag_limit: Number of iterations without an improvement to the best solution
  • init_temp: Initial temperature
  • cooling_rate: tempertaure multiplies with this variable to get the new temperature at every iteration
  • n_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 parameters
  • stag_limit: Number of iterations without an improvement to the best solution
  • init_temp: Initial temperature
  • cooling_rate: tempertaure multipluies with this variable to get new temperature at every iteration
  • n_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 parameters
  • stag_limit: Number of iterations without an improvement to the best solution
  • init_temp: Initial temperature
  • cooling_rate: tempertaure multipluies with this variable to get new temperature at every iteration
  • n_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