Skip to content

Commit 76e13bb

Browse files
committed
bugfix for new calibration algorithm of Naive
1 parent 0a8796d commit 76e13bb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: faultference/faultference_utils.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ set<int> LocalizeViaNobody(LogData *data, int ntraces, string fail_file,
355355

356356
map<Flow *, map<int, int>> path_per_link_per_flow;
357357
map<Flow *, int> min_path_per_link_per_flow;
358+
int min_path_per_link = 1000;
358359
for (Flow *flow : data[0].flows) {
359360
vector<Path *> *flow_paths = flow->GetPaths(max_finish_time_ms);
360361
for (Path *path : *flow_paths) {
@@ -367,10 +368,12 @@ set<int> LocalizeViaNobody(LogData *data, int ntraces, string fail_file,
367368
path_per_link_per_flow[flow][link_id] += 1;
368369
}
369370
}
370-
auto [_, min_value] = (*min_element(path_per_link_per_flow[flow].begin(), path_per_link_per_flow[flow].end()));
371-
min_path_per_link_per_flow[flow] = min_value;
371+
for(auto it = path_per_link_per_flow[flow].begin(); it != path_per_link_per_flow[flow].end(); ++it) {
372+
if (it->second <= min_path_per_link){
373+
min_path_per_link = it->second;
374+
}
375+
}
372376
}
373-
auto [_, min_path_per_link] = (*min_element(min_path_per_link_per_flow.begin(), min_path_per_link_per_flow.end()));;
374377

375378
for (int ii = 1; ii < ntraces; ii++) {
376379
set<int> new_localized_devices;
@@ -440,8 +443,8 @@ int IsProblemSolved(LogData *data, double max_finish_time_ms, const int min_path
440443
cout << "Old equation: " << float(failed_flows)/total_flows << " <= " << failure_threshold / shortest_paths << endl;
441444
cout << "New equation: " << float(failed_flows) << " <= " << mean - 3*std_dev << endl;
442445

443-
if (float(failed_flows) / total_flows <= failure_threshold / shortest_paths) {
444-
// if (failed_flows <= mean - 3*std_dev) {
446+
// if (float(failed_flows) / total_flows <= failure_threshold / shortest_paths) {
447+
if (failed_flows <= mean - 3*std_dev) {
445448
return 1;
446449
}
447450
return 0;

0 commit comments

Comments
 (0)