#include <eoVRP.h>
Inheritance diagram for eoVRP:

Public Member Functions | |
| eoVRP () | |
| Default constructor: initializes variables to safe values. | |
| eoVRP (const eoVRP &_orig) | |
| Copy contructor: creates a new individual from a given one. | |
| virtual | ~eoVRP () |
| Default destructor: nothing to do here. | |
| eoVRP & | operator= (const eoVRP &_orig) |
| Performs a copy from the invidual passed as argument. | |
| virtual std::string | className () const |
| Returns a string containing the name of the class. | |
| void | printOn (std::ostream &_os) const |
| Prints the individual to a given stream. | |
| void | printAllOn (std::ostream &_os) const |
| Prints a detailed version of the individual (decoding information, unsatisfied contraints, etc. | |
| void | readFrom (std::istream &_is) |
| Reads an individual from a given stream. | |
| const Routes & | routes () |
| Returns a reference to the decoded individual. | |
| double | length () |
| Returns the total cost (length) of traveling all the routes. | |
| void | printRoutes (std::ostream &_os) const |
| Aux. | |
| void | printRoute (std::ostream &_os, unsigned _p) const |
| Aux. | |
| bool | clean () |
| Cleans the individual (the vector of clients and also the decoding information). | |
| bool | cleanRoutes () |
| Invalidates the decoding information (usually after crossover or mutation). | |
| bool | decoded () const |
| Has this individual been decoded? | |
| bool | encode (Routes &_routes) |
| Encodes an individual from a set of routes (usually used within crossover). | |
| double | decode () |
| Decodes an individual in a set of routes and calculates its cost (length) of traveling. | |
Private Attributes | |
| Routes | mRoutes |
| A set of routes containing the decoding information of the individual. | |
| double | mLength |
| Cached cost (length) of traveling the set of routes defined by the individual. | |
Definition at line 50 of file eoVRP.h.
| eoVRP::eoVRP | ( | const eoVRP & | _orig | ) | [inline] |
Copy contructor: creates a new individual from a given one.
| _orig | The individual used to create the new one. |
Definition at line 68 of file eoVRP.h.
References operator=().
| virtual std::string eoVRP::className | ( | void | ) | const [inline, virtual] |
| void eoVRP::printOn | ( | std::ostream & | _os | ) | const [inline, virtual] |
Prints the individual to a given stream.
| _os | The stream to print to. |
Reimplemented from eoVector< eoMinimizingFitness, int >.
Definition at line 129 of file eoVRP.h.
References eoVector< FitT, GeneType >::printOn().
Referenced by decode().
| void eoVRP::printAllOn | ( | std::ostream & | _os | ) | const [inline] |
Prints a detailed version of the individual (decoding information, unsatisfied contraints, etc.
) to a given stream.
| _os | The stream to print to. |
Definition at line 146 of file eoVRP.h.
References decoded(), EO< F >::fitness(), eoVector< FitT, GeneType >::printOn(), and printRoutes().
| void eoVRP::readFrom | ( | std::istream & | _is | ) | [inline, virtual] |
Reads an individual from a given stream.
| _is | The stream to read from. |
Reimplemented from eoVector< eoMinimizingFitness, int >.
Definition at line 177 of file eoVRP.h.
References eoVector< FitT, GeneType >::readFrom().
| const Routes& eoVRP::routes | ( | ) | [inline] |
Returns a reference to the decoded individual.
Definition at line 190 of file eoVRP.h.
References mRoutes.
Referenced by eoVRPGenericCrossover::operator()().
| double eoVRP::length | ( | ) | [inline] |
Returns the total cost (length) of traveling all the routes.
Definition at line 205 of file eoVRP.h.
References mLength.
Referenced by eoVRPEvalFunc::operator()().
| void eoVRP::printRoutes | ( | std::ostream & | _os | ) | const [inline] |
Aux.
method to print a structure of routes.
| _os | The stream to print to. |
Definition at line 217 of file eoVRP.h.
References mRoutes, and printRoute().
Referenced by printAllOn().
| void eoVRP::printRoute | ( | std::ostream & | _os, | |
| unsigned | _p | |||
| ) | const [inline] |
Aux.
method to print only one route.
| _os | The stream to print to. | |
| _p | The route to print. |
Definition at line 244 of file eoVRP.h.
References mRoutes.
Referenced by printRoutes().
| bool eoVRP::clean | ( | ) | [inline] |
Cleans the individual (the vector of clients and also the decoding information).
Definition at line 267 of file eoVRP.h.
References mLength, and mRoutes.
Referenced by encode(), eoVRPEdgeCrossover::operator()(), and operator=().
| bool eoVRP::cleanRoutes | ( | ) | [inline] |
Invalidates the decoding information (usually after crossover or mutation).
Definition at line 283 of file eoVRP.h.
References mLength, and mRoutes.
Referenced by decode(), eoVRPOnePointCrossover::operator()(), and eoVRPMutation::operator()().
| bool eoVRP::decoded | ( | ) | const [inline] |
Has this individual been decoded?
Definition at line 298 of file eoVRP.h.
References mRoutes.
Referenced by eoVRPEvalFunc::operator()(), and printAllOn().
| bool eoVRP::encode | ( | Routes & | _routes | ) | [inline] |
Encodes an individual from a set of routes (usually used within crossover).
Definition at line 313 of file eoVRP.h.
References clean().
Referenced by eoVRPGenericCrossover::operator()().
| double eoVRP::decode | ( | ) | [inline] |
Decodes an individual in a set of routes and calculates its cost (length) of traveling.
Definition at line 334 of file eoVRP.h.
References cleanRoutes(), eoVRPUtils::clients, eoVRPUtils::distance(), eoVRPUtils::getTimeWindow(), mLength, mRoutes, and printOn().
Referenced by eoVRPEvalFunc::operator()().
1.4.7