p.p_goal_.tstart();
pthread_create(&rt, NULL, &next_run, (void *) &ra);
pthread_create(>, NULL, &next_run, (void *) &ga);
+ int tol = 0;
+ int ndl = 0;
+ bool ndone = true;
while (!gf && p.elapsed() < TMAX &&
p.p_root_.nodes().size() < NOFNODES &&
p.p_goal_.nodes().size() < NOFNODES) {
// overlap trees
+ ndone = true;
for (int i = 0; i < IXSIZE; i++) {
for (int j = 0; j < IYSIZE; j++) {
if (p.p_root_.ixy_[i][j].changed() &&
p.p_goal_.ixy_[i][j].changed()) {
+ndone = false;
for (auto rn: p.p_root_.ixy_[i][j].nodes()) {
for (auto gn: p.p_goal_.ixy_[i][j].nodes()) {
if (rn->ccost() + gn->ccost() < mc &&
}
}}
}
+ tol++;
+ if (ndone)
+ ndl++;
p.tend();
if (p.elapsed() >= TMAX)
goto escapeloop;
escapeloop:
pthread_join(rt, NULL);
pthread_join(gt, NULL);
+ float nodo = ((float) ndl / (float) tol);
+ std::cerr << "nothing done is " << 100.0 * nodo;
+ std::cerr << "%" << std::endl;
+ //std::cerr << "rgf is " << p.p_root_.goal_found() << std::endl;
+ //std::cerr << "ggf is " << p.p_goal_.goal_found() << std::endl;
+ //std::cerr << "cgf is " << p.goal_found() << std::endl;
if (p.p_root_.goal_found() && p.p_root_.goal()->ccost() < mc) {
ron = p.p_root_.goal()->parent();
gon = p.p_root_.goal();
// JSON output
jvo["elap"] = p.elapsed();
+ jvo["nodo"][0] = nodo;
// log cost
for (j = 0; j < p.clog().size(); j++)
jvo["cost"][j] = p.clog()[j];
plt.legend()
plt.show()
+def plot_nothingdone():
+ """Plot *nothing done* time of ``overlaptrees`` procedure."""
+ v = {}
+ for a in r.keys():
+ v[a] = get_lasts_if_exist(r[a], "nodo")
+
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.set_title("Histogram of nothing-done-time")
+
+ ax.set_ylabel("Occurences [-]")
+ ax.set_xlabel("Nothing-done-time percentage [-]")
+
+ for a in LOG:
+ plt.hist(
+ v[a["f"]],
+ alpha = 0.5,
+ label = a["l"],
+ bins = np.arange(0, 1, 0.1),
+ histtype = "step",
+ color = a["c"])
+ try:
+ X_WHERE = np.percentile(v[a["f"]], [95])
+ plt.axvline(X_WHERE, lw=1, color=a["c"], linestyle="--")
+ except:
+ pass
+
+ plt.legend()
+ plt.show()
+
def print_nofnodes():
"""Print average number of nodes."""
v={}