Ultra 0.9.4
Loading...
Searching...
No Matches
fitness.tcc File Reference

Go to the source code of this file.

Functions

template<Fitness F>
constexpr F lowest () noexcept
template<std::integral F>
bool isfinite (F) noexcept
template<std::floating_point F>
bool isfinite (F f)
template<MultiDimFitness F>
bool isfinite (const F &f)
template<Fitness F>
requires std::is_arithmetic_v<F>
bool dominating (const F &lhs, const F &rhs)
template<MultiDimFitness F>
bool dominating (const F &lhs, const F &rhs)
template<MultiDimFitness F>
bool almost_equal (const F &lhs, const F &rhs)
template<Fitness F>
requires std::is_arithmetic_v<F>
double distance (F f1, F f2)
template<MultiDimFitness F>
double distance (const F &f1, const F &f2)
template<Fitness F>
requires std::floating_point<F>
bool save (std::ostream &out, F f)
template<std::integral F>
bool save (std::ostream &out, F f)
template<MultiDimFitness F>
requires std::floating_point<std::ranges::range_value_t<F>>
bool save (std::ostream &out, const F &f)
template<std::floating_point F>
bool load (std::istream &in, F *f)
template<std::integral F>
bool load (std::istream &in, F *f)

Detailed Description

Remarks
This file is part of ULTRA.
License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/

Function Documentation

◆ distance()

template<Fitness F>
requires std::is_arithmetic_v<F>
double distance ( F f1,
F f2 )
nodiscard

Taxicab distance between two vectors.

Parameters
[in]f1first fitness value
[in]f2second fitness value
Returns
the distance between f1 and f2

The taxicab distance between two vectors in an n-dimensional real vector space with fixed Cartesian coordinate system, is the sum of the lengths of the projections of the line segment between the points onto the coordinate axes.

◆ dominating()

template<Fitness F>
requires std::is_arithmetic_v<F>
bool dominating ( const F & lhs,
const F & rhs )
nodiscard

Pareto dominance comparison.

Parameters
[in]lhsfirst term of comparison
[in]rhssecond term of comparison
Returns
true if lhs is a Pareto improvement of rhs

lhs dominates rhs (is a Pareto improvement) if:

  • each component of lhs is not strictly worst (less) than the corresponding component of rhs;
  • there is at least one component in which lhs is better than rhs.
Note
An interesting property is that if a vector x does not dominate a vector y, this does not imply that y dominates x (they can be both non-dominated).

◆ isfinite()

template<MultiDimFitness F>
bool isfinite ( const F & f)
nodiscard
Parameters
[in]ffitness to check
Returns
true if every component of the fitness is finite

◆ load()

template<std::floating_point F>
bool load ( std::istream & in,
F * f )
Parameters
[in]ininput stream
[out]fload the fitness here
Returns
true if the object has been loaded correctly
Note
If the load operation isn't successful f isn't changed.

◆ save()

template<Fitness F>
requires std::floating_point<F>
bool save ( std::ostream & out,
F f )
nodiscard
Parameters
[out]outoutput stream
[in]ffitness to be saved
Returns
true if object has been saved correctly