필터 지우기
필터 지우기

Proper set up of fmincon including ODEs

조회 수: 1 (최근 30일)
Brendan Görres
Brendan Görres 2019년 1월 6일
댓글: Torsten 2019년 1월 8일
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
Brendan Görres
Brendan Görres 2019년 1월 8일
@Torsten
But if I leave alpha as a variable without the function
alpha=atan(y/x);
the ode45 cannot solve the equations. Or if I input alpha to fmincon as X0, how could I pass my constraints(that are only on x and y and not on alpha) to fmincon, because then the matrix for the linear inequality constraints has 2 rows and 2 columns while the X0 would just be alpha(0) and that is not solvable.
And that is exactly my problem. I do not know what Inputs I should give fmincon in this example, because I couldn't find anything similar while browsing..
Torsten
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 CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by