#include <areacon.h>
The base class for defining a Partition.
- Author
- Jeffrey R. Peters
Constructors.
- Parameters
-
[in] | NRegions | The number of regions desired. |
[in] | Prior | The density function goverining partition creation |
[in] | desired_area | A vector containing the desired areas of the regions in the resulting configuration. Defaults to equal area. |
[in] | Alg_Params | Various algorithmic parameters |
double AreaCon::Partition::CalculateError |
( |
const std::vector< double > & |
volumes | ) |
|
|
private |
Calculates a measure of volumetric error
- Parameters
-
[in] | volumes | The 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] | WriteToFile | Flag indicating if result should be written to file |
[in] | filename_partition | Output filename to be written with partition data |
[in] | filename_centers | Output 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 |
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] | tolerance | A tolerance for determining whether distinct vertices should be combined into a single vertex |
[in] | mult | A 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] | Region | The region of interest |
[in] | multiplier | A 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] | Region | The region of interest |
[in] | initial_multiplier | A parameter used in center creation |
[in] | max_steps | An 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] | Delaunay | The 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] | volumes | The 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_step | A step-size that overwrites the value indicated in Alg_Params. |
[in] | volumes | The 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] | volumes | The current volumes of the regions in Covering |
[in] | SharedEdges | The 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] | Centers | The initial center locations. |
[in] | Weights | The initial weight values. |
void AreaCon::Partition::SetPartitionVariables |
( |
int |
NRegions = 0 , |
|
|
Density |
Prior = Density() , |
|
|
std::vector< double > |
desired_area = {} |
|
) |
| |
Sets the partition variables.
- Parameters
-
[in] | NRegions | The number of regions desired. |
[in] | Prior | The density function goverining partition creation |
[in] | desired_area | A vector containing the desired areas of the regions in the resulting configuration. Defaults to equal area. |
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.
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: