[1044] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
[1120] | 2 | // Copyright (C) 1999-2021 Maciej Komosinski and Szymon Ulatowski. |
---|
[1044] | 3 | // See LICENSE.txt for details. |
---|
| 4 | |
---|
| 5 | #ifndef DISTRIBUTION_MEASURE_H |
---|
| 6 | #define DISTRIBUTION_MEASURE_H |
---|
| 7 | |
---|
[1048] | 8 | #include "simil-measure-base.h" |
---|
[1044] | 9 | #include "EMD/emd.h" |
---|
[1120] | 10 | #include <random> |
---|
[1044] | 11 | |
---|
[1048] | 12 | class SimilMeasureDistribution : public SimilMeasureBase |
---|
[1044] | 13 | { |
---|
| 14 | public: |
---|
| 15 | SimilMeasureDistribution(); |
---|
[1120] | 16 | ~SimilMeasureDistribution() {}; |
---|
[1044] | 17 | int setParams(std::vector<double> params); |
---|
| 18 | void calculateFuns(); |
---|
[1120] | 19 | void calculateFun(std::pair<double, float> *fun, const Model &sampled); |
---|
[1044] | 20 | double compareFuns(); |
---|
| 21 | double EMD(std::pair<double, float> *fun1, std::pair<double, float> *fun2); |
---|
| 22 | double density; |
---|
| 23 | int samples_num; |
---|
| 24 | int bin_num; |
---|
| 25 | /// Interface to local parameters |
---|
| 26 | Param localpar; |
---|
| 27 | |
---|
| 28 | protected: |
---|
| 29 | std::pair<double, float> *funs[2]; |
---|
| 30 | SolidsShapeTypeModel *sst_models[2]; |
---|
[1120] | 31 | void (SimilMeasureDistribution::*distribution_fun)(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
[1044] | 32 | |
---|
| 33 | void fillPointsWeights(std::pair<double, float> *fun, feature_t *points, float *weights); |
---|
| 34 | double getDistance(); |
---|
[1120] | 35 | void D2(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
| 36 | void D1(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
| 37 | void D3(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
| 38 | void D4(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
| 39 | void A3(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
| 40 | |
---|
| 41 | private: |
---|
| 42 | std::mt19937 rndgen; |
---|
[1044] | 43 | }; |
---|
| 44 | |
---|
| 45 | #endif /* DISTRIBUTION_MEASURE_H */ |
---|
| 46 | |
---|