| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <vector> | ||
| 4 | |||
| 5 | #include "khruev_a_global_opt/common/include/common.hpp" | ||
| 6 | #include "task/include/task.hpp" | ||
| 7 | |||
| 8 | namespace khruev_a_global_opt { | ||
| 9 | |||
| 10 | class KhruevAGlobalOptMPI : public BaseTask { | ||
| 11 | public: | ||
| 12 | static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() { | ||
| 13 | return ppc::task::TypeOfTask::kMPI; | ||
| 14 | } | ||
| 15 | |||
| 16 | explicit KhruevAGlobalOptMPI(const InType &in); | ||
| 17 | bool ValidationImpl() override; | ||
| 18 | bool PreProcessingImpl() override; | ||
| 19 | bool RunImpl() override; | ||
| 20 | bool PostProcessingImpl() override; | ||
| 21 | |||
| 22 | private: | ||
| 23 | struct IntervalInfo { | ||
| 24 | double R; | ||
| 25 | int index; // индекс в массиве trials_ (указывает на правый конец интервала) | ||
| 26 | |||
| 27 | bool operator>(const IntervalInfo &other) const { | ||
| 28 |
16/22✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 806 times.
✓ Branch 5 taken 808 times.
✓ Branch 6 taken 300 times.
✓ Branch 7 taken 506 times.
✓ Branch 8 taken 282 times.
✓ Branch 9 taken 526 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1068 times.
✓ Branch 13 taken 4364 times.
✓ Branch 14 taken 11334 times.
✓ Branch 15 taken 4364 times.
✓ Branch 16 taken 15444 times.
✓ Branch 17 taken 12444 times.
✓ Branch 18 taken 19416 times.
✓ Branch 19 taken 12444 times.
✓ Branch 20 taken 36862 times.
✓ Branch 21 taken 13776 times.
|
133130 | return R > other.R; // Для сортировки по убыванию |
| 29 | } | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct Point { | ||
| 33 | double x, z; | ||
| 34 | }; | ||
| 35 | |||
| 36 | std::vector<Trial> trials_; | ||
| 37 | OutType result_{}; | ||
| 38 | |||
| 39 | double CalculateFunction(double t); | ||
| 40 | void AddTrialUnsorted(double t, double z); | ||
| 41 | |||
| 42 | double ComputeM(); | ||
| 43 | [[nodiscard]] std::vector<IntervalInfo> ComputeIntervals(double m) const; | ||
| 44 | bool LocalShouldStop(const std::vector<IntervalInfo> &intervals, int num_to_check); | ||
| 45 | [[nodiscard]] double GenerateNewX(int idx, double m) const; | ||
| 46 | void CollectAndAddPoints(const std::vector<Point> &global_res, int &k); | ||
| 47 | }; | ||
| 48 | |||
| 49 | } // namespace khruev_a_global_opt | ||
| 50 |