for line in content_reader: for i in range(num_methods-1): for j in range(MAX_ROBOTS): samples[i][j].append(-float(line[i+num_methods*j])) with open(sys.argv[2], 'rb') as csvfile: content_reader = csv.reader(csvfile, delimiter=',') for line in content_reader: samples[num_methods-1][0].append(-float(line[0])) samples2 = samples[1:3] + samples[:1] + samples[4:] + samples[3:4] yticklabels = [str(-x) for x in range(10)] fig, ax, rects, means= \ graph.draw_bar_chart(samples2, ["Heuristic", "HeuristicImproved", "SingleRobot", "UCT-NSM", "UCT"], second_level_names=('',), yticklabels=yticklabels, xlabel='Different Approaches', ylabel='Normalized Reward (negated)') plt.axhline(y=0.0, xmin=0, xmax=2, linewidth=1, color="black") plt.axis([-rects[0][0].get_width(), (num_methods + 1)*rects[0][0].get_width(), 0, 9]) fig = plt.gcf() fig.set_size_inches(5.5,5.5)#2.3,4) plt.savefig('out.png',bbox_inches='tight',pad_inches=0.1,dpi=150) plt.show() # pylab.figure() # for method in range(num_methods): # pylab.hist(samples[method][4], [1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 20.0, 50.0, 100.0], histtype='step', label=method_names[method])
print 'Reading from: ' + sys.argv[1] with open(sys.argv[1], 'rb') as csvfile: content_reader = csv.reader(csvfile, delimiter=',') for line in content_reader: if str(line[0]) == 'heuristic': for i in range(MAX_ROBOTS): print 2 + 2*i samples[0][i].append(float(line[2 + 2*i]) / shortest_distances[i]) else: for i in range(MAX_ROBOTS): samples[1][i].append(float(line[2 + 2*i]) / shortest_distances[i]) fig, ax, rects, means= \ graph.draw_bar_chart(samples, method_names, ('1 Robot', '2 Robots', '3 Robots', '4 Robots', '5 Robots'), title='Average Normalized Distance', ylabel='Normalized Distance') sigs = None if num_methods == 2: sigs = [] for robots in range(MAX_ROBOTS): sig = graph.is_significant(samples[0][robots], samples[1][robots]) if sig: print "For " + str(robots + 1) + " robots, diff is significant" else: print "For " + str(robots + 1) + " robots, diff is not significant" sigs.append(sig) #attach some text labels
for j in range(MAX_ROBOTS): samples[i].append([]) first = True print 'Reading from: ' + sys.argv[2] with open(sys.argv[2], 'rb') as csvfile: content_reader = csv.reader(csvfile, delimiter=',') for line in content_reader: for i in range(num_methods): for j in range(MAX_ROBOTS): samples[i][j].append(float(line[i + num_methods*j])) fig, ax, rects, means= \ graph.draw_bar_chart(samples[:1] + samples[-1:] + samples[1:3], method_names[:1] + method_names[-1:] + method_names[1:3], ('1 Robot', '2 Robots', '3 Robots', '4 Robots', '5 Robots'), ylabel='Normalized Time Taken', xlabel='maxRobots') sigs = [] for robots in range(MAX_ROBOTS): sig = graph.is_significant(samples[2][robots], samples[1][robots]) if sig: print "For " + str(robots + 1) + " robots, diff is significant" else: print "For " + str(robots + 1) + " robots, diff is not significant" sigs.append(sig) print sigs #attach some text labels if sigs:
for j in range(MAX_ROBOTS): samples[i].append([]) first = True print "Reading from: " + sys.argv[2] with open(sys.argv[2], "rb") as csvfile: content_reader = csv.reader(csvfile, delimiter=",") for line in content_reader: for i in range(num_methods): for j in range(MAX_ROBOTS): samples[i][j].append(float(line[i + num_methods * j])) fig, ax, rects, means = graph.draw_bar_chart( samples, method_names, ("1 Robot", "2 Robots", "3 Robots", "4 Robots", "5 Robots"), title="Average Normalized Distance", ylabel="Normalized Distance", ) sigs = None if num_methods == 2: sigs = [] for robots in range(MAX_ROBOTS): sig = graph.is_significant(samples[0][robots], samples[1][robots]) if sig: print "For " + str(robots + 1) + " robots, diff is significant" else: print "For " + str(robots + 1) + " robots, diff is not significant" sigs.append(sig)