13 #ifndef ZOLTAN2_IMBALANCEMETRICS_HPP
14 #define ZOLTAN2_IMBALANCEMETRICS_HPP
20 #define IMBALANCE_METRICS_TYPE_NAME "ImbalanceMetrics"
25 template <
typename scalar_t>
45 virtual void printLine(std::ostream &os)
const;
105 template <
typename scalar_t>
116 template <
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";
126 template <
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");
scalar_t getLocalSum() const
Get the sum on the local process.
void setLocalSum(scalar_t x)
Set the sum on the local process.
static std::string static_metricTypeName_
void setGlobalMin(scalar_t x)
Set the global minimum across parts.
virtual const std::string & getMetricType() const
Get the class type of the metric.
virtual const std::vector< std::string > & getMetrics() const
virtual void printLine(std::ostream &os) const
Print a standard line of data that fits under the header.
void setGlobalSum(scalar_t x)
Set the global sum.
scalar_t getAvgImbalance() const
Get the average of the part imbalances.
void setAvgImbalance(scalar_t x)
Set the average imbalance of all parts.
scalar_t getMetricValue(const std::string &metric_name) const
scalar_t getGlobalMin() const
Get the global minimum across all parts.
#define IMBALANCE_METRICS_TYPE_NAME
void setMetricValue(const std::string &metric_name, scalar_t value) const
scalar_t getGlobalMax() const
Get the global maximum across all parts.
static void printHeader(std::ostream &os)
Print a standard header.
static std::vector< std::string > static_metricNames_
void setGlobalMax(scalar_t x)
Set the global maximum across 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...
void setNorm(multiCriteriaNorm normVal)
Set or reset the norm.
scalar_t getMaxImbalance() const
Get the imbalance of the most imbalanced part. This is what we normally call the imbalance of a parti...
multiCriteriaNorm getNorm()
Get the norm.
multiCriteriaNorm
Enumerator used in code for multicriteria norm choice.
ImbalanceMetrics()
Constructor.
Defines the GraphModel interface.
ImbalanceMetrics(std::string mname)
Constructor.
scalar_t getGlobalSum() const
Get the global sum for all parts.