34 double operator[] (
const std::size_t constraint_index)
const 36 HUMOTO_ASSERT( ( constraint_index < static_cast<std::size_t>(data_.size()) ),
37 "Violation index is out of bounds.");
38 return (data_[constraint_index]);
49 double getLower (
const std::size_t constraint_index)
const 51 HUMOTO_ASSERT( ( constraint_index < static_cast<std::size_t>(lower_.size()) ),
52 "Violation index is out of bounds.");
53 return (lower_[constraint_index]);
58 double getUpper (
const std::size_t constraint_index)
const 60 HUMOTO_ASSERT( ( constraint_index < static_cast<std::size_t>(upper_.size()) ),
61 "Violation index is out of bounds.");
62 return (upper_[constraint_index]);
73 void set (
const std::size_t constraint_index,
74 const double lower_bound_diff = 0.0,
75 const double upper_bound_diff = 0.0)
77 HUMOTO_ASSERT( ( constraint_index < static_cast<std::size_t>(data_.rows()) ),
78 "Violation index is out of bounds.");
80 lower_[constraint_index] = lower_bound_diff;
81 upper_[constraint_index] = upper_bound_diff;
83 if (lower_bound_diff >= 0)
85 if (upper_bound_diff <= 0)
87 data_[constraint_index] = 0.0;
91 data_[constraint_index] = upper_bound_diff;
96 data_[constraint_index] = lower_bound_diff;
108 return(data_.rows());
186 if (size() != location.
length_)
188 data_.resize(location.
length_);
189 lower_.resize(location.
length_);
190 upper_.resize(location.
length_);
193 copyFrom(other_violations, location);
204 data_.resize(number_of_constraints);
205 lower_.resize(number_of_constraints);
206 upper_.resize(number_of_constraints);
220 const std::string & name =
"")
const 225 logger.log(
LogEntryName(subname).add(
"violations"), data_);
226 logger.log(
LogEntryName(subname).add(
"lower_bound_diff"), lower_);
227 logger.log(
LogEntryName(subname).add(
"upper_bound_diff"), upper_);
238 std::vector< ViolationsConstraints >
data_;
252 return (data_[level_index]);
266 return (data_[level_index]);
278 data_[level_index].setZero();
289 return(data_.size());
309 const std::vector< std::size_t > &number_of_constraints)
312 data_.resize(number_of_levels);
314 for (std::size_t i = 0; i < number_of_levels; ++i)
316 data_[i].initialize(number_of_constraints[i]);
330 const std::string & name =
"violations")
const 333 for (std::size_t i = 0; i < data_.size(); ++i)
double getUpper(const std::size_t constraint_index) const
Access violation of a lower/upper bounds.
bool checkLength(const std::size_t max_length) const
Check length of location.
std::vector< ViolationsConstraints > data_
Violations corresponding to Constraints class.
std::size_t size() const
Size.
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
#define HUMOTO_ASSERT(condition, message)
void copyFrom(const ViolationsConstraints &other_violations, const Location &location)
Set violations of a set of constraints.
void initialize(const std::size_t number_of_levels, const std::vector< std::size_t > &number_of_constraints)
Initialize violations.
Represents log entry name.
void initialize(const ViolationsConstraints &other_violations, const Location &location)
Initialize vector of violations.
void copyTo(const Location &location, const ViolationsConstraints &other_violations)
Set violations of a set of constraints.
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="") const
Log violations.
void setZero(const std::size_t level_index)
Set violations of all constraints on the given level.
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
void initialize(const std::size_t number_of_constraints)
Initialize vector of violations.
The root namespace of HuMoTo.
void setZero(const Location &location)
Set violations of a set of constraints to zero.
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="violations") const
Log violations.
Violations corresponding to a hierarchy of Constraints.
std::size_t size() const
Size of the the vector of violations.
LogEntryName & add(const char *name)
extends entry name with a subname
void setZero()
Set all violations to zero.
Location of a data chunk (offset + length).
double getLower(const std::size_t constraint_index) const
Access violation of a lower/upper bounds.