Class GASolution¶
- Defined in File genetic_algorithm.hpp
Inheritance Relationships¶
Base Type¶
public Solution
(Class Solution)
Class Documentation¶
-
class
GASolution
: public Solution¶ Public Functions
-
GASolution
(const std::vector<Node> &nodes, const std::vector<Vehicle> &vehicles, const std::vector<std::vector<double>> &distanceMatrix, const int n_chromosomes = 10, const int generations = 100)¶ Constructor.
Constructor for initial setup of problem, and solution using GA.
- Return
- No return parameter
- Parameters
nodes
: Vector of nodesvehicles
: Vector of vehiclesdistanceMatrix
: Matrix containing distance between each pair of nodesn_chromosomes
: Number of solutionsgenerations
: Number of generations the algorithm should run for
-
GASolution
(const Problem &p, const int n_chromosomes = 10, const int generations = 100)¶ Constructor.
Constructor
- Return
- No return parameter
- Parameters
p
: Instance of Problem class defining the problem parametersn_chromosomes
: Number of solutionsgenerations
: Number of generations the algorithm should run for
-
GASolution
(const Solution &s, const int n_chromosomes = 10, const int generations = 100)¶ Constructor.
Constructor
- Return
- No return parameter
- Parameters
s
: Instance of Solution class containing a valid solution and problem parametersn_chromosomes
: Number of solutionsgenerations
: Number of generations the algorithm should run for
-
void
Solve
()¶ Function called to solve the given problem using Genetic Algorithm.
Generates random iniitial solutions. Applies selected algorithm. Prints cost of best solution, and its validity.
- Return
- void
-