| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cmath> | ||
| 4 | #include <string> | ||
| 5 | #include <tuple> | ||
| 6 | |||
| 7 | #ifndef M_PI | ||
| 8 | # define M_PI 3.14159265358979323846 | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include "task/include/task.hpp" | ||
| 12 | |||
| 13 | namespace kruglova_a_2d_multistep_par_opt { | ||
| 14 | |||
| 15 | struct InType { | ||
| 16 | double x_min; | ||
| 17 | double x_max; | ||
| 18 | double y_min; | ||
| 19 | double y_max; | ||
| 20 | double eps; | ||
| 21 | int max_iters; | ||
| 22 | |||
| 23 | 60 | InType() : x_min(0.0), x_max(0.0), y_min(0.0), y_max(0.0), eps(0.0), max_iters(0) {} | |
| 24 | |||
| 25 | InType(double xmin, double xmax, double ymin, double ymax, double e, int iters) | ||
| 26 | 60 | : x_min(xmin), x_max(xmax), y_min(ymin), y_max(ymax), eps(e), max_iters(iters) {} | |
| 27 | }; | ||
| 28 | |||
| 29 | struct OutType { | ||
| 30 | double x; | ||
| 31 | double y; | ||
| 32 | double f_value; | ||
| 33 | |||
| 34 | 60 | OutType() : x(0.0), y(0.0), f_value(0.0) {} | |
| 35 | |||
| 36 | OutType(double x_val, double y_val, double f_val) : x(x_val), y(y_val), f_value(f_val) {} | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct Interval1D { | ||
| 40 | double a, b; | ||
| 41 | double f_a, f_b; | ||
| 42 | double characteristic; | ||
| 43 | int iteration; | ||
| 44 | }; | ||
| 45 | |||
| 46 | struct Trial { | ||
| 47 | double point; | ||
| 48 | double value; | ||
| 49 | }; | ||
| 50 | |||
| 51 | using TestType = std::tuple<std::string, InType>; | ||
| 52 | using BaseTask = ppc::task::Task<InType, OutType>; | ||
| 53 | |||
| 54 | 41349 | inline double ObjectiveFunction(double x, double y) { | |
| 55 | constexpr double kA = 10.0; | ||
| 56 | constexpr double kN = 2.0; | ||
| 57 | 41349 | return (kA * kN) + (x * x) + (y * y) - (kA * (std::cos(2.0 * M_PI * x) + std::cos(2.0 * M_PI * y))); | |
| 58 | } | ||
| 59 | |||
| 60 | } // namespace kruglova_a_2d_multistep_par_opt | ||
| 61 |