We deal with the numerical solution of time dependent problems with the aid of anisotropic $hp$-grids. We present an algorithm which generates a sequence of anisotropic triangular grids and the corresponding polynomial approximation degrees in such a way that the interpolation error measured in the discrete $L^\infty(0,T; L^q(\Omega))$-norm ($q\in[1,\infty]$ and $\Omega\subset\mathbb{R}^2$) is under a given tolerance and the number of degrees of freedom is as small as possible.
The efficiency of the algorithm is demonstrated by numerical experiments.