Factored Task and Motion Planning with Combined Optimization, Sampling and Learning