This paper considers the problem of optimizing the schedule of modes in a linear time-varying switched system subject to a quadratic cost functional. The switched system optimization is formulated as an infinite-dimensional optimal control problem where a projection-based technique handles an integer constraint. In the proposed implementation, only a single set of differential equations needs to be solved off-line, with no additional simulation required during the optimization. Robustness to numerical errors is enhanced as these differential equations are as smooth as the system's vector fields, despite the optimization itself being non-smooth. An example demonstrates the optimization algorithm steps and verifies feasibility and convergence.