Djinni  2.2
Public Member Functions | Protected Member Functions | Protected Attributes
TSPRoute< WorldType > Class Template Reference

A representation of information needed for the Traveling Salesman Problem. More...

#include <TSPRoute.h>

Collaboration diagram for TSPRoute< WorldType >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TSPRoute (WorldType &w)
 TSPRoute (const char *worldParam)
virtual ~TSPRoute ()
void setF (const double &f)
void setP (const double &p)
double getF () const
double getP () const
void generateNeighbor (TSPRoute &neighbor)
void update ()
void randomize ()
 TSPRoute (const TSPRoute< WorldType > &route)
std::ostream & dump (std::ostream &os) const
void compute ()

Protected Member Functions

void timingUpdate ()

Protected Attributes

SHARED_PTR< WorldType > _w
std::vector< int > _solution
double _f
double _p
std::string _identifier
std::vector< double > _arrivaltime
std::vector< double > _penaltysum
double _time
double _cost
double _timeWait
u_int32_t _firstswitch
u_int32_t _secondswitch
u_int32_t _firstarrival
u_int32_t _firstpenalty

Detailed Description

template<class WorldType>
class TSPRoute< WorldType >

A representation of information needed for the Traveling Salesman Problem.

While many different WorldTypes can be used with TSPRoute, it has been most thoroughly tested with TSPTWWorld. Attempting to use other world types may shake loose some interesting bugs. Or they might not and our code could be perfect. We don't know. Don't panic, and have fun.

Author:
Hansen, Thiede
Since:
2.0

Definition at line 32 of file TSPRoute.h.


Constructor & Destructor Documentation

template<class WorldType>
TSPRoute< WorldType >::TSPRoute ( WorldType &  w) [inline]

A constructor that uses an already initialized World object.

Parameters:
wA WorldType object

Definition at line 36 of file TSPRoute.h.

template<class WorldType>
TSPRoute< WorldType >::TSPRoute ( const char *  worldParam) [inline]

A constructor that initializes a new WorldType.

Parameters:
worldParamA char* containing parameters used to initialize a new object of type WorldType

Definition at line 49 of file TSPRoute.h.

template<class WorldType>
virtual TSPRoute< WorldType >::~TSPRoute ( ) [inline, virtual]

Virtualized for the benefit of future subclassing.

Definition at line 60 of file TSPRoute.h.

template<class WorldType>
TSPRoute< WorldType >::TSPRoute ( const TSPRoute< WorldType > &  route) [inline]

Copy constructor.

Parameters:
routeThe route to copy from.

Definition at line 216 of file TSPRoute.h.


Member Function Documentation

template<class WorldType>
void TSPRoute< WorldType >::compute ( ) [inline]

Computes the feasible and penalty portions of this TSPRoute.

Definition at line 242 of file TSPRoute.h.

References TSPRoute< WorldType >::setF(), and TSPRoute< WorldType >::setP().

template<class WorldType>
std::ostream& TSPRoute< WorldType >::dump ( std::ostream &  os) const [inline]

Dump our current path to an output stream.

Parameters:
osThe output stream to dump our path to
Returns:
The output stream after we've dumped in it

Definition at line 233 of file TSPRoute.h.

template<class WorldType>
void TSPRoute< WorldType >::generateNeighbor ( TSPRoute< WorldType > &  neighbor) [inline]

Generates a neighbor TSPRoute from this current TSPRoute.

Parameters:
neighborThe TSPRoute object which will receive the value.

Definition at line 80 of file TSPRoute.h.

References Twister::generateDouble(), TSPRoute< WorldType >::getF(), TSPRoute< WorldType >::getP(), TSPRoute< WorldType >::setF(), TSPRoute< WorldType >::setP(), and TSPRoute< WorldType >::update().

template<class WorldType>
double TSPRoute< WorldType >::getF ( ) const [inline]

Returns the Feasible component of the solution

Returns:
The feasible component of the current solution

Definition at line 72 of file TSPRoute.h.

Referenced by TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().

template<class WorldType>
double TSPRoute< WorldType >::getP ( ) const [inline]

Returns the Penalty component of the solution

Returns:
the Penalty component of the current solution

Definition at line 76 of file TSPRoute.h.

Referenced by TSPRoute< WorldType >::generateNeighbor().

template<class WorldType>
void TSPRoute< WorldType >::randomize ( ) [inline]

Randomize this TSPRoute.

Definition at line 205 of file TSPRoute.h.

template<class WorldType>
void TSPRoute< WorldType >::setF ( const double &  f) [inline]

Sets the Feasible component of the solution

Parameters:
fThe new feasible component

Definition at line 64 of file TSPRoute.h.

Referenced by TSPRoute< WorldType >::compute(), TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().

template<class WorldType>
void TSPRoute< WorldType >::setP ( const double &  p) [inline]

Sets the Penalty component of the solution

Parameters:
pThe new penalty component

Definition at line 68 of file TSPRoute.h.

Referenced by TSPRoute< WorldType >::compute(), TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().

template<class WorldType>
void TSPRoute< WorldType >::timingUpdate ( ) [inline, protected]

Update the travel schedule.

Definition at line 283 of file TSPRoute.h.

Referenced by TSPRoute< WorldType >::update().

template<class WorldType>
void TSPRoute< WorldType >::update ( ) [inline]

Update schedules, member data, etc, based on current state.

Definition at line 147 of file TSPRoute.h.

References TSPRoute< WorldType >::getF(), TSPRoute< WorldType >::setF(), TSPRoute< WorldType >::setP(), and TSPRoute< WorldType >::timingUpdate().

Referenced by TSPRoute< WorldType >::generateNeighbor().


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