The AreaCon Library  1.0
A C++ library for area-constrained partitioning operations
 All Classes Namespaces Files Functions Variables Pages
AreaCon::Partition Class Reference

#include <areacon.h>

Public Member Functions

 Partition (int NRegions=0, Density Prior=Density(), std::vector< double > desired_area={}, Parameters Alg_Params=Parameters())
 
void SetPartitionVariables (int NRegions=0, Density Prior=Density(), std::vector< double > desired_area={})
 
void InitializePartition (std::vector< Point > Centers={}, std::vector< double > Weights={})
 
std::vector< PolyGetCovering (void)
 
std::vector< PointGetCenters (void)
 
std::vector< double > GetWeights (void)
 
void CalculatePartition (bool WriteToFile, std::string filename_partition="", std::string filename_centers="")
 

Private Member Functions

void CheckParams (void)
 
bool CreateDefaultCenters (const Poly Region, const double multiplier)
 
void CreateDefaultCenters (const Poly Region, const double initial_multiplier, const int max_steps)
 
bool CreatePowerDiagram (void)
 
void CleanCovering (const double tolerance, const long int &mult)
 
void CreateDelaunayGraph (DelaunayGraph &Delaunay) const
 
double GradientStepCenter (const std::vector< double > &volumes)
 
void GradientStepCenter (const double &temp_step, const std::vector< double > &volumes)
 
void GradientStepWeights (const std::vector< double > &volumes, const DelaunayGraph &SharedEdges)
 
double CalculateError (const std::vector< double > &volumes)
 
std::vector< double > CalculateVolumes (void)
 

Private Attributes

std::vector< PointCenters
 
std::vector< PolyCovering
 
std::vector< double > Weights
 
const Parameters Alg_Params
 
std::vector< double > desired_area
 
Density Prior
 
int NRegions
 

Detailed Description

The base class for defining a Partition.

Author
Jeffrey R. Peters

Constructor & Destructor Documentation

AreaCon::Partition::Partition ( int  NRegions = 0,
Density  Prior = Density(),
std::vector< double >  desired_area = {},
Parameters  Alg_Params = Parameters() 
)

Constructors.

Parameters
[in]NRegionsThe number of regions desired.
[in]PriorThe density function goverining partition creation
[in]desired_areaA vector containing the desired areas of the regions in the resulting configuration. Defaults to equal area.
[in]Alg_ParamsVarious algorithmic parameters

Member Function Documentation

double AreaCon::Partition::CalculateError ( const std::vector< double > &  volumes)
private

Calculates a measure of volumetric error

Parameters
[in]volumesThe volumes of the regions in Covering.
Returns
A measure of the volumetric error.
void AreaCon::Partition::CalculatePartition ( bool  WriteToFile,
std::string  filename_partition = "",
std::string  filename_centers = "" 
)

The main function used for calculating partitions. Partitions are calculated and the resultant configuration is stored in the containers Centers and Covering. If WriteToFile = true, then the evolution of the centers and partitions will be written to the files filename_centers and filename_partitions, respectively.

Parameters
[in]WriteToFileFlag indicating if result should be written to file
[in]filename_partitionOutput filename to be written with partition data
[in]filename_centersOutput filename to be written with center data
std::vector< double > AreaCon::Partition::CalculateVolumes ( void  )
private

A function that calculates the volumes of the regions in Covering

Returns
A vector containing the volumes of the regions in Covering.
void AreaCon::Partition::CheckParams ( void  )
private

Checks Parameters to ensure consistent sizes

void AreaCon::Partition::CleanCovering ( const double  tolerance,
const long int &  mult 
)
private

A function used to eliminate redundancies in the covering that may arise due to numerical error.

Parameters
[in]toleranceA tolerance for determining whether distinct vertices should be combined into a single vertex
[in]multA multiplier that affects the degree of numerical accuracy
bool AreaCon::Partition::CreateDefaultCenters ( const Poly  Region,
const double  multiplier 
)
private

Creates default centers within the region defined by the polygon Region. The parameter multiplier is used to create center points which are ensured to lie within the polygon.

Parameters
[in]RegionThe region of interest
[in]multiplierA parameter used in center creation
Returns
A flag indicating whether centers were successfully created
void AreaCon::Partition::CreateDefaultCenters ( const Poly  Region,
const double  initial_multiplier,
const int  max_steps 
)
private

Creates default centers within the region defined by the polygon Region. The parameter multiplier is used to create center points which are ensured to lie within the polygon.

Parameters
[in]RegionThe region of interest
[in]initial_multiplierA parameter used in center creation
[in]max_stepsAn upper bound on the number of center creation attempts
void AreaCon::Partition::CreateDelaunayGraph ( DelaunayGraph Delaunay) const
private

Creates the Delaunay graph (Duel Graph) based on the partition stored in Covering.

Parameters
[out]DelaunayThe Delaunay graph.
bool AreaCon::Partition::CreatePowerDiagram ( void  )
private

Creates the power diagram generated from the current values of Centers and Weights.

std::vector<Point> AreaCon::Partition::GetCenters ( void  )
inline
Returns
The current value of Centers
std::vector<Poly> AreaCon::Partition::GetCovering ( void  )
inline
Returns
The current value of Covering
std::vector<double> AreaCon::Partition::GetWeights ( void  )
inline
Returns
The current value of Weights
double AreaCon::Partition::GradientStepCenter ( const std::vector< double > &  volumes)
private

Update the center locations based on the current configuration

Parameters
[in]volumesThe current volumes of the regions in Covering
Returns
The sum of the squares of the Euclidean distance moved by each of the centers
void AreaCon::Partition::GradientStepCenter ( const double &  temp_step,
const std::vector< double > &  volumes 
)
private

Update the center locations based on the current configuration (This function is used for the initial center step, and can speed convergence in cases where the center stepsize parameter is not chosen equal to 1).

Parameters
[in]temp_stepA step-size that overwrites the value indicated in Alg_Params.
[in]volumesThe current volumes of the regions in Covering
Returns
The sum of the squares of the Euclidean distance moved by each of the centers
void AreaCon::Partition::GradientStepWeights ( const std::vector< double > &  volumes,
const DelaunayGraph SharedEdges 
)
private

Update the weights based on the current configuration.

Parameters
[in]volumesThe current volumes of the regions in Covering
[in]SharedEdgesThe current Delaunay graph.
void AreaCon::Partition::InitializePartition ( std::vector< Point Centers = {},
std::vector< double >  Weights = {} 
)

Used to initialize algorithmic process variables Centers and Weights. If no input is given, default centers and weights are created.

Parameters
[in]CentersThe initial center locations.
[in]WeightsThe initial weight values.
void AreaCon::Partition::SetPartitionVariables ( int  NRegions = 0,
Density  Prior = Density(),
std::vector< double >  desired_area = {} 
)

Sets the partition variables.

Parameters
[in]NRegionsThe number of regions desired.
[in]PriorThe density function goverining partition creation
[in]desired_areaA vector containing the desired areas of the regions in the resulting configuration. Defaults to equal area.

Member Data Documentation

const Parameters AreaCon::Partition::Alg_Params
private

Algorithmic parameters.

std::vector<Point> AreaCon::Partition::Centers
private

The vector of center locations.

std::vector<Poly> AreaCon::Partition::Covering
private

The covering of the area of interest.

std::vector<double> AreaCon::Partition::desired_area
private

A vector specifying the desired areas of the resultant configurations.

int AreaCon::Partition::NRegions
private

The number of regions desired.

Density AreaCon::Partition::Prior
private

The prior probability density function.

std::vector<double> AreaCon::Partition::Weights
private

The vector of weights associated with each area.


The documentation for this class was generated from the following files: