fixed some issues with stats::variance
fixed umbrella header for stats added error-feedback to wifi optimizers improved logging for wifi optimizers adjusted calling-API for wifi-optimizers
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
#include "WiFiFingerprint.h"
|
||||
#include "WiFiFingerprints.h"
|
||||
|
||||
#include "../model/WiFiModel.h"
|
||||
#include "../model/WiFiModelLogDistCeiling.h"
|
||||
#include "../model/WiFiModels.h"
|
||||
//#include "../model/WiFiModelLogDistCeiling.h"
|
||||
|
||||
#include <KLib/math/optimization/NumOptAlgoDownhillSimplex.h>
|
||||
#include <KLib/math/optimization/NumOptAlgoGenetic.h>
|
||||
@@ -35,12 +35,6 @@ namespace WiFiOptimizer {
|
||||
|
||||
public:
|
||||
|
||||
enum class Mode {
|
||||
FAST,
|
||||
MEDIUM,
|
||||
QUALITY,
|
||||
};
|
||||
|
||||
/**
|
||||
* resulting optimization stats for one AP
|
||||
*/
|
||||
@@ -112,6 +106,13 @@ namespace WiFiOptimizer {
|
||||
APParamsMAC(const MACAddress mac, const APParams& params) : mac(mac), params(params) {;}
|
||||
};
|
||||
|
||||
struct OptResultStats {
|
||||
K::Statistics<float> avgApErrors; // contains one average-error per optimized AP
|
||||
K::Statistics<float> singleFPErrors; // contains one error for each fingerprint<->ap SIGNED
|
||||
K::Statistics<float> singleFPErrorsAbs; // contains one error for each fingerprint<->ap ABSOLUTE
|
||||
|
||||
};
|
||||
|
||||
class APParamsList {
|
||||
|
||||
std::vector<APParamsMAC> lst;
|
||||
@@ -182,12 +183,15 @@ namespace WiFiOptimizer {
|
||||
}
|
||||
|
||||
/** optimize all known APs */
|
||||
APParamsList optimizeAll(APFilter filter) const {
|
||||
APParamsList optimizeAll(APFilter filter, OptResultStats* dst = nullptr) const {
|
||||
|
||||
// sanity check
|
||||
Assert::isFalse(getAllMACs().empty(), "no APs found for optimization! call addFingerprint() first!");
|
||||
|
||||
float errSum = 0; int errCnt = 0;
|
||||
K::Statistics<float> avgErrors;
|
||||
K::Statistics<float> singleErrors;
|
||||
K::Statistics<float> singleErrorsAbs;
|
||||
|
||||
std::vector<APParamsMAC> res;
|
||||
for (const MACAddress& mac : getAllMACs()) {
|
||||
|
||||
@@ -198,8 +202,13 @@ namespace WiFiOptimizer {
|
||||
// filter based on stats (option to ignore/filter some access-points)
|
||||
if (!filter(stats, mac)) {
|
||||
res.push_back(APParamsMAC(mac, params));
|
||||
errSum += stats.error_db;
|
||||
++errCnt;
|
||||
//errSum += stats.error_db;
|
||||
//++errCnt;
|
||||
avgErrors.add(stats.error_db);
|
||||
for (const auto e : stats.errors) {
|
||||
singleErrors.add(e.getError_db());
|
||||
singleErrorsAbs.add(std::abs(e.getError_db()));
|
||||
}
|
||||
} else {
|
||||
Log::add(name, "ignoring opt-result for AP " + mac.asString() + " due to filter");
|
||||
//std::cout << "ignored due to filter!" << std::endl;
|
||||
@@ -207,9 +216,19 @@ namespace WiFiOptimizer {
|
||||
|
||||
}
|
||||
|
||||
const float avgErr = errSum / errCnt;
|
||||
Log::add(name, "optimized APs: " + std::to_string(errCnt));
|
||||
Log::add(name, "average AP error is: " + std::to_string(avgErr) + " dB");
|
||||
//const float avgErr = errSum / errCnt;
|
||||
//Log::add(name, "optimized APs: " + std::to_string(errCnt));
|
||||
//Log::add(name, "average AP error is: " + std::to_string(avgErr) + " dB");
|
||||
Log::add(name, "optimization result: ");
|
||||
Log::add(name, " - AvgPerAP " + avgErrors.asString());
|
||||
Log::add(name, " - Single: " + singleErrors.asString());
|
||||
Log::add(name, " - SingleAbs: " + singleErrorsAbs.asString());
|
||||
|
||||
if (dst) {
|
||||
dst->avgApErrors = avgErrors;
|
||||
dst->singleFPErrors = singleErrors;
|
||||
dst->singleFPErrorsAbs = singleErrorsAbs;
|
||||
}
|
||||
|
||||
// done
|
||||
return APParamsList(res);
|
||||
@@ -237,7 +256,7 @@ namespace WiFiOptimizer {
|
||||
const std::vector<LeOpt::MinMax> valRegion = {
|
||||
LeOpt::MinMax(mapBBox.getMin().x - 20, mapBBox.getMax().x + 20), // x
|
||||
LeOpt::MinMax(mapBBox.getMin().y - 20, mapBBox.getMax().y + 20), // y
|
||||
LeOpt::MinMax(mapBBox.getMin().z - 5, mapBBox.getMax().z + 5), // z
|
||||
LeOpt::MinMax(mapBBox.getMin().z - 6, mapBBox.getMax().z + 6), // z
|
||||
LeOpt::MinMax(-50, -30), // txp
|
||||
LeOpt::MinMax(1, 4), // exp
|
||||
LeOpt::MinMax(-15, -0), // waf
|
||||
@@ -258,7 +277,7 @@ namespace WiFiOptimizer {
|
||||
opt.setNumIerations(100);
|
||||
break;
|
||||
case Mode::QUALITY:
|
||||
opt.setPopulationSize(500);
|
||||
opt.setPopulationSize(1500);
|
||||
opt.setNumIerations(150);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user