X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar2.git/blobdiff_plain/b3b6439b1666c8be96c268c977c258e49639c121..b282229be03a242d09a7c0c6315a823aa1188f42:/src/template-with-reset.cc diff --git a/src/template-with-reset.cc b/src/template-with-reset.cc index 75a1776..3060190 100644 --- a/src/template-with-reset.cc +++ b/src/template-with-reset.cc @@ -75,6 +75,7 @@ int main() unsigned int icnt = 0; unsigned int rcnt = 0; unsigned int bcnt = 0; + unsigned int ncnt = 0; // not better counter Json::Value best_path; Json::Value pj; double cost = 0.0; @@ -87,11 +88,19 @@ int main() double gc = pj["goal_cc"].asDouble(); assert(gc > 0.0); if (cost == 0.0 || gc < cost) { + if (gc < 0.75 * cost) { + ncnt = 0; + } best_path = pj["path"]; cost = gc; bcnt += 1; + } else { + ncnt++; } } + if (ncnt > 5) { + break; + } p.reset(); rcnt += 1; }