Repository navigation
Bug in CVODES or its interface #1924
Description
Activity
Nice catch!
it's definitely number-crunching, but seems to be stuck in the Newton root-finder.
passing"nonlinear_solver_iteration": "functional"to the options seems to resolve the situation, while"fsens_err_con": True, "quad_err_con": Truemakes the convergence a bit faster.@jaeandersson interested to have a look?
Can you try replacing "cvodes" with "idas"?
@jgillis I can confirm it works for me as well.
@jaeandersson That works too.Now I'm getting errors regarding the
get()calls at the end of my script, which is just 2.4.2 vs 3.1.1 API thing, so it's back to me. Thanks for your help!@jaeandersson That works too.
So it works with idas but not with cvodes? I've seen that before.
@jaeandersson Sorry for the brevity. Exactly as you say, it works with idas but not with cvodes.
- changed the title
[-]CasADi 3.1.1 hangs where 2.4.2 does not[/-][+]Bug in CVODES or its interface[/+]on Jan 3, 2017 Looks like a bug in CVODES then, or in CasADi's interface to CVODES. I'd use IDAS instead until we figure out what it is. CVODES and IDAS are both from the SUNDIALS suite and use the same variable step-size, variable-order BDF method by default.
I think I've fixed it now... the test suite gets the following error now though:
====================================================================== FAIL: test_hess6 (integration.Integrationtests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jaeandersson/dev/casadi/test/python/integration.py", line 737, in test_hess6 self.assertAlmostEqual(H_out[0][0],(q0*tend**6*exp(tend**3/(3*p)))/(9*p**4)+(2*q0*tend**3*exp(tend**3/(3*p)))/(3*p**3),9,"Evaluation output mismatch") File "/Users/jaeandersson/dev/casadi/test/python/helpers.py", line 224, in assertAlmostEqual unittest.TestCase.assertAlmostEqual(self,first/n,second/n,places=places,msg=msg + " scaled by %d" %n) AssertionError: Evaluation output mismatch 1.1014858783948605e+02 <-> 1.1014858783785127e+02 scaled by 1 ----------------------------------------------------------------------False positive, @jgillis ?
I changed significant digits to 8...
Can you post the ported code?
What ported code? The changes to CasADi?
I was talking more about original code topic starter posted. Ah well, I'll spend some time fixing (or porting? to newest casadi) it myself.
I haven't changed that code, so you'd have to update it yourself. I isolated and solved this bug using a different example exhibiting the same behavior.
@sashan13 I have posted that code right in the opening post (but there are still some mistakes in that "version"). Since then I have modified that code to integrate it into a bigger program (I'm doing some calculations for Kerbal Space Program). You can see it here: https://github.com/zegkljan/kos-stuff/blob/master/non-kos-tools/gturn/_gturn.py
- Thanks, that's what I was looking for. Btw, running that code from original post withhot changing cvodes still makes the script hang. I installed casadi using pip. On Oct 16, 2017 11:31 PM, "Jan Žegklitz" <notifications@github.com> wrote: @sashan13 <https://github.com/sashan13> I have posted that code right in the opening post (but there are still some mistakes in that "version"). Since then I have modified that code to integrate it into a bigger program (I'm doing some calculations for Kerbal Space Program). You can see it here: https://github.com/zegkljan/kos-stuff/blob/master/non-kos- tools/gturn/_gturn.py — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1924 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ASzWIjewXpPGtG-PVME1LBrDu3gXleRAks5ss8sbgaJpZM4LXRI1> .
Hi, I was attempting to run this script and I found that the code still hangs with "cvodes" under # Build the DAE function comment. I also tried idas and I get the following error:
At t = 0.000941595, , mxstep steps taken before reaching tout.
Error occured while integrating backward problem # 0
Sorry, things failed ?!?!
CasADi - WARNING("S:nlp_hess_l failed:Error in Function::operator() for 'nlp_hess_l' [MXFunction] at .../casadi/core/function.cpp:1368:Error in Function::operator() for 'fwd6_adj1_I' [MXFunction] at .../casadi/core/function.cpp:1368:
Number of Iterations....: 10
Error in Function::operator() for 'fwd6_asens1_I' [MXFunction] at .../casadi/core/function.cpp:1368:Error in Function::operator() for 'fsens6_asens1_I' [IdasInterface] at .../casadi/core/function.cpp:1368:
I was interested in the Gravity Turn Maneuver (found here). However, it is written for CasADi 2.4.2. I tried to modify it to work with 3.1.1 (see the code at the very end of this post). However, when I run it (in python 3.5.2), the solver seems to be stuck with one CPU core working at 100%. When I set the print_level option of IPOPT to 6, I get the following output:
and then I'm waiting forever.
However, using CasADi 2.4.2, it works fine and I get progress reports right away and after about 80 seconds it finishes and I get the results. Could this be me failing to properly convert the code to work with 3.1.1 or is it a bug? This is my very first time touching CasADi (in fact I came across the gravity turn rather than CasADi and I just wanted to get it working with the newest versions of everything...) so I won't be surprised if it is me. However, right now I have no idea. I can post additional info/data if instructed.
Contents of my
gturn3.pyfile: