Djinni
2.2
|
A representation of information needed for the Traveling Salesman Problem. More...
#include <TSPRoute.h>
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 |
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.
Definition at line 32 of file TSPRoute.h.
A constructor that uses an already initialized World object.
w | A WorldType object |
Definition at line 36 of file TSPRoute.h.
A constructor that initializes a new WorldType.
worldParam | A char* containing parameters used to initialize a new object of type WorldType |
Definition at line 49 of file TSPRoute.h.
Virtualized for the benefit of future subclassing.
Definition at line 60 of file TSPRoute.h.
TSPRoute< WorldType >::TSPRoute | ( | const TSPRoute< WorldType > & | route | ) | [inline] |
Copy constructor.
route | The route to copy from. |
Definition at line 216 of file TSPRoute.h.
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().
std::ostream& TSPRoute< WorldType >::dump | ( | std::ostream & | os | ) | const [inline] |
Dump our current path to an output stream.
os | The output stream to dump our path to |
Definition at line 233 of file TSPRoute.h.
void TSPRoute< WorldType >::generateNeighbor | ( | TSPRoute< WorldType > & | neighbor | ) | [inline] |
Generates a neighbor TSPRoute from this current TSPRoute.
neighbor | The 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().
double TSPRoute< WorldType >::getF | ( | ) | const [inline] |
Returns the Feasible component of the solution
Definition at line 72 of file TSPRoute.h.
Referenced by TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().
double TSPRoute< WorldType >::getP | ( | ) | const [inline] |
Returns the Penalty component of the solution
Definition at line 76 of file TSPRoute.h.
Referenced by TSPRoute< WorldType >::generateNeighbor().
void TSPRoute< WorldType >::randomize | ( | ) | [inline] |
Randomize this TSPRoute.
Definition at line 205 of file TSPRoute.h.
void TSPRoute< WorldType >::setF | ( | const double & | f | ) | [inline] |
Sets the Feasible component of the solution
f | The new feasible component |
Definition at line 64 of file TSPRoute.h.
Referenced by TSPRoute< WorldType >::compute(), TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().
void TSPRoute< WorldType >::setP | ( | const double & | p | ) | [inline] |
Sets the Penalty component of the solution
p | The new penalty component |
Definition at line 68 of file TSPRoute.h.
Referenced by TSPRoute< WorldType >::compute(), TSPRoute< WorldType >::generateNeighbor(), and TSPRoute< WorldType >::update().
void TSPRoute< WorldType >::timingUpdate | ( | ) | [inline, protected] |
Update the travel schedule.
Definition at line 283 of file TSPRoute.h.
Referenced by TSPRoute< WorldType >::update().
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().