- Main Page
- Namespaces
- Classes
- Files

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# eoVRP Class Reference

Defines the getoype used to solve the VRP-TW problem. More...

`#include <eoVRP.h>`

Inheritance diagram for eoVRP:

List of all members.

## 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.

## Detailed Description

Defines the getoype used to solve the VRP-TW problem.

Definition at line 50 of file eoVRP.h.

## Constructor & Destructor Documentation

eoVRP::eoVRP | ( | const eoVRP & | _orig | ) | `[inline]`

Copy contructor: creates a new individual from a given one.

Parameters:

  | _orig | The individual used to create the new one.

Definition at line 68 of file eoVRP.h.

References operator=().

## Member Function Documentation

eoVRP& eoVRP::operator= | ( | const eoVRP & | _orig | ) | `[inline]`

Performs a copy from the invidual passed as argument.

Parameters:

  | _orig | The individual to copy from.

Returns:
  A reference to this.

Definition at line 90 of file eoVRP.h.

References clean(), mLength, and mRoutes.

Referenced by eoVRP().

virtual std::string eoVRP::className | ( | void |  | ) | const`[inline, virtual]`

Returns a string containing the name of the class.

Returns:
  The string containing the name of the class.

Reimplemented from EO< F >.

Definition at line 117 of file eoVRP.h.

void eoVRP::printOn | ( | std::ostream & | _os | ) | const`[inline, virtual]`

Prints the individual to a given stream.

Parameters:

  | _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.

Parameters:

  | _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.

Parameters:

  | _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.

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.

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.

Parameters:

  | _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.

Parameters:

  | _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).

Returns:
  True if the operation finishes correctly. False otherwise.

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).

Returns:
  True if the operation finishes correctly. False otherwise.

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?

Returns:
  True if has decoding information. False otherwise.

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).

Returns:
  True if the operation finishes correctly. False otherwise.

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.

Returns:
  The cost (length) of traveling the set of routes.

Definition at line 334 of file eoVRP.h.

References cleanRoutes(), eoVRPUtils::clients, eoVRPUtils::distance(), eoVRPUtils::getTimeWindow(), mLength, mRoutes, and printOn().

Referenced by eoVRPEvalFunc::operator()().

The documentation for this class was generated from the following file:

- eoVRP.h