Class GreedySolution

Inheritance Relationships

Base Type

Class Documentation

class GreedySolution : public Solution

Public Functions

GreedySolution(const std::vector<Node> &nodes, const std::vector<Vehicle> &vehicles, const std::vector<std::vector<double>> &distanceMatrix)

Constructor.

Constructor for initial setup of problem, and solution using greedy algorithm

Return
No return parameter
Parameters
  • nodes: Vector of nodes
  • vehicles: Vector of vehicles
  • distanceMatrix: Matrix containing distance between each pair of nodes

GreedySolution(const Problem &p)

Constructor.

Constructor for initial setup of problem, and solution using greedy algorithm

Return
No return parameter
Parameters
  • p: Instance of Problem class defining the problem parameters

void Solve()

Function called to solve the given problem using a greedy algorithm.

Generates random iniitial solutions. Applies selected algorithm. Prints cost of best solution, and its validity.

Return
void