49 #ifndef ZOLTAN2_IMBALANCEMETRICS_HPP
50 #define ZOLTAN2_IMBALANCEMETRICS_HPP
56 #define IMBALANCE_METRICS_TYPE_NAME "ImbalanceMetrics"
61 template <
typename scalar_t>
81 virtual void printLine(std::ostream &os)
const;
141 template <
typename scalar_t>
152 template <
typename scalar_t>
155 os << std::setw(20) <<
" ";
156 os << std::setw(15) <<
"min" << std::setw(15) <<
"max" << std::setw(15) <<
"avg";
157 os << std::setw(2) <<
" ";
158 os << std::setw(10) <<
"imbalance";
162 template <
typename scalar_t>
165 std::string label( this->getName() );
168 std::ostringstream oss;
171 oss << this->getName() <<
" (1)";
174 oss << this->getName() <<
" (2)";
177 oss << this->getName() <<
" (inf)";
180 oss << this->getName() <<
" (?)";
187 auto min = this->getMetricValue(
"global minimum");
188 auto max = this->getMetricValue(
"global maximum");
189 auto avg = this->getMetricValue(
"global average");
191 if( min > 999 ) { precision = 0; }
192 else if( min > 99 ) { precision = 2; }
194 os << std::setw(20) << label;
195 os << std::setw(15) << std::setprecision(precision) << min;
196 os << std::setw(15) << std::setprecision(precision) << max;
197 os << std::setw(15) << std::setprecision(precision) << avg;
199 os << std::setw(2) <<
" ";
200 os << std::setw(10) << std::setprecision(4)
201 << 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.