Class Solution¶
- Defined in File utils.hpp
Inheritance Relationships¶
Derived Types¶
public GASolution
(Class GASolution)public GreedySolution
(Class GreedySolution)public LocalSearchInterIntraSolution
(Class LocalSearchInterIntraSolution)public LocalSearchIntraSolution
(Class LocalSearchIntraSolution)public SimulatedAnnealingSolution
(Class SimulatedAnnealingSolution)public TabuSearchSolution
(Class TabuSearchSolution)
Class Documentation¶
-
class
Solution
¶ Subclassed by GASolution, GreedySolution, LocalSearchInterIntraSolution, LocalSearchIntraSolution, SimulatedAnnealingSolution, TabuSearchSolution
Public Functions
-
Solution
(std::vector<Node> nodes, const std::vector<Vehicle> &vehicles, std::vector<std::vector<double>> distanceMatrix)¶ Constructor.
Constructor for solution struct
- Return
- no return type
- Parameters
nodes
: Vector of all nodesvehicles
: Vector of vehiclesdistanceMatrix
: Matrix containing distance between each pair of nodes
-
Solution
(const Problem &p)¶ Constructor.
Constructor for solution struct
- Return
- no return type
- Parameters
p
: Instance of Problem struct defining the problem parameters
-
Solution
(const Solution &s)¶ Copy constructor.
- Return
- no return value
- Parameters
s
: object to be copied
-
Solution &
operator=
(const Solution &s)¶ Copy assignment.
- Return
- solution object
- Parameters
s
: object to be copied
-
Solution &
operator=
(Solution &&s)¶ Move assignment.
- Return
- solution object
- Parameters
s
: object to be moved
-
virtual
~Solution
()¶ Destructor.
- Return
- no return value
-
void
CreateInitialSolution
()¶ Creates initial solution.
Creates initial solution, currently set to greedy.
- Return
- void
-
bool
CheckSolutionValid
() const¶ Check whether the solution is valid.
Check whether the solution is valid by checking whether all the nodes are reached and whether the total edmand of all the nodes on any of the routes exceed the capacity of the respective vehicles
- Return
- bool True is solution is valid
-
virtual void
Solve
() = 0¶ Virtual function overloaded by solution structes to solve the given problem.
Virtual function overloaded by solution struct to solve the given problem.
- Return
- void
-
std::tuple<bool, Node>
find_closest
(const Vehicle &v) const¶ find closest node
Finds the node nearest to the last node in the route of the vehicle under constideration that has not been routed already
- Return
- tuple containing bool as to whether a Node was found and the nearest node
- Parameters
v
: vehicle under consideration
-
void
PrintSolution
(const std::string &option = "") const¶ Prints the status of solution.
Prints the solution status including cost, the vehicle status, and solution validity
- Return
- void
- Parameters
option
: allows the option to print routes or vehicle statuses
-