Optimization-based Task and Motion Planning under Signal Temporal Logic Specifications using Logic Network Flow