Task-Optimal Exploration in Linear Dynamical Systems