Layout. More...

#include <rlayout.h>

Inheritance diagram for RLayout:
[legend]
Collaboration diagram for RLayout:
[legend]

Public Member Functions

 RLayout (RProblem2D *prob, bool create)
 
void Boundary (RRect &rect)
 
void ClearInfos (void)
 
void Copy (const RLayout &infos, RGrid *grid)
 
RProblem2DGetProblem (void) const
 
RGeoInfooperator[] (size_t id)
 
const RGeoInfooperator[] (size_t id) const
 
const RGeoInfoGetBoard (void) const
 
void GetTab (RGeoInfo **tab)
 
RCursor< RGeoInfoGetInfos (void) const
 
size_t GetNbAggregators (void) const
 
RCursor< RGeoInfoConnectionGetConnections (void) const
 
RObj2DContainerGetNewAggregator (void)
 
void DestroyAggregators (void)
 
tCoord ComputeDist (RGeoInfo *info, bool weight, const RPoint &pos)
 
RGeoInfoGetMostConnected (RGeoInfo **order, size_t nbobjs, size_t nbok, bool weight)
 
void FillAggregator (RObj2DContainer *cont, bool *selected, RPromKernel *kernel, RRandom &random, bool weight)
 
tCoord ComputeConnections (bool weight)
 
RRect ComputeBoundary (void)
 
virtual ~RLayout (void)
 

Protected Attributes

RProblem2DProblem
 
RGeoInfo Board
 
RContainer< RGeoInfoConnection,
true, false > 
PlacedConnections
 
size_t NbAggregators
 

Private Member Functions

double ComputeWeight (RGeoInfo *info)
 
void GetBestsConnected (RGeoInfo *(&i1), RGeoInfo *(&i2), const RRect &bound, bool *selected, RPromKernel *kernel, RRandom &random, bool weight)
 
- Private Member Functions inherited from RContainer< RGeoInfo, true, false >
 RContainer (size_t m, size_t i=0)
 
 RContainer (const RContainer< RGeoInfo, true, false > &src)
 
 RContainer (const RContainer< RGeoInfo, false, false > &src)
 
int Compare (const RContainer< RGeoInfo, true, false > &) const
 
size_t GetNb (void) const
 
size_t GetMaxPos (void) const
 
size_t GetMaxNb (void) const
 
size_t GetIncNb (void) const
 
bool VerifyIndex (size_t idx) const
 
void VerifyTab (size_t max=0)
 
void Clear (size_t m=0, size_t i=0, bool force=false)
 
void ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max)
 
void ReOrder (int sortOrder(const void *, const void *))
 
void ReOrder (void)
 
void Exchange (size_t pos1, size_t pos2)
 
void Shift (size_t idx, bool reverse)
 
void Transfer (RContainer< RGeoInfo, a, o > &src)
 
RContaineroperator= (const RContainer< RGeoInfo, true, false > &src)
 
RContaineroperator= (const RContainer< RGeoInfo, false, false > &src)
 
void Copy (const RContainer< RGeoInfo, a, false > &src)
 
RContaineroperator+= (const RContainer< RGeoInfo, a, o > &src)
 
size_t GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, size_t min=0, size_t max=0) const
 
const RGeoInfooperator[] (size_t idx) const
 
RGeoInfooperator[] (size_t idx)
 
const RGeoInfoGetPtrAt (size_t idx) const
 
RGeoInfoGetPtrAt (size_t idx)
 
RGeoInfoGetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
RGeoInfoGetPtr (const TUse &tag, size_t min=0, size_t max=0) const
 
RGeoInfoGetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
RGeoInfoGetInsertPtr (const TUse &tag, size_t min=0, size_t max=0)
 
RGeoInfoGetInsertPtrAt (const TUse &tag, size_t pos)
 
RContainer< RGeoInfo, false,
false > * 
GetPtrs (const TUse &tag, size_t min=0, size_t max=0) const
 
size_t GetTab (const void **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (void **tab, size_t min=0, size_t max=0)
 
size_t GetTab (const RGeoInfo **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (RGeoInfo **tab, size_t min=0, size_t max=0)
 
void InsertPtrAt (RGeoInfo *ins, size_t pos, bool del)
 
void InsertPtrAt (RGeoInfo *ins, size_t pos)
 
void InsertPtr (RGeoInfo *ins, bool del=false, size_t min=0, size_t max=0)
 
void DeletePtrAt (size_t pos, bool shift, bool del)
 
void DeletePtrAt (size_t pos, bool shift)
 
void DeletePtrAt (size_t pos)
 
void DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, size_t min=0, size_t max=0)
 
void Inter (const iRContainer< RGeoInfo > &src1, const iRContainer< RGeoInfo > &src2)
 
void Union (const iRContainer< RGeoInfo > &src1, const iRContainer< RGeoInfo > &src2)
 
virtual ~RContainer (void)
 
- Private Member Functions inherited from iRContainer< C >
size_t GetNb (void) const
 
size_t GetMaxPos (void) const
 
size_t GetMaxNb (void) const
 
size_t GetIncNb (void) const
 
bool VerifyIndex (size_t idx) const
 
void VerifyTab (size_t max=0)
 
void Clear (size_t m=0, size_t i=0, bool force=false)
 
void ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max)
 
void ReOrder (int sortOrder(const void *, const void *))
 
void ReOrder (void)
 
void Exchange (size_t pos1, size_t pos2)
 
void Shift (size_t idx, bool reverse)
 
void Transfer (iRContainer< C > &src)
 
iRContaineroperator= (const iRContainer< C > &src)
 
void Copy (const iRContainer< C > &src)
 
iRContaineroperator+= (const iRContainer< C > &src)
 
size_t GetIndex (bool order, const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
size_t GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, size_t min=0, size_t max=0) const
 
const C * operator[] (size_t idx) const
 
C * operator[] (size_t idx)
 
const C * GetPtrAt (size_t idx) const
 
C * GetPtrAt (size_t idx)
 
C * GetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
C * GetPtr (const TUse &tag, size_t min=0, size_t max=0) const
 
C * GetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
C * GetInsertPtr (const TUse &tag, size_t min=0, size_t max=0)
 
C * GetInsertPtrAt (const TUse &tag, size_t pos)
 
size_t GetTab (const void **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (void **tab, size_t min=0, size_t max=0)
 
size_t GetTab (const C **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (C **tab, size_t min=0, size_t max=0)
 
void InsertPtrAt (C *ins, size_t pos, bool del)
 
void InsertPtrAt (C *ins, size_t pos)
 
void InsertPtr (C *ins, bool del=false, size_t min=0, size_t max=0)
 
void DeletePtrAt (size_t pos, bool shift, bool del)
 
void DeletePtrAt (size_t pos, bool shift)
 
void DeletePtrAt (size_t pos)
 
void DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, size_t min=0, size_t max=0)
 
void Inter (const iRContainer< C > &src1, const iRContainer< C > &src2)
 
void Union (const iRContainer< C > &src1, const iRContainer< C > &src2)
 
virtual ~iRContainer (void)
 
void Create (const iRContainer< C > &src)
 
iRContainerNormalCopy (const iRContainer< C > &src)
 
void DeepCopy (const iRContainer< C > &src)
 
iRContainerAdd (const iRContainer< C > &src)
 

Additional Inherited Members

- Static Private Member Functions inherited from RContainer< RGeoInfo, true, false >
static int SortOrder (const void *a, const void *b)
 
- Static Private Member Functions inherited from iRContainer< C >
static int SortOrder (const void *a, const void *b)
 
- Private Attributes inherited from iRContainer< C >
C ** Tab
 
size_t NbPtr
 
size_t MaxPtr
 
size_t LastPtr
 
size_t IncPtr
 

Detailed Description

Layout.

The RLayout class provides a representation for a given layout. In practice, the container holds several instances of RGeoInfo in a specific order:

  • NbObjs ones corresponding to the objects (RObj2D).
  • Eventually, several ones corresponding to aggregators (RObj2DContainer).

Constructor & Destructor Documentation

RLayout ( RProblem2D prob,
bool  create 
)

Construct the layout. A geometric information is created for each object and for the board.

Parameters
probThe instance of the problem.
createIf true, create the geometric information.
virtual ~RLayout ( void  )
virtual

Destruct the placement.

Member Function Documentation

void Boundary ( RRect rect)

Calculate the boundary rectangle of the layout.

Parameters
rectThe rectangle that will be hold the result.
void ClearInfos ( void  )

Clear the layout.

void Copy ( const RLayout infos,
RGrid grid 
)

Copy a layout.

Parameters
infosLayout.
gridGrid.
RProblem2D* GetProblem ( void  ) const
Returns
pointer to the problem to solve.
RGeoInfo* operator[] ( size_t  id)
Returns
the geometric information related to a given object.
Parameters
idIdentifier of the object.
const RGeoInfo* operator[] ( size_t  id) const
Returns
the geometric information related to a given object (const version).
Parameters
idIdentifier of the object.
const RGeoInfo* GetBoard ( void  ) const
Returns
the geometric information related to the board.
void GetTab ( RGeoInfo **  tab)

Fill an array with the layout.

Parameters
tabArray to fill (must have the correct size).
RCursor<RGeoInfo> GetInfos ( void  ) const
Returns
a cursor on the layout.
size_t GetNbAggregators ( void  ) const
Returns
the number of aggregators.
RCursor<RGeoInfoConnection> GetConnections ( void  ) const
Returns
a cursor over the placed connections.
RObj2DContainer* GetNewAggregator ( void  )
Returns
a new aggregator linked to the layout
void DestroyAggregators ( void  )

Destroy the aggregators (if any).

tCoord ComputeDist ( RGeoInfo info,
bool  weight,
const RPoint pos 
)
Returns
the distances of the connections for a given object. Eventually, the object is considered to be placed at a given position.
Parameters
infoObject.
weigthMust the weights of the connection be used to compute the distance.
posPosition where the object may be placed. If RPoint::Null, the method uses the current position.
double ComputeWeight ( RGeoInfo info)
private
Returns
the sum of the weights of the connections involving a given object and which are composed from at least one already placed object.
Parameters
infoObject.
void GetBestsConnected ( RGeoInfo *&  i1,
RGeoInfo *&  i2,
const RRect bound,
bool *  selected,
RPromKernel kernel,
RRandom random,
bool  weight 
)
private

Determine the two objects that :

  • have the most connected objects;
  • are in a given rectangle;
  • are not selected.
    Parameters
    i1Pointer to the first object.
    i2Pointer to the second object.
    boundRectangle.
    selectedWhich objects are selected.
    kernelPROMETHEE kernel used.
    randomRandom number generator.
    weigthMust the weights of the connection be used to compute the distance.
RGeoInfo* GetMostConnected ( RGeoInfo **  order,
size_t  nbobjs,
size_t  nbok,
bool  weight 
)
Returns
the object that is not placed and that have the most connected weight with the objects already placed.
Parameters
orderOrder in which to treat the objects.
nbobjsNumber of objects to treat.
nbokNumber of objects already placed.
Returns
The geometric information of the object to place.
void FillAggregator ( RObj2DContainer cont,
bool *  selected,
RPromKernel kernel,
RRandom random,
bool  weight 
)

Fill an aggregator relative to another layout with a "good" set of geometric information.

This method is used by the crossover of the GA.

Parameters
contAggregator to build (is emptied by this method).
selectedArray given the already selected objects.
kernelPROMETHEE kernel used.
randomRandom number generator.
weigthMust the weights of the connection be used to compute the distance.
tCoord ComputeConnections ( bool  weight)

Compute all the connections from scratch.

Parameters
weigthMust the weights of the connection be used to compute the distance.
Returns
the total length of the connections.
RRect ComputeBoundary ( void  )

Compute the boundary rectangle of all the objects.

Returns
a RRect.

Member Data Documentation

RProblem2D* Problem
protected

Pointer to the problem.

RGeoInfo Board
protected

The board.

RContainer<RGeoInfoConnection,true,false> PlacedConnections
protected

Placement of the connections.

size_t NbAggregators
protected

Number of aggregators.