The manipulation of deformable linear objects (DLOs) by robots is challenging because of the complexity of modeling DLO dynamics. Although previous studies generally employed physical models and data-driven approaches to simulate DLO deformations, only a few studies have considered the contact of DLOs with the environment. In this study, we propose a framework integrating differentiable simulations with neural networks (NNs) to generate manipulation trajectories that avoid contact and achieve the goal shape. First, we implement a differentiable simulation to simulate the deformation and interaction of DLOs via position-based dynamics. Thereafter, we utilize the backpropagation of losses from the differentiable simulation to optimize the parameters affecting the deformation of DLOs in the simulator and explore an ideal manipulation trajectory for the task via an NN controller. The simulation and real-world experimental results reveal that the proposed method can generate valid manipulation trajectories from offline learning, which can also function well in real-world applications using the optimized parameters.