Closed Peter230655 closed 3 months ago
These kinds of settings are in ipopt. Refer to https://coin-or.github.io/Ipopt/OPTIONS.html for more ipopt settings.
To specify an option you can use the Problem.add_option
method. In this case you can change the maximum number of iterations using:
prob.add_option("max_iter", 4000) # 3000 is the default
However, I would recommend that you look through your problem definition because it is most likely there is something wrong there.
If you are hitting max iterations, it more likely means you need improvements to your optimal control problem design, initial guess, interval choice, etc. Optimization problems rarely converge with default inputs and settings. In these types of optimizations you often have to solve a series of simpler problems to generate a good initial guess for the final problem.
Thanks both of you!
- Making num_nodes larger with given duration should help, right?
No, I would say that it actually makes it harder to solve in general. The optimization algorithm will require tuning more variables while also satisfying more constraints. At the same time, I should mention that too few nodes can make something impossible to solve.
2. The result of the simpler problem would be the initial guess for the harder one, correct?
Yes, there are various options (I know of):
3. My experience with optimization problems is very, very limited. In general, is it easier to solve if fewer constraints are imposed? My first feeling is YES, but then again more constraints may limit the 'space to be searched' thus making it easier. I simply do not know.
Mine is also limited, but I would also in general say that fewer constraints make it easier to solve a problem in the general case. My experience is that you should try to minimize your instance constraints.
Thanks!! What I am playing around with is the inverted pendulum attached to a cart, just in 3D. What I have done so far is this: I loop around the problem, starting with the pendulum being almost vertically up, and use the solution to this problem as initial guess for the pendulung a bit more away from the vertical, and so on. This seems to work fine until the pendulum is almost horizontal, but if it is below the horizontal it does not seem to work, yet. I will keep you posted as I run more trials.
I can have a quick look at the problem definition if you like (feel free to mail it).
I sent by separate mail.
I am trying an inverted pendulum, but in 3D, and I get this message:
message from optimizer: b'Maximum number of iterations exceeded (can be specified by an option).'
I cannot find from the documentation where I could specify the number of operations.
Thanks for any help!