What should be the optimization method for my case?

I have an optimization problem which I minimize rms of velocity output of ODE function. When optimization runs, in each iteration first-order optimality goes high and low and repeats. I have inequality constraints, 5 for positions and, 5 for velocities. What method should it be to solve my problem?
Note: The lowest value for rms of velocity is 0 but it means there is no movement at all but I consider it in my constraints.
Thank you for help.

 Accepted Answer

For such a general question I can give only general advice. See the topics Optimizing a Simulation or Ordinary Differential Equation and, perhaps (though it might not be applicable), Fit ODE, Problem-Based and Fit an Ordinary Differential Equation (ODE) and Optimize an ODE in Parallel (uses Global Optimization Toolbox, but you can use fmincon as well).
I hope this helps in some way,
Alan Weiss
MATLAB mathematical toolbox documentation

5 Comments

Ok, thanks for the answer. To be more clear, I have 4 optimization parameters to create a trajectory.
This trajectory is given to ODE solver which solves inverse dynamics of an underactuated robot. I am minimizing the oscillation (RMS of velocity and acceleration) of underactuated joints during robot motion. I am giving a fixed-time vector to ODE solver. In the end I don't want solver to fail, so I have a constraint that is checking ceq(1) = isequal( size(t_input), size(t_output) ) - 1. And other constraints such as at t_final I want underactuated joint velocities, accelerations to be 0. I was tring with sqp, sqp-legacy which at some point converges to a position that does not satisfy ceq(1) and problem fails. Global methods such as ga and patternsearch did not give me any answer because they evolved in a non-feasible solution. What would you suggest to do? Thanks for giving your precious time.
I'm not sure what you mean "In the end I don't want solver to fail, so I have a constraint that is checking ceq(1) = isequal( size(t_input), size(t_output) ) - 1." This is not a continuous, smooth constraint function, so I do not imagine that it is a helpful nonlinear constraint. You might do better to change the objective to NaN if the ODE solver fails.
But even more, do you understand why the ODE solver is failing? What happens? Perhaps you need to bound the optimization parameters to ensure that the ODE is sensible. I have found that to be the case in other ODE optimization problems. In summary, I suggest that you impose bounds on the optimization parameters and see if that helps.
Alan Weiss
MATLAB mathematical toolbox documentation
Thanks for the help, I will consider your proposals. The trajectory (generated by optimization parameters) is given to the ODE to get joint positions, velocities and accelerations of the robot. ODE fails because it cannot integrate for that given trajectory and I am using fixed time step "t=0:1/2000:t_final" in ODE solver. So, to prevent ODE to fail, I was giving "ceq(1) = isequal( size(t_input), size(t_output) ) - 1". fmincon with sqp-legacy was going in a direction and found x_f=[-185.34 1600.4 -6168.9 8719.2] but it was infeasible solution too. I am guessing my bound are really big and I am now sure there are many infeasible solutions everywhere like a minefield. Also, I have a problem with initial guess as well. I used x0 = Lb + rand(size(Lb)).*(Ub - Lb) method as well but it didn't help. I tried genetic algorithm, patternsearch, fmincon but non of them is converging a possible good solution.
Just one more thought. Perhaps you should not be using a fixed-step ODE solver. You can always get the solution at any times you like by using deval. Perhaps the solution process would be more reliable using a variable-step solver, possibly even one designed for stiff equations such as ode15s.
But maybe you know all this already. Sorry for wasting your time if so.
Alan Weiss
MATLAB mathematical toolbox documentation
I will try what you offer. I appreciate how fast you reply and bring ideas kind sir. Thank you, have a nice day.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!