meco-group / fatrop

Fatrop is a nonlinear optimal control problem solver that aims to be fast, support a broad class of optimal control problems and achieve a high numerical robustness.
https://meco-group.github.io/fatrop/
GNU Lesser General Public License v3.0
125 stars 16 forks source link

Can spectool do codegen for .so and .json files on python? #15

Open LeZH13 opened 2 months ago

LeZH13 commented 2 months ago

Hi, I know that rockit can generate .so and .json files for direct usage. But I am choosing spectool because the problem I am trying to solve have different stages. Can I do codegen on spectool for my problem just like on rockit? Thanks!

lvanroye commented 1 month ago

Hello,

I am currently working on allowing code-generation for fatrop spectool based on the casadi API. I expect to release it in the coming week.

Alternatively you might be interested to have a look at the casadi integration of fatrop.

Fatrop is being integrated as a solver by the casadi developers and will ship with the coming release. This means that you can use fatrop directly from casadi Opti. You'll only have to make sure that the problem is in the right structure and that you define your variables and constraints in a specific order. I recommend watching the tutorial video: https://www.youtube.com/watch?v=X-nS4i8jJyM&ab_channel=JorisGillis, you can already try it by `pip installing' a nightly casadi build: https://github.com/casadi/casadi/releases/tag/nightly-fatrop_nlp

It already supports codegen, which will enable you using fatrop in a similar fashion as the .so and ,json files (and without a casadi depedency).

Best. Lander

LeZH13 commented 1 month ago

Thanks for your reply! I'll look in to this. And I'll be looking forward to the codegen update.

Best, Zhanhao