NNGGA Heuristic. More...

#include <rheuristicnn.h>

Inheritance diagram for RHeuristicNN< cGroup, cObj, cGroups >:
[legend]
Collaboration diagram for RHeuristicNN< cGroup, cObj, cGroups >:
[legend]

Public Member Functions

 RHeuristicNN (R::RRandom &r, R::RCursor< cObj > objs, RParamsNN *params, R::RDebug *debug=0)
 
virtual void Init (cGroups *groups)
 
virtual cGroup * FindGroup (cObj *obj)
 
virtual void PostRun (void)
 
- Public Member Functions inherited from RGroupingHeuristic< cGroup, cObj, cGroups >
 RGroupingHeuristic (const RString &n, RRandom &r, RCursor< cObj > objs, RDebug *debug=0)
 
const RString GetName (void) const
 
virtual void BuildOrder (void)
 
void Run (cGroups *groups)
 
bool IsEnd (void)
 
size_t GetNbObjsOk (void)
 
long RRand (long max)
 
template<class T >
void RandOrder (T *arr, size_t size)
 
virtual ~RGroupingHeuristic (void)
 

Private Attributes

RContainer< cGroup, false, false > ToDel
 
RContainer< cObj, false, false > ToReAssign
 
RParamsNNParams
 
RContainer< Local, true, false > NbNearestNeighbors
 
size_t NbPossibleGrps
 

Additional Inherited Members

- Protected Attributes inherited from RGroupingHeuristic< cGroup, cObj, cGroups >
RString Name
 
RRandomRandom
 
RCursor< cObj > Objs
 
size_t NbObjs
 
size_t NbObjsOk
 
cGroups * Groups
 
cObj ** Order
 
RDebugDebug
 

Detailed Description

template<class cGroup, class cObj, class cGroups>
class R::RHeuristicNN< cGroup, cObj, cGroups >

NNGGA Heuristic.

The RHeuristicNN class provides a specific heuristic for the Nearest Neighbors Grouping Genetic Algorithm.

Article:
 Nearest Neighbors Grouping Genetic Algorithm

Constructor & Destructor Documentation

RHeuristicNN ( R::RRandom r,
R::RCursor< cObj >  objs,
RParamsNN params,
R::RDebug debug = 0 
)

Construct the heuristic.

Parameters
rThe random generator to use.
objsPointer to the objects.
paramsParameters.
debugDebugger.

Member Function Documentation

virtual void Init ( cGroups *  groups)
virtual

Initialize the heuristic.

Parameters
groupsPointer to the groups.

Reimplemented from RGroupingHeuristic< cGroup, cObj, cGroups >.

virtual cGroup* FindGroup ( cObj *  obj)
virtual

Find a group for the next object.

Parameters
objObject.

Implements RGroupingHeuristic< cGroup, cObj, cGroups >.

virtual void PostRun ( void  )
virtual

Verify that no social object is alone and that all the groups has to minimum number of objects.

Reimplemented from RGroupingHeuristic< cGroup, cObj, cGroups >.

Member Data Documentation

RContainer<cGroup,false,false> ToDel
private

Groups to delete because they contain only one "social" object.

RContainer<cObj,false,false> ToReAssign
private

Objects to reassigned.

RParamsNN* Params
private

Parameters of the SCGA.

RContainer<Local,true,false> NbNearestNeighbors
private

Container that count the number of nearest neighbors

size_t NbPossibleGrps
private

Hold the number of possible groups for all objects to group.