Proper set up of fmincon including ODEs
2 ビュー (過去 30 日間)
古いコメントを表示
I am actually trying to understand how the fmincon function is used in a little more complex way(including solving ODE). So I thought of a little example for which I imagine a vehicle on a 2D object, like a table. So the vehicle can move in x and in y direction and it is supposed to "fly" through a given point(xf,yf) on the table which I defined as my equality constrained. The inequality constraints are just a region on the table where the vehicle is not allowed to fly through, so that it doesn't just fly in a straight line through xf,yf. The vehicle should not leave the table so I defined the upper and lower bounds fir the tables geometry. Also right now they include Acceleration in x and y direction and the limits of the vehicle mass(so that the mass is never negative).
My vehicle has a thruster, propellant and therefore a propellant flow.
My objective of this little example is to write a code that returns me the optimal trajectory(so the alpha is the control variable), so that the vehicle reaches xf,yf with the max. propellant(mp) possible. Obviously this is a Maximization problem, that is why I used mp=-....
The problem right now is that I don't understand how my Optimizer can return an optimal value for mp at the final time(And not just the highest possible mass, which is obviously at the beginning) .
Are the other variables I have(alpha,x,y,ax,ay) all to be defined as one control variable in form of a vector and if so how and when do I need to pass them to my Optimizer, because again I just want to output an optimal mpfinal and then plot the flight trajectory and the change of alpha in another step out of the results.
I attached my recent code
Hope someone can help
8 件のコメント
Torsten
2019 年 1 月 8 日
Optimal control problems contain functions as unknown objects, not single values.
So alpha = (alpha(1),alpha(2),...,alpha(n)) would be your X vector for fmincon to optimized. Here, alpha(i) corresponds to alpha at a certain time t_i between tstart and tend.
To use this vector alpha within your ODEs, you can use interpolation to the time t the integrator has reached.
Using this vector alpha, you get certain derived quantities, e.g. (x(1),...x(n)) and (y(1),...,y(n)). Constraints on these values can be set in function "nonlcon".
I strongly recommend that you consult a book on optimal control.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!