Center Placement Heuristic. More...

#include <rplacementcenter.h>

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

Public Member Functions

 RPlacementCenter (size_t maxobjs, bool calc, bool use, RRandom &r, RParamStruct *dist, RParamStruct *area, bool firstrandom, bool ori)
 
virtual void Init (RProblem2D *prob, RLayout *layout, RGrid *grid)
 
virtual void SearchValidPositions (RGeoInfo *info)
 
virtual void PostPlace (RGeoInfo *info, const RPoint &pos)
 
virtual void PostRun (void)
 
virtual ~RPlacementCenter (void)
 
- Public Member Functions inherited from RPlacementHeuristic
 RPlacementHeuristic (size_t maxobjs, bool calc, bool use, RRandom &r, RParamStruct *dist, RParamStruct *area, bool firstrandom, bool ori)
 
RGeoInfoNextObject (void)
 
void Run (RProblem2D *prob, RLayout *layout, RGrid *grid)
 
void AddValidPosition (RPoint &pos)
 
RRect GetResult (void)
 
double GetDistances (void)
 
bool IsEnd (void)
 
size_t GetNbObjsOk (void)
 
RFreePolygonsGetFreePolygons (void)
 
RLayoutGetLayout (void) const
 
virtual ~RPlacementHeuristic (void)
 

Private Attributes

RPolygons Sol
 
RPolygon Union
 
RPoint Attraction
 

Additional Inherited Members

- Protected Member Functions inherited from RPlacementHeuristic
virtual RGeoInfoSelectNextObject (void)
 
- Protected Attributes inherited from RPlacementHeuristic
RRandomRandom
 
RGridGrid
 
RLayoutLayout
 
RSize Limits
 
bool WeightedDistances
 
size_t NbObjs
 
size_t NbObjsOk
 
RRect Result
 
double Distances
 
RGeoInfo ** Order
 
RGeoInfoCurInfo
 
RFreePolygons Free
 
bool CalcFree
 
bool UseFree
 
bool AllOri
 
RContainer< ObjectPos, true,
false > 
ValidPos
 
RPromKernel Prom
 
RPromCriterionDist
 
const RParamDistParams
 
RPromCriterionArea
 
const RParamAreaParams
 
bool FirstRandom
 

Detailed Description

Center Placement Heuristic.

The RPlacementCenter class provides the center heuristic. The heuristic places the first object in the center of the rectangle representing the limits. After that, the objects are placed so that the resulting rectangle is proportional to the limits.
The heuristic doubles the limits of the result during the placement. The PostRun method make then a translation of the bottom-left coin of the resulting rectangle to (0,0).

Constructor & Destructor Documentation

RPlacementCenter ( size_t  maxobjs,
bool  calc,
bool  use,
RRandom r,
RParamStruct dist,
RParamStruct area,
bool  firstrandom,
bool  ori 
)

Construct the center heuristic.

Parameters
maxobjsThe maximal number of objects to place.
calcMust free polygons be calculated.
useMust free polygons be used.
rThe random generator to use.
distDistance criteria parameters.
areaArea criteria parameters.
firstrandomMust the first object be placed randomly?
oriMust all orientation be tested.
virtual ~RPlacementCenter ( void  )
virtual

Destruct the heuristic.

Member Function Documentation

virtual void Init ( RProblem2D prob,
RLayout layout,
RGrid grid 
)
virtual

Initialise the heuristic.

Parameters
probThe problem.
layoutLayout.
gridGrid.

Reimplemented from RPlacementHeuristic.

virtual void SearchValidPositions ( RGeoInfo info)
virtual

Calculate all the possible positions to place a given object. The method must register these valid positions with the 'AddValidPosition' method.

Parameters
infoGeometric information representing the object placed.

Implements RPlacementHeuristic.

virtual void PostPlace ( RGeoInfo info,
const RPoint pos 
)
virtual

This method is called each time a given object is placed at a given position. It can be used to make some specific computational updates.

This method must update Result, the rectangle bounding all placed objects.

Parameters
infoGeometric information representing the object placed.
posThe position where it is placed.

Implements RPlacementHeuristic.

virtual void PostRun ( void  )
virtual

Do some operations after the run.

Reimplemented from RPlacementHeuristic.

Member Data Documentation

RPolygons Sol
private

The list of all the polygons representing objects already placed.

RPolygon Union
private

The union of the placed objects.

RPoint Attraction
private

The attraction point, the middle of the limits rectangle.