Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
foolnotion committed Oct 16, 2023
1 parent 9f3ab08 commit 6879732
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion source/algorithms/nsga2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ auto NSGA2::UpdateDistance(Operon::Span<Individual> pop) -> void
auto NSGA2::Sort(Operon::Span<Individual> pop) -> void
{
auto eps = static_cast<Operon::Scalar>(GetConfig().Epsilon);
auto less = [eps](auto const& lhs, auto const& rhs) { return Operon::Less{}(lhs.Fitness, rhs.Fitness, eps); };
auto eq = [eps](auto const& lhs, auto const& rhs) { return Operon::Equal{}(lhs.Fitness, rhs.Fitness, eps); };
// sort the population lexicographically
std::stable_sort(pop.begin(), pop.end(), [](auto const& a, auto const& b){ return std::ranges::lexicographical_compare(a.Fitness, b.Fitness); });
Expand Down
4 changes: 2 additions & 2 deletions source/operators/non_dominated_sorter/best_order_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ auto BestOrderSorter::Sort(Operon::Span<Operon::Individual const> pop, Operon::S
auto addSolutionToRankSet = [&](auto s, auto j) {
auto r = rank[s];
auto& ss = solutionSets[j];
if (r >= ss.size()) {
if (r >= std::ssize(ss)) {
ss.resize(r+1UL);
}
ss[r].push_back(s);
Expand All @@ -75,7 +75,7 @@ auto BestOrderSorter::Sort(Operon::Span<Operon::Individual const> pop, Operon::S
for (auto k = 0; k < rc; ++k) {
bool dominated = false;

if (k >= solutionSets[j].size()) {
if (k >= std::ssize(solutionSets[j])) {
solutionSets[j].resize(k+1UL);
}

Expand Down
2 changes: 1 addition & 1 deletion source/operators/non_dominated_sorter/deductive_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Operon {
std::vector<uint64_t> sorted(nb);

auto set = [](auto&& range, auto i) { range[i / d] |= (1UL << (d - i % d));}; // set bit i
auto reset = [](auto&& range, auto i) { range[i / d] &= ~(1UL << (i % d)); }; // unset bit i
[[maybe_unused]] auto reset = [](auto&& range, auto i) { range[i / d] &= ~(1UL << (i % d)); }; // unset bit i
auto get = [](auto&& range, auto i) -> bool { return range[i / d] & (1UL << (d - i % d)); };

auto dominatedOrSorted = [&](std::size_t i) { return get(sorted, i) || get(dominated, i); };
Expand Down

0 comments on commit 6879732

Please sign in to comment.