Similarity-based Grouping Genetic Algorithm Group. More...
#include <sgga.h>
Classes | |
class | OrderBySim |
Public Member Functions | |
RGroupSG (RGroupSG *grp) | |
RGroupSG (cGroups *owner, const size_t id) | |
virtual void | Clear (void) |
bool | HasSameUser (const cObj *obj) const |
virtual bool | CanInsert (const cObj *obj) |
virtual void | PostInsert (const cObj *obj) |
virtual void | PostDelete (const cObj *obj) |
double | GetLastMaxSim (void) const |
cObj * | GetCentroid (void) |
void | Evaluate (double &dist, double &agree, double &disagree) |
void | SetCentroid (cObj *obj) |
double | GetAvgIntraSim (void) |
double | ComputeRelSim (const cObj *obj) |
virtual void | CopyInfos (const cGroup *grp) |
bool | DoOptimisation (cObj **objs, size_t &nbobjs) |
virtual | ~RGroupSG (void) |
Public Member Functions inherited from RGroup< cGroup, cObj, cGroups > | |
RGroup (RGroup *grp) | |
RGroup (cGroups *owner, const size_t id) | |
virtual void | Verify (void) |
void | Insert (cObj *obj) |
void | Delete (cObj *obj) |
virtual bool | PreInsertAll (const cGroup *from) |
virtual bool | PreDeleteAll (void) |
virtual bool | IsCompatible (const cObj *obj) |
virtual bool | CanDelete (const cObj *obj) |
size_t | GetId (void) const |
size_t | GetNbObjs (void) const |
size_t | GetObjsPos (void) const |
RCursor< cObj > | GetObjs (void) const |
bool | IsIn (const size_t id) const |
bool | CommonObjs (const cGroup *grp) const |
virtual bool | IsCompatible (const cGroup *grp) const |
bool | SameObjs (const cGroup *grp) const |
size_t * | GetObjectsId (void) const |
int | Compare (const cGroup &grp) const |
cObj * | GetObjPos (const size_t pos) |
virtual | ~RGroup (void) |
Protected Attributes | |
double | AvgIntraSim |
double | AvgAgreement |
double | AvgDisagreement |
cObj * | Centroid |
bool | ToEval |
double | LastMaxSim |
Protected Attributes inherited from RGroup< cGroup, cObj, cGroups > | |
size_t | Id |
cGroups * | Owner |
size_t | SubObjects |
size_t | NbSubObjects |
bool | Reserved |
Private Member Functions | |
double | ComputeSumSim (cObj *obj) |
void | ComputeCentroid (void) |
bool | Test (cObj **del, size_t &nbdel, cObj *obj1, cObj *obj2) |
Detailed Description
template<class cGroup, class cObj, class cGroups>
singleton R::RGroupSG< cGroup, cObj, cGroups >
Similarity-based Grouping Genetic Algorithm Group.
The RGroupSG provides a representation for a group for the similarity-based grouping genetic algorithm.
Constructor & Destructor Documentation
Construct the group.
- Parameters
-
grp Group used as source.
RGroupSG | ( | cGroups * | owner, |
const size_t | id | ||
) |
Construct the group.
- Parameters
-
owner Owner of the group. id Identifier of the group.
|
virtual |
Destruct the group.
Member Function Documentation
|
virtual |
Clear the information container in a group.
Reimplemented from RGroup< cGroup, cObj, cGroups >.
bool HasSameUser | ( | const cObj * | obj | ) | const |
Verify if an object has the same parent as another object of the group.
- Parameters
-
obj Pointer to the object to insert.
|
virtual |
Look if an object can be insert in the group. In practice, the object must have a minimum similarity and maximum disagreement with the objects of the group. Moreover, two objects having the same parents cannot be grouped together. not allowed.
- Parameters
-
obj Object to insert.
Reimplemented from RGroup< cGroup, cObj, cGroups >.
|
virtual |
Method call after an object was inserted in the group.
- Parameters
-
obj Object to insert.
Reimplemented from RGroup< cGroup, cObj, cGroups >.
|
virtual |
Method call after an object was deleted from the group.
- Parameters
-
obj Object to delete.
Reimplemented from RGroup< cGroup, cObj, cGroups >.
double GetLastMaxSim | ( | void | ) | const |
Get the maximum similarity with the last object called with CanInsert.
|
private |
Compute the sum of the similarities of a given object to all the others. If the object is itself in the group, '1.0' is added to the sum.
- Parameters
-
obj Object.
|
private |
Compute the centroid of the group, i.a. the object which is the most similar to all the other objects.
cObj* GetCentroid | ( | void | ) |
- Returns
- the centroid of the group.
void Evaluate | ( | double & | dist, |
double & | agree, | ||
double & | disagree | ||
) |
Compute the sum of the average intra-similarity of the objects and the average of the agreement and disagreement. objects.
- Parameters
-
dist Sum of the average intra-similarity. agree Sum of the average agreement ratios. disagree Sum of the average disagreement ratios.
void SetCentroid | ( | cObj * | obj | ) |
Set the centroid of the group. This method must be used with caution.
- Parameters
-
obj Object becoming the centroid.
double GetAvgIntraSim | ( | void | ) |
- Returns
- the average intra-similarity of the group.
double ComputeRelSim | ( | const cObj * | obj | ) |
Compute the similarity of a given object to the centroid of the group.
- Parameters
-
obj Object.
|
virtual |
Copy internal information from a given group, in particular information that are computer (such as an average similarity inside the group).
- Parameters
-
grp The group used as source.
|
private |
bool DoOptimisation | ( | cObj ** | objs, |
size_t & | nbobjs | ||
) |
Try to optimize the group by exchanging a given number of objects no assigned with some of the group.
- Parameters
-
objs Objects no assigned. nbobjs Number of objects (can be modified).
- Returns
- true if the group could be optimized.
Member Data Documentation
|
protected |
Average similarity between each object and the centroid.
|
protected |
Average agreement ratio between the objects of the group.
|
protected |
Average disagreement ratio between the object of the group.
|
protected |
Centroid of the group.
|
protected |
Must the group be re-evaluated?
|
protected |
Maximum similarity with the last object called by CanInsert.