Does someone has an experience in solving differential equations in AMPL? I googled a lot, but no suitable results... In google groups I've found a simple "hand-made" example, but it doesn't work... So, this example I found. Consider this ODE:
where a=0.2 is a parameter; x = state variable, between 0 and 9; u = input variable, between 0 and 5. You can write this in AMPL as follows (using textbook forward Euler):
The solution gives me zeros for u and x... It is no wonder because of this line
As far as I understood we need to represent the problem as a system of algebraic equations, but what will be a goal function in this case??? So, can somebody give any suggestions or proper examples? Thanks in advance.
asked
magneton_bora |

In your particular implementation, you didn't specify the initial value (x[0]) and the inputs (u[k]), so the problem is under-defined. Fix those degrees-of-freedom and you will get the solution to the ODE. And if you're finding the optimal input vector, then fix the x[0] and use a objective function (that isn't just the feasibility objective 0), and you will get some answer for u[k].
answered
Gilead ♦ |

As an example, consider the old Lunar Lander game. Your state consists of altitude, vertical velocity and fuel (plus mass in some versions). Your control variable is burn rate (which translates to thrust). The terminal condition is (hopefully) altitude zero with velocity zero. Possible objective functions are minimizing fuel burned or minimizing time to landing.
answered
Paul Rubin ♦♦ |