The optimal design of the stepped wedge trial and a comparison to other trial designs