plotting runtime distributions runtime distribution uses matplotlib to plot runtime distributions here the runtime is misnomer as we are only plotting the number of stepsnot the time computing the runtime is non-trivial as many of the runs have very short runtime to compute the time accurately would require running the same codewith the same random seedmultiple times to get good estimate of the runtime this is left as an exercise cspsls py -(continued import matplotlib pyplot as plt class runtime_distribution(object)def __init__(selfcspxscale='log')"""sets up plotting for csp xscale is either 'linearor 'log""self csp csp plt ion(plt xlabel("number of steps"plt ylabel("cumulative number of runs"plt xscale(xscalemakes 'logor 'linearscale def plot_runs(self,num_runs= ,max_steps= prob_best= prob_anycon= )"""plots num_runs of sls for the given settings ""stats [slsearcher max_display_leveltemp_mdl slsearcher max_display_level no display for in range(num_runs)searcher slsearcher(self cspnum_steps searcher search(max_stepsprob_bestprob_anyconif num_stepsstats append(num_stepsstats sort(if prob_best > label " (best)= elsep_ac min(prob_anycon -prob_bestlabel " (best)= fp(ac)= (prob_bestp_acplt plot(stats,range(len(stats)),label=labelplt legend(loc="upper left"#plt draw(slsearcher max_display_leveltemp_mdl #restore display testing cspsls py -(continuedversion june