Skip to content

Commit 8ce0eb4

Browse files
committed
Rename example dir
1 parent 6d9957c commit 8ce0eb4

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed
File renamed without changes.

examples/main.cpp renamed to example/main.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,43 @@
88

99
#include "cecxx/benchmark/evaluator.hpp"
1010

11-
constexpr auto DIMENSION{10};
12-
constexpr auto CEC_STORAGE{"/home/ewarchul/open-source/optim/cec/data"};
11+
constexpr auto DIMENSION{10u};
12+
constexpr auto CEC_STORAGE{"/home/ewarchul/open-source/optim/cecxx/data"};
1313

1414
namespace rv = ranges::views;
15+
using namespace cecxx;
1516

1617
auto main() -> int {
1718
try {
1819
// Create an evaluator object for the CEC2017 benchmark
19-
auto cec2017_eval = cecxx::benchmark::evaluator(cecxx::benchmark::cec_edition_t::cec2017, DIMENSION, CEC_STORAGE);
20+
auto cec2017_eval = benchmark::evaluator(
21+
cecxx::benchmark::cec_edition_t::cec2017, DIMENSION, CEC_STORAGE);
2022

2123
// Prepare input which resembles multidimensional array
22-
const auto input = std::vector<std::vector<double>>{rv::repeat(10.0) | rv::take(DIMENSION) | ranges::to_vector};
24+
const auto input = std::vector<std::vector<f64>>{
25+
rv::repeat(10.0) | rv::take(DIMENSION) | ranges::to_vector};
26+
27+
2328

2429
// Evaluate given input on each optimization problem from CEC2017
2530
const auto start = std::chrono::system_clock::now();
26-
for (const auto& fn : rv::closed_iota(1, 30)) {
31+
for (const auto &fn : rv::closed_iota(11, 11)) {
2732
auto output = cec2017_eval(fn, input);
2833
fmt::println("fn = {}, output = {:}", fn, output);
2934
}
3035
fmt::println("Elapsed time: {}",
31-
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - start));
36+
std::chrono::duration_cast<std::chrono::microseconds>(
37+
std::chrono::system_clock::now() - start));
3238

3339
return EXIT_SUCCESS;
3440
// Create a closure for 1st optimizaiton problem from CEC2017
35-
const auto first_fn = [&eval = cec2017_eval](const auto& xs) { return eval(11, xs); };
41+
const auto first_fn = [&eval = cec2017_eval](const auto &xs) {
42+
return eval(11, xs);
43+
};
3644
auto output = first_fn(input);
3745
// fmt::println("fn = 11, output = {}", output);
3846

39-
} catch (std::exception& e) {
47+
} catch (std::exception &e) {
4048
fmt::println("Error: {}", e.what());
4149
}
4250

0 commit comments

Comments
 (0)