Is it possible to formulate OCP with a neural model for cost function?

Dear Muhammad,

Have a look at this repo: GitHub - TUM-AAS/ml-casadi: Use PyTorch Models with CasADi and Acados

Or you can write a neural network using CasADi and load the trained neuron parameters, then follow every standard procedure of using acados. This might take some time, but I think it’s doable.

I’ve done something similar before, but I would say sometimes it’s unrealistic to expect the OCP solver to deal with such highly non-linear and non-convex problems.

I guess you can give a try to see how well it work. I suggest to allow multiple SQP iterations and enable line search with merit function. If the results are not satisfactory, maybe try to simplify the neural network with fewer layers and smaller width.

Sampling based method like Model Predictive Path Integral (MPPI) might also be an option.

Best,
Fenglong