Skip to content

Commit 9cc09ae

Browse files
committed
add nix
f f
1 parent fb7d313 commit 9cc09ae

File tree

13 files changed

+472
-352
lines changed

13 files changed

+472
-352
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
CXX="clang++-19"
1+
CXX="clang++"
22
BUILD_TYPE="RelWithDebInfo"
33
GENERATOR="Ninja"

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
description = "Implementation of IEEE CEC SBC benchmarks in C++23";
3+
inputs = {
4+
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
5+
utils.url = "github:numtide/flake-utils";
6+
};
7+
outputs = { self, nixpkgs, ... }@inputs:
8+
inputs.utils.lib.eachSystem [ "x86_64-linux" ] (system:
9+
let pkgs = import nixpkgs { inherit system; };
10+
in {
11+
devShells.default =
12+
pkgs.mkShell { packages = with pkgs; [ cmake gcc clang ]; };
13+
});
14+
}

include/cecxx/benchmark/cec_2013/complex_problems.hpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ const auto complex_1 = detail::complex_problem_invoker{std::tuple{basic_6, basic
1616
{.rot = do_affine_trans::no, .shift = do_affine_trans::yes},
1717
},
1818
.scales = {
19-
{0, {1.0, 1.0}},
20-
{1, {0.000001, 1.0}},
21-
{2, {10000.0, 1e+30}},
22-
{3, {0.000001, 1.0}},
23-
{4, {10000, 1e+5}},
19+
{1.0, 1.0},
20+
{0.000001, 1.0},
21+
{10000.0, 1e+30},
22+
{0.000001, 1.0},
23+
{10000, 1e+5},
2424
}}};
2525

2626
const auto complex_2 = detail::complex_problem_invoker{std::tuple{basic_15, basic_15, basic_15},
@@ -35,9 +35,9 @@ const auto complex_2 = detail::complex_problem_invoker{std::tuple{basic_15, basi
3535
do_affine_trans::yes},
3636
},
3737
.scales = {
38-
{0, {1.0, 1.0}},
39-
{1, {1.0, 1.0}},
40-
{2, {1.0, 1.0}},
38+
{1.0, 1.0},
39+
{1.0, 1.0},
40+
{1.0, 1.0},
4141
}}};
4242

4343
const auto complex_3 = detail::complex_problem_invoker{std::tuple{basic_15, basic_15, basic_15},
@@ -52,9 +52,9 @@ const auto complex_3 = detail::complex_problem_invoker{std::tuple{basic_15, basi
5252
do_affine_trans::yes},
5353
},
5454
.scales = {
55-
{0, {1.0, 1.0}},
56-
{1, {1.0, 1.0}},
57-
{2, {1.0, 1.0}},
55+
{1.0, 1.0},
56+
{1.0, 1.0},
57+
{1.0, 1.0},
5858
}}};
5959

6060
const auto complex_4 = detail::complex_problem_invoker{std::tuple{basic_15, basic_12, basic_9},
@@ -69,9 +69,9 @@ const auto complex_4 = detail::complex_problem_invoker{std::tuple{basic_15, basi
6969
do_affine_trans::yes},
7070
},
7171
.scales = {
72-
{0, {1000.0 , 4e+3}},
73-
{1, {1000.0 , 1e+3}},
74-
{2, {1000.0 , 400.0}},
72+
{1000.0 , 4e+3},
73+
{1000.0 , 1e+3},
74+
{1000.0 , 400.0},
7575
}}};
7676

7777
const auto complex_5 = detail::complex_problem_invoker{std::tuple{basic_15, basic_12, basic_9},
@@ -86,9 +86,9 @@ const auto complex_5 = detail::complex_problem_invoker{std::tuple{basic_15, basi
8686
do_affine_trans::yes},
8787
},
8888
.scales = {
89-
{0, {1000, 4e+3}},
90-
{1, {1000, 1e+3}},
91-
{2, {1000.0 , 400.0}},
89+
{1000, 4e+3},
90+
{1000, 1e+3},
91+
{1000.0 , 400.0},
9292
}}};
9393

9494
const auto complex_6 = detail::complex_problem_invoker{std::tuple{basic_15, basic_12, basic_2, basic_9, basic_10},
@@ -107,11 +107,11 @@ const auto complex_6 = detail::complex_problem_invoker{std::tuple{basic_15, basi
107107
do_affine_trans::yes},
108108
},
109109
.scales = {
110-
{0, {1000.0 , 4e+3}},
111-
{1, {1000.0 , 1000.0}},
112-
{2, {1000.0 , 1e+10}},
113-
{3, {1000.0 , 400.0}},
114-
{4, {10.0, 1.0}},
110+
{1000.0 , 4e+3},
111+
{1000.0 , 1000.0},
112+
{1000.0 , 1e+10},
113+
{1000.0 , 400.0},
114+
{10.0, 1.0},
115115
}}};
116116

117117
const auto complex_7 = detail::complex_problem_invoker{std::tuple{basic_10, basic_12, basic_15, basic_9, basic_1},
@@ -130,11 +130,11 @@ const auto complex_7 = detail::complex_problem_invoker{std::tuple{basic_10, basi
130130
do_affine_trans::yes},
131131
},
132132
.scales = {
133-
{0, {10000.0, 100.0}},
134-
{1, {10000.0, 1e+3}},
135-
{2, {10000.0, 4e+3}},
136-
{3, {10000.0, 400.0}},
137-
{4, {10000.0, 1e+5}},
133+
{10000.0, 100.0},
134+
{10000.0, 1e+3},
135+
{10000.0, 4e+3},
136+
{10000.0, 400.0},
137+
{10000.0, 1e+5},
138138
}}};
139139

140140
const auto complex_8 = detail::complex_problem_invoker{std::tuple{basic_19, basic_7, basic_15, basic_20, basic_1},
@@ -153,11 +153,11 @@ const auto complex_8 = detail::complex_problem_invoker{std::tuple{basic_19, basi
153153
do_affine_trans::yes},
154154
},
155155
.scales = {
156-
{0, {10000.0, 4e+3}},
157-
{1, {10000.0, 4e+6}},
158-
{2, {10000.0, 4e+3}},
159-
{3, {10000.0, 2e+7}},
160-
{4, {10000.0, 1e+5}},
156+
{10000.0, 4e+3},
157+
{10000.0, 4e+6},
158+
{10000.0, 4e+3},
159+
{10000.0, 2e+7},
160+
{10000.0, 1e+5},
161161
}}};
162162

163163
} // namespace cecxx::benchmark::cec_2013
Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <cecxx/benchmark/detail/legacy/functions/multimodal/schaffer.hpp>
43
#include <cecxx/benchmark/detail/problem_invokers/basic_problem_invoker.hpp>
54
#include <cecxx/functions/multimodal/ackley.hpp>
65
#include <cecxx/functions/multimodal/discus.hpp>
@@ -13,6 +12,7 @@
1312
#include <cecxx/functions/multimodal/levy.hpp>
1413
#include <cecxx/functions/multimodal/rastrigin.hpp>
1514
#include <cecxx/functions/multimodal/rosenbrock.hpp>
15+
#include <cecxx/functions/multimodal/schaffer.hpp>
1616
#include <cecxx/functions/multimodal/schwefel.hpp>
1717
#include <cecxx/functions/multimodal/weierstrass.hpp>
1818
#include <cecxx/functions/multimodal/zakharov.hpp>
@@ -22,44 +22,88 @@
2222

2323
namespace cecxx::benchmark::cec_2014 {
2424
static constexpr auto basic_1 = detail::basic_problem_invoker{
25-
cecxx::functions::unimodal::ellips, 1.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
25+
cecxx::functions::unimodal::ellips,
26+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
27+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::rotation{}}};
28+
2629
static constexpr auto basic_2 = detail::basic_problem_invoker{
27-
cecxx::functions::unimodal::bent_cigar, 1.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
30+
cecxx::functions::unimodal::bent_cigar,
31+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
32+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::rotation{}}};
2833
static constexpr auto basic_3 = detail::basic_problem_invoker{
29-
cecxx::functions::multimodal::discus, 1.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
34+
cecxx::functions::multimodal::discus,
35+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
36+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::rotation{}}};
3037
static constexpr auto basic_4
3138
= detail::basic_problem_invoker{cecxx::functions::multimodal::rosenbrock,
32-
2.048 / 100.0,
33-
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
39+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
40+
std::tuple{
41+
cecxx::benchmark::detail::shift{},
42+
cecxx::benchmark::detail::scale{2.048, 100.0},
43+
cecxx::benchmark::detail::rotation{},
44+
}};
3445
static constexpr auto basic_5 = detail::basic_problem_invoker{
35-
cecxx::functions::multimodal::ackley, 1.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
36-
static constexpr auto basic_6
37-
= detail::basic_problem_invoker{cecxx::functions::multimodal::weierstrass,
38-
0.5 / 100.0,
39-
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
46+
cecxx::functions::multimodal::ackley,
47+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
48+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::rotation{}}};
49+
static constexpr auto basic_6 = detail::basic_problem_invoker{
50+
cecxx::functions::multimodal::weierstrass,
51+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
52+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{0.5, 100.0},
53+
cecxx::benchmark::detail::rotation{}}};
4054
static constexpr auto basic_7 = detail::basic_problem_invoker{
41-
cecxx::functions::multimodal::griewank, 6.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
42-
static constexpr auto basic_8 = detail::basic_problem_invoker{
43-
cecxx::functions::multimodal::rastrigin, 5.12 / 100.0, {.rot = do_affine_trans::no, .shift = do_affine_trans::yes}};
44-
static constexpr auto basic_9
55+
cecxx::functions::multimodal::griewank,
56+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
57+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{600.0, 100.0},
58+
cecxx::benchmark::detail::rotation{}}};
59+
static constexpr auto basic_8
4560
= detail::basic_problem_invoker{cecxx::functions::multimodal::rastrigin,
46-
5.12 / 100.0,
47-
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
48-
static constexpr auto basic_10 = detail::basic_problem_invoker{
49-
cecxx::functions::multimodal::schwefel, 10.0, {.rot = do_affine_trans::no, .shift = do_affine_trans::yes}};
61+
{.rot = do_affine_trans::no, .shift = do_affine_trans::yes},
62+
std::tuple{
63+
cecxx::benchmark::detail::shift{},
64+
cecxx::benchmark::detail::scale{5.12, 100.0},
65+
}};
66+
static constexpr auto basic_9 = detail::basic_problem_invoker{
67+
cecxx::functions::multimodal::rastrigin,
68+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
69+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{5.12, 100.0},
70+
cecxx::benchmark::detail::rotation{}}};
71+
static constexpr auto basic_10
72+
= detail::basic_problem_invoker{cecxx::functions::multimodal::schwefel,
73+
{.rot = do_affine_trans::no, .shift = do_affine_trans::yes},
74+
std::tuple{
75+
cecxx::benchmark::detail::shift{},
76+
cecxx::benchmark::detail::scale{1000.0, 100.0},
77+
}};
78+
5079
static constexpr auto basic_11 = detail::basic_problem_invoker{
51-
cecxx::functions::multimodal::schwefel, 10.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
80+
cecxx::functions::multimodal::schwefel,
81+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
82+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{1000.0, 100.0},
83+
cecxx::benchmark::detail::rotation{}}};
5284
static constexpr auto basic_12 = detail::basic_problem_invoker{
53-
cecxx::functions::multimodal::katsuura, 5.0 / 100.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
85+
cecxx::functions::multimodal::katsuura,
86+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
87+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{5.0, 100.0},
88+
cecxx::benchmark::detail::rotation{}}};
5489
static constexpr auto basic_13 = detail::basic_problem_invoker{
55-
cecxx::functions::multimodal::happycat, 5.0 / 100.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
90+
cecxx::functions::multimodal::happycat,
91+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
92+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{5.0, 100.0},
93+
cecxx::benchmark::detail::rotation{}}};
5694
static constexpr auto basic_14 = detail::basic_problem_invoker{
57-
cecxx::functions::multimodal::hgbat, 5.0 / 100.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
58-
static constexpr auto basic_15
59-
= detail::basic_problem_invoker{cecxx::functions::multimodal::grie_rosen,
60-
5.0 / 100.0,
61-
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
95+
cecxx::functions::multimodal::hgbat,
96+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
97+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{5.0, 100.0},
98+
cecxx::benchmark::detail::rotation{}}};
99+
static constexpr auto basic_15 = detail::basic_problem_invoker{
100+
cecxx::functions::multimodal::grie_rosen,
101+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
102+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::scale{5.0, 100.0},
103+
cecxx::benchmark::detail::rotation{}}};
62104
static constexpr auto basic_16 = detail::basic_problem_invoker{
63-
cecxx::functions::multimodal::escaffer, 1.0, {.rot = do_affine_trans::yes, .shift = do_affine_trans::yes}};
105+
cecxx::functions::multimodal::escaffer,
106+
{.rot = do_affine_trans::yes, .shift = do_affine_trans::yes},
107+
std::tuple{cecxx::benchmark::detail::shift{}, cecxx::benchmark::detail::rotation{}}};
64108

65109
} // namespace cecxx::benchmark::cec_2014

0 commit comments

Comments
 (0)