def show_reduction_steps(self, report, max_nsteps): nsteps, nplans, ncplans = self.compute_reduction_steps(max_nsteps) report.data('nsteps', nsteps) report.data('nplans', nplans) report.data('ncplans', ncplans) f = report.figure() caption = """ Efficient plan generations. Let L be the length, N the number of commands, and P the number of plans The naive grows exponentially. P_naive ~= N ^ L The reduced grows according to the ambient space. If the topology is that of Reals^K, then it grows like P_smart ~= L ^ K this is the *volume* of the area. Usually the number of commands is N = 2*K So we have: N^L vs L^(N/2) The logarithm is log(P_naive) = log(N) * L log(P_smart) = N * log(L) So fixing N and plotting as a function of L and in logarithmic coordinates, we have that the first plot should be a line, and the second one a logarithm. """ report.text('explanation', caption) xp = range(1, 6) params = dict(figsize=(4.5, 4.5)) with f.plot('reduction', **params) as pylab: pylab.semilogy(nsteps, nplans, 's-', label='naive') pylab.semilogy(nsteps, ncplans, 'o-', label='reduced') pylab.legend(loc='upper left') pylab.xticks(xp, xp) pylab.xlabel('plan length (L)') pylab.ylabel('number of plans (P)') x_axis_extra_space(pylab) with f.plot('reduction2', **params) as pylab: pylab.semilogy(nsteps, nplans, 's-', label='naive') pylab.semilogy(nsteps, ncplans, 'o-', label='reduced') pylab.xticks(xp, xp) pylab.xlabel('plan length (L)') pylab.ylabel('number of plans (P)') x_axis_extra_space(pylab)
def figure_style1(pylab): f = pylab.gcf() size = 1.57 * 3 ratio = 1 f.set_size_inches((size, size * ratio)) ieee_spines(pylab) yield pylab y_axis_extra_space(pylab) x_axis_extra_space(pylab)
def plot_style_sensels(pylab): y_axis_set(pylab, -0.1, 1.1) x_axis_extra_space(pylab)
def plot_style_sensels_deriv(pylab): y_axis_set(pylab, -0.1, 0.1) x_axis_extra_space(pylab)