Hi @Nikku ,
Runge Kutta is an iterative method to solve approximately differential equations, so you could just implement the loop and run it without using AMPL. What is your optimization problem?
You can indeed implement Runge Kutta in ampl by writing the proper “for” loop, but that’s not ampl purpose.
Another different question would be to define a new RK method by generating a Butcher tableau following some rules. You could use the coefficients in the table as variables, and impose some relations between them (constraints) while minimizing some sort of error for the method. That optimization problem could be solved with ampl, and then you could use the result to implement RK methods. You could use ampl API for Python, Matlab or another programming language so you can run ampl and then run Runge Kutta in the same script easily.
What kind of project/homework are you working on? Some weeks ago there was a similar thread from another user about Runge Kutta: