Generic GGA instance. More...
#include <rinstg.h>
Public Member Functions | |
RInstG (size_t popsize, RCursor< cObj > objs, const RString &h, const RString &name, RDebug *debug=0) | |
virtual void | Init (void) |
RString | GetHeuristic (void) const |
bool | MustLocalOptimisation (void) const |
void | SetLocalOptimisation (bool localopti) |
bool | GetEmptyModifiedGroups (void) const |
void | SetEmptyModifiedGroups (bool empty) |
RCursor< cObj > | GetObjs (void) const |
virtual RGroupingHeuristic < cGroup, cObj, cChromo > * | CreateHeuristic (void) |
virtual void | AnalyzePop (void) |
virtual void | RandomConstruct (void) |
virtual void | Crossover (void) |
virtual void | Mutation (void) |
virtual void | Inversion (void) |
virtual | ~RInstG (void) |
Public Member Functions inherited from RInst< cInst, cChromo, cFit, cThreadData > | |
RInst (size_t popsize, const RString &name, RDebug *debug=0) | |
virtual RCString | GetClassName (void) const |
void | SetMutationParams (size_t agemut, size_t agebestmut, size_t nbmut) |
void | SetVerify (bool verify) |
bool | GetVerify (void) const |
bool | MustOptimisation (void) const |
void | SetOptimisation (bool opti) |
cChromo * | GetBestChromosome (void) const |
void | SetSeed (int seed) |
int | GetSeed (void) const |
virtual void | PostEvaluate (void) |
virtual bool | StopCondition (void)=0 |
virtual void | PostRun (void) |
virtual void | DisplayInfos (void) |
virtual void | StrongMutation (void) |
void | Generation (void) |
virtual void | Run (void) |
virtual void | Verify (void) |
virtual void | HandlerNotFound (const RNotification ¬ification) |
long | RRand (long max) |
template<class T > | |
void | RandOrder (T *array, size_t size) |
virtual | ~RInst (void) |
Public Member Functions inherited from RObject | |
RObject (const RString &name=RString::Null) | |
int | Compare (const RObject &obj) const |
RString | GetName (void) const |
void | PostNotification (const hNotification handle) |
void | PostNotification (const RCString &name) |
void | PostNotification (const hNotification handle, T data) |
void | PostNotification (const RCString &name, T data) |
void | InsertObserver (tNotificationHandler handler, const hNotification handle, RObject *object) |
void | InsertObserver (tNotificationHandler handler, const RCString &name, RObject *object) |
void | InsertObserver (tNotificationHandler handler, const hNotification handle) |
void | InsertObserver (tNotificationHandler handler, const RCString &name) |
void | InsertObserver (tNotificationHandler handler, RObject *object) |
void | InsertObserver (tNotificationHandler handler) |
void | DeleteObserver (void) |
void | DeleteObserver (const hNotification handle, RObject *object) |
void | DeleteObserver (const RCString &name, RObject *object) |
hNotification | GetNotificationHandle (const RCString &name) const |
RCString | GetNotificationName (const hNotification handle) const |
virtual | ~RObject (void) |
Public Member Functions inherited from iRInst | |
size_t | GetPopSize (void) const |
size_t | GetGen (void) const |
size_t | GetAgeBest (void) const |
size_t | GetAgeBestPop (void) const |
virtual | ~iRInst (void) |
Protected Attributes | |
RString | Heuristic |
bool | EmptyModifiedGroups |
RContainer< cObj, false, false > | Objs |
size_t | MaxGroups |
bool | DoLocalOptimisation |
Protected Attributes inherited from RInst< cInst, cChromo, cFit, cThreadData > | |
cThreadData ** | thDatas |
bool | bRandomConstruct |
bool | VerifyGA |
bool | DoPostEvaluation |
bool | DoOptimisation |
Protected Attributes inherited from RObject | |
RString | Name |
Protected Attributes inherited from iRInst | |
size_t | PopSize |
size_t | Gen |
size_t | AgeBest |
size_t | AgeBestPop |
bool | Pause |
Additional Inherited Members | |
Static Public Member Functions inherited from RInst< cInst, cChromo, cFit, cThreadData > | |
static int | sort_function_cChromosome (const void *a, const void *b) |
Public Attributes inherited from RInst< cInst, cChromo, cFit, cThreadData > | |
RDebug * | Debug |
RRandom | Random |
cChromo ** | Chromosomes |
cChromo ** | Ranked |
cChromo * | BestChromosome |
cChromo * | BestInPop |
Static Public Attributes inherited from RInst< cInst, cChromo, cFit, cThreadData > | |
static const char | instMaster =0 |
static const char | instSlave =1 |
static const char | instMultiProcess =2 |
static const char | instMultiComputers =4 |
static const char | instMultiEchos =8 |
Protected Member Functions inherited from iRInst | |
iRInst (size_t popsize) | |
Detailed Description
template<class cInst, class cChromo, class cFit, class cThreadData, class cGroup, class cObj>
class R::RInstG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >
Generic GGA instance.
Generic instance for a GGA.
Constructor & Destructor Documentation
RInstG | ( | size_t | popsize, |
RCursor< cObj > | objs, | ||
const RString & | h, | ||
const RString & | name, | ||
RDebug * | debug = 0 |
||
) |
Construct the instance.
- Parameters
-
popsize Size of the population. objs Objects to groups. h Name of the heuristic that has to be used. name Name of the genetic algorithm. debug Debugger.
|
virtual |
Destruct the instance.
Member Function Documentation
|
virtual |
Initialization of the instance.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
Reimplemented in RInstSG< cInst, cChromo, cThreadData, cGroup, cObj >.
RString GetHeuristic | ( | void | ) | const |
Return the heuristic type.
bool MustLocalOptimisation | ( | void | ) | const |
Look if a local optimization is performed.
- Returns
- true or false.
void SetLocalOptimisation | ( | bool | localopti | ) |
Set if a local optimization must be done or not. By default, the GGA does local optimization.
- Parameters
-
localopti Perform local optimization?
bool GetEmptyModifiedGroups | ( | void | ) | const |
Look if the groups containing objects that are also contained in groups inserted during a crossover must be completely emptied.
- Returns
- true if the groups must be emptied.
void SetEmptyModifiedGroups | ( | bool | empty | ) |
Set if the groups containing objects that are also contained in groups inserted during a crossover must be completely emptied.
- Parameters
-
empty If true, the groups must be emptied.
RCursor<cObj> GetObjs | ( | void | ) | const |
Get the Objects to group.
- Returns
- Pointer to the objects.
|
virtual |
Create a heuristic object. By default, a first-fit heuristic is created.
Reimplemented in RInstSG< cInst, cChromo, cThreadData, cGroup, cObj >, and RInstNN< cInst, cChromo, cThreadData, cGroup, cObj >.
|
virtual |
Analyze the population to find the best chromosome of the population and to verify if the best chromosome ever calculated has to replaced. When needed, the chromosomes are evaluated.
This method handles the chromosomes that are representing the same solutions. If two same chromosomes are detect, one of them is replace a random based one with a probability of 90%.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
|
virtual |
Random construction of the chromosomes. Call the method of RInst and handles the same solutions after.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
|
virtual |
This function does the crossovers for a generation. Call the method of RInst and handles the same solutions after.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
|
virtual |
This function does the necessary mutations for a generation. Call the method of RInst and handles the same solutions after.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
|
virtual |
This function does the necessary inversions for a generation. Call the method of RInst and handles the same solutions after.
Reimplemented from RInst< cInst, cChromo, cFit, cThreadData >.
Member Data Documentation
|
protected |
Name of the heuristic used.
|
protected |
Determine if the groups modified during a crossover must be emptied, or only the existing objects should be removed.
|
protected |
Objects to group.
|
protected |
Maximal number of groups to allocate by default.
|
protected |
Must a local optimization be performed.