Simulation and Optimization of Fused Deposition Modeling