13#ifndef ZOLTAN2_IMBALANCEMETRICS_HPP
14#define ZOLTAN2_IMBALANCEMETRICS_HPP
20#define IMBALANCE_METRICS_TYPE_NAME "ImbalanceMetrics"
25template <
typename scalar_t>
45virtual void printLine(std::ostream &os)
const;
105template <
typename scalar_t>
116template <
typename scalar_t>
119 os << std::setw(20) <<
" ";
120 os << std::setw(15) <<
"min" << std::setw(15) <<
"max" << std::setw(15) <<
"avg";
121 os << std::setw(2) <<
" ";
122 os << std::setw(10) <<
"imbalance";
126template <
typename scalar_t>
129 std::string label( this->getName() );
132 std::ostringstream oss;
135 oss << this->getName() <<
" (1)";
138 oss << this->getName() <<
" (2)";
141 oss << this->getName() <<
" (inf)";
144 oss << this->getName() <<
" (?)";
151 auto min = this->getMetricValue(
"global minimum");
152 auto max = this->getMetricValue(
"global maximum");
153 auto avg = this->getMetricValue(
"global average");
155 if( min > 999 ) { precision = 0; }
156 else if( min > 99 ) { precision = 2; }
158 os << std::setw(20) << label;
159 os << std::setw(15) << std::setprecision(precision) << min;
160 os << std::setw(15) << std::setprecision(precision) << max;
161 os << std::setw(15) << std::setprecision(precision) << avg;
163 os << std::setw(2) <<
" ";
164 os << std::setw(10) << std::setprecision(4)
165 << this->getMetricValue(
"maximum imbalance");
Defines the GraphModel interface.
#define IMBALANCE_METRICS_TYPE_NAME
void setMetricValue(const std::string &metric_name, scalar_t value) const
scalar_t getMetricValue(const std::string &metric_name) const
scalar_t getMaxImbalance() const
Get the imbalance of the most imbalanced part. This is what we normally call the imbalance of a parti...
virtual const std::vector< std::string > & getMetrics() const
multiCriteriaNorm getNorm()
Get the norm.
virtual const std::string & getMetricType() const
Get the class type of the metric.
scalar_t getGlobalSum() const
Get the global sum for all parts.
void setGlobalMax(scalar_t x)
Set the global maximum across parts.
scalar_t getAvgImbalance() const
Get the average of the part imbalances.
void setGlobalSum(scalar_t x)
Set the global sum.
void setNorm(multiCriteriaNorm normVal)
Set or reset the norm.
void setGlobalMin(scalar_t x)
Set the global minimum across parts.
void setLocalSum(scalar_t x)
Set the sum on the local process.
ImbalanceMetrics(std::string mname)
Constructor.
scalar_t getGlobalMax() const
Get the global maximum across all parts.
void setMaxImbalance(scalar_t x)
Set the imbalance of the worst imbalanced part. This is what we normally call the imbalance of a part...
static std::string static_metricTypeName_
void setAvgImbalance(scalar_t x)
Set the average imbalance of all parts.
scalar_t getLocalSum() const
Get the sum on the local process.
static void printHeader(std::ostream &os)
Print a standard header.
virtual void printLine(std::ostream &os) const
Print a standard line of data that fits under the header.
static std::vector< std::string > static_metricNames_
scalar_t getGlobalMin() const
Get the global minimum across all parts.
ImbalanceMetrics()
Constructor.
Created by mbenlioglu on Aug 31, 2020.
multiCriteriaNorm
Enumerator used in code for multicriteria norm choice.
@ normBalanceTotalMaximum
@ normMinimizeTotalWeight
@ normMinimizeMaximumWeight