f.write("\t total time (min / avg / max / % of total / % of total wtht path planning):\n\t "+str(d['total_'+n+'_min'])+"\t"+str(d['total_'+n])+"\t"+str(d['total_'+n+'_max'])+"\t"+str(float(d['total_'+n])/tTime*100)+"%"+"\t"+str(float(d['total_'+n])/g_time*100)+"%\n")

f.write("\t number of tests (min / avg / max):\n\t "+str(d['minnum'+n])+"\t"+str(d['num'+n])+"\t"+str(d['maxnum'+n])+"\n")

defprintOneStatOptim(f,name,data):

n=name

d=data

print(n,len(d[n]))

d[n]=avg(d[n])

d['num'+n]=avg(d['num'+n])

d['total_'+n]=avg(d['total_'+n])

f.write(n+" tests: \n")

f.write("\t single operation time (min / avg / max):\n\t "+str(d[n+'_min'])+"\t"+str(d[n])+"\t"+str(d[n+'_max'])+"\t\n")

f.write("\t total time (min / avg / max ):\n\t "+str(d['total_'+n+'_min'])+"\t"+str(d['total_'+n])+"\t"+str(d['total_'+n+'_max'])+"\t"+"%\n")

f.write("\t number of tests (min / avg / max):\n\t "+str(d['minnum'+n])+"\t"+str(d['num'+n])+"\t"+str(d['maxnum'+n])+"\n")

f.write("% of failed contact generation (no candidates found): "+str(nc/tc*100)+"%\n")

f.write("% of unstable contact generation (no balanced candidates found): "+str(uc/tc*100)+"%\n")

f.write("\n")

if(d["optim_num_trials"]>0):

f.write("***********************%\n")

f.write(" optimization related data %\n")

f.write("% succes rate of optimization: "+str(d["optim_num_success"]/d["optim_num_trials"]*100)+"%\n")

f.write("% succes rate of optimization disregarding collision: "+str(d["optim_num_success"]/(d["optim_num_trials"]-d["optim_error_com_proj"])*100)+"%\n")

if(d["num_errors"]>0):

f.write("% errors due to problem infeasibility (% of errors, % over all trials): "+str(d["optim_error_optim_fail"]/d["num_errors"]*100)+" "+str(d["optim_error_optim_fail"]/d["optim_num_trials"]*100)+"%\n")

f.write("% errors due to unknown reasons (% of errors, % over all trials): "+str(d["optim_error_unknown"]/d["num_errors"]*100)+" "+str(d["optim_error_unknown"]/d["optim_num_trials"]*100)+"%\n")