Generic Placement Heuristic class.
More...
#include <rplacementheuristic.h>
|
| RPlacementHeuristic (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) |
|
RGeoInfo * | NextObject (void) |
|
void | Run (RProblem2D *prob, RLayout *layout, RGrid *grid) |
|
void | AddValidPosition (RPoint &pos) |
|
virtual void | PostRun (void) |
|
RRect | GetResult (void) |
|
double | GetDistances (void) |
|
bool | IsEnd (void) |
|
size_t | GetNbObjsOk (void) |
|
RFreePolygons * | GetFreePolygons (void) |
|
RLayout * | GetLayout (void) const |
|
virtual | ~RPlacementHeuristic (void) |
|
Generic Placement Heuristic class.
The RPlacementHeuristic class provides an abstract class for placement heuristics.
Construct the placement heuristic.
- Parameters
-
maxobjs | The maximum objects to placed fore this object. |
calc | Must free polygons be calculated. |
use | Must free polygons be used. |
r | The random generator to use. |
dist | Distance criteria parameters. |
area | Area criteria parameters. |
firstrandom | Must the first object be placed randomly? |
ori | Must all orientation be tested. |
Destruct the placement heuristic.
Initialise the heuristic. The method chooses all the objects to place. In particular, if an object is associated to an aggregator, it is not placed and the method supposes that the aggregator itself is to placed.
- Parameters
-
prob | The problem. |
layout | Layout. |
grid | Pointer to the grid. |
Reimplemented in RPlacementEdge, RPlacementCenter, and RPlacementBottomLeft.
virtual RGeoInfo* SelectNextObject |
( |
void |
| ) |
|
|
protectedvirtual |
Select the next object to place. By default, the method chooses the first object randomly. Then, the next objects are chosen according to their connections (the most connection) with those already placed.
- Returns
- the geometric information of the object to place.
virtual void SearchValidPositions |
( |
RGeoInfo * |
info | ) |
|
|
protectedpure virtual |
Calculate all the possible positions to place a given object. The method must register these valid positions with the 'AddValidPosition' method.
- Parameters
-
info | Geometric information representing the object placed. |
Implemented in RPlacementEdge, RPlacementCenter, and RPlacementBottomLeft.
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. By default, the method does nothing.
This method must update Result, the rectangle bounding all placed objects.
- Parameters
-
info | Geometric information representing the object placed. |
pos | The position where it is placed. |
Implemented in RPlacementEdge, RPlacementCenter, and RPlacementBottomLeft.
Select and place an unassigned object. The steps followed by this method are:
- Select an object with the 'SelectNextObject' method.
- Look if a free polygon can hold the object (if managed).
- If not, for every possible orientation of the object, the method 'SearchValidPositions' is called to find all valid positions.
- If multiple positions are possible, PROMETHEE is used to select the best one : the position minimizing the total area occupied and the total distance of the connections.
- The object is placed and 'PostPlace' is called.
- If free polygons are managed, update them.
- Returns
- the geometric information of the object placed.
Run the heuristic.
- Parameters
-
prob | The problem. |
layout | Layout. |
grid | Grid. |
void AddValidPosition |
( |
RPoint & |
pos | ) |
|
Add a valid position fot the current geometric information to place.
- Parameters
-
pos | Position to be a valid. |
virtual void PostRun |
( |
void |
| ) |
|
|
virtual |
Return the bound rectangle containing all the objects.
double GetDistances |
( |
void |
| ) |
|
Return the sum of the distances of all the connections.
Return true if all the objects are placed.
size_t GetNbObjsOk |
( |
void |
| ) |
|
Return the number of objects placed.
Return a pointer to all the free polygons.
Get a pointer to the current (or the last treated) layout.
The random number generator to use
The grid used for the placement.
The limits for the placement.
Should the distances computed be weighted?.
Total number of objects to place.
Number of objects already placed.
The bounding rectangle of the resulting placement. It must be updated by the inheriting classes.
The sum of the connections distances.
Order in which the objects are to be treated.
Geometric information of the current object to place.
Free Polygons resulting of the placement.
Calculations of free polygons.
All possible orientation must be tested.
PROMETHEE distance criterion.
PROMETHEE Parameters for the distance.
PROMETHEE area criterion.
PROMETHEE Parameters for the area.
Is the first object randomly chosen?