Hi,
I'm working on a project where I try to estimate some parameters with the use of MHE and collocation implementet in CasADi. The model which I'm using is a 1D spatial discretized advection equation. The number of states in my problem is the same as the number of spatial discretization points (the variable 'r' in my example).
The estimation works as long as i keep the number of states low, or the estimation horizon short. But if I set the number of states to 30, unknown parameters to 3 and an estimation horizon of 10, I get the following error: "RuntimeError: std::bad_alloc".
The error arises when I try to initialize the NLP solver(Ipopt).
I'm guessing that it might have to do with model that I use, which looks a bit complex/long if I use print f_rhs[0], but I'm not sure.
My questions are:
a) Is the bad_alloc error a bug, or is it my problem formulation that is the problem?
b) Are there any obvious improvements (types,structures, methods, etc) that would make my problem easier to work with for CasADi/Ipopt?
I have attached my project, where MHEcollocation.py is the main file. It runs without error if "r <= 27" and crashes if "r >= 28".
Best regards,
Anders