116 std::size_t h = std::hash<vector<float>>{}(
wvalues);
135 if (v.size() !=
weights.size()) {
136 throw std::length_error(
"Assigned values have not the same length than current values");
140 for (
const auto& element : v) {
141 values.push_back(element);
148 std::transform(v.begin(), v.end(),
150 [](
double a,
double b) {
169 for (
size_t i = 0; i <
wvalues.size(); ++i)
178 return !(*
this == other);
184 return !std::lexicographical_compare(
wvalues.begin(),
wvalues.end(),
190 return other < *
this;
195 return !(other < *
this);
200 return !(*
this < other);
207 string s =
"Fitness(";
219 string s =
"Fitness(";
232void to_json(json &j,
const Fitness &f);
233void from_json(
const json &j, Fitness& f);
string to_string(const T &value)
template function to convert objects to string for logging
< nsga2 selection operator for getting the front
void from_json(const json &j, Fitness &f)
void to_json(json &j, const Fitness &f)
Represents the fitness of an individual in the Brush namespace.
bool operator>(const Fitness &other) const
float crowding_dist
crowding distance on the Pareto front
vector< unsigned int > get_dominated() const
float get_crowding_dist() const
bool operator>=(const Fitness &other) const
float loss
aggregate loss score
float get_prev_loss_v() const
unsigned int get_prev_depth() const
float get_prev_loss() const
unsigned int prev_complexity
unsigned int get_prev_size() const
vector< float > get_values() const
unsigned int get_prev_complexity() const
void set_linear_complexity(unsigned int new_lc)
std::string toString() const
void set_complexity(unsigned int new_c)
unsigned int linear_complexity
unsigned int dcounter
number of individuals this dominates
bool operator==(const Fitness &other) const
void set_loss_v(float f_v)
void set_dominated(vector< unsigned int > &dom)
bool operator!=(const Fitness &other) const
bool operator<(const Fitness &other) const
void set_depth(unsigned int new_d)
unsigned int get_prev_linear_complexity() const
unsigned int get_complexity() const
unsigned int prev_linear_complexity
void set_dcounter(unsigned int d)
float loss_v
aggregate validation loss score
vector< float > get_wvalues() const
bool operator<=(const Fitness &other) const
unsigned int rank
pareto front rank
void set_values(vector< float > &v)
unsigned int get_dcounter() const
void set_rank(unsigned r)
Fitness(const vector< float > &w={})
void set_size(unsigned int new_s)
vector< unsigned int > dominated
individual indices this dominates
unsigned int get_depth() const
void set_crowding_dist(float cd)
void set_weights(vector< float > &w)
int dominates(const Fitness &b) const
set obj vector given a string of objective names
unsigned int get_linear_complexity() const
unsigned int get_size() const
vector< float > get_weights() const