fmincon with interior point method vs CasADi with IPOPT
98 次查看(过去 30 天)
显示 更早的评论
I have a question about the solver differences between MATLAB's fmincon interior-point solver and CasADi's IPOPT solver. From what I understand, they both fall under the class of interior-point methods, where IPOPT is said to be better suited for high-dimensional optimization problems. I have implemented an MPC problem for autonomous vehicle motion planning with both fmincon and CasADi, using the interior-point method and IPOPT, respectively.
Problem Setup:
- The MPC problem is formulated in the Frenet coordinate frame, where the states are:
- Longitudinal distance from the road's center.
- Lateral distance from the road's center.
- Heading angle.
- Speed.
- The control inputs are acceleration and steering angle.
- The neural network model used is a feedforward neural network with:One hidden layer consisting of 512 neurons and tanh activation.
- Inputs: 4 state variables and 2 control inputs.
- Outputs: Derivatives of the states, which are integrated using Euler integration to obtain the next state.
- Collision avoidance inequality constraint with Euclidean distance after transforming the Frenet state to a Cartesian state.
Warm Start: The first MPC problem at timestep 1 is initialized with the available nominal trajectory to be tracked. Subsequent MPC problems are warm-started with solutions shifted one step ahead from the previous timestep's MPC solution.
Solver Details:
- fmincon: Provided with analytical gradients and Jacobians of both the cost function and the neural network equality constraint.
- CasADi (IPOPT): Uses automatic differentiation based on a computational graph (please correct me if this understanding is incorrect).
Observations:
- CasADi with IPOPT is faster in computation time but struggles to converge to a cost value comparable to fmincon.
- The problem is non-convex due to the neural network equality constraints and Euclidean distance inequality constraints for collision avoidance.
| Horizon | Method | Cost Value | Average Computation Time for All MPCs (s) |
| 10 | CasADi | 26,132.95 | 0.143 |
| 10 | fmincon | 17,912.42 | 8.162 |
| 20 | CasADi | 47,528.11 | 2.356 |
| 20 | fmincon | 18,852.66 | 23.57 |
Questions for Discussion:
- Why might IPOPT (CasADi) struggle to converge to a cost value similar to fmincon despite being faster?
- Does automatic differentiation in CasADi have limitations when dealing with non-convex constraints, especially those involving neural networks?
- Are there recommended settings or strategies to improve the convergence performance of IPOPT in non-convex MPC problems?
Notes:
- I am willing to share implementation code for both solvers if anyone needs a more detailed analysis.
- Any insights or recommendations would be greatly appreciated!
Thanks in advance for your time and help!
5 个评论
Torsten
2024-11-3,1:12
I however would not want to simplify the problem as the premise of my approach is aruged based on such difficlt optimization problems involving neural network state-space models.
What I wrote is that I would start with a simpler problem. I think it's hopeless to compare codes with such complex problems if the aim is to analyse and explain different behaviour. If you simply wanted to describe and contrast reliability and performance, the difficulty of the problem wouldn't matter.
But there are other forum members around who have more experience with the topic of MPC. They might be able to comment more specifically than I can.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Refinement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!