ADiGator + GPOPS-II: issue if files already exist
A MATLAB Automatic Differentiation Tool
Brought to you by:
anilvrao2,
weinstein87
Hi Matt,
I am using ADiGator v1.1 with GPOPS-II and I noticed a weird error in GPOPS-II.
If I run my simulation from scratch everything is fine: first ADiGator generates the Continuous and Endpoint function files and then GPOPS-II runs with no problems.
If I have already the functions previously created by ADiGator, I get the following error from GPOPS-II:
"Error using >
Not enough input arguments.
Error in gpopsVerifySetup (line 3583)
Error in gpops2 (line 76)"
I don't know if this issue is related to GPOPS-II or to ADiGator though. The error from GPOPS-II does not help much, since the source code is protected and I don't know what exactly happens inside. However, I remember that some time ago the same worked fine. That's why I think is some sort of issue related to ADiGator, more than GPOPS-II.
I solved the issue by simply adding at the top of my script a code that checks if there are files generated by ADiGator in the path and, if so, deletes the files. However, this is just a workaround solution, it doesn't really solve the problem.
Cheers,
Alessandro
Hi Alessandro,
GPOPS does a couple of checks if you use the adigator option:
1. Checks if user specified setup.adigatorgrd.endpoint/setup.adigatorgrd.continuous/setup.adigatorhes.endpoint/setup.adigatorhes.continuous (assuming using second derivative) - if these are specified it assumes those fields point to the adigator generated derivative functions. I am guessing you are not specifying these.
2. If those adigatorgrd fields are not specified, it checks to see if files exist with the default adigatorGenFiles4gpops2 naming scheme (contfunADiGatorGrd, etc.).
2a. if they exist, it checks time stamps on the ADiGatorGrd files and compares with time stamps on the user functions (i.e. did the user modify their functions since the last time adigator differentiated them) - if they were modified it should generate new files using an internal version of adigatorGenFiles4gpops2, if they were not, it should just use the old ones. This mechanism seems to be the broken one - I don't think that any changes I've made should break this.
2b. if they do not exist, it calls and internal version of adigatorGenFiles4gpops2
What I always suggest is that you manually call adigator whenever you change any of your functions, number of phases, etc. (using adigatorGenFiles4gpops2) and to always use the setup.adigatorgrd type fields to point GPOPS to the proper files - I don't think that you are doing this? It should fix your issue.
Other notes:
That error looks to be a call to some function used in performing the checks of 2a (Looks like some native matlab function is called with too little inputs at line 3583 of gpopsVerifySetup), maybe Dr. Rao can take a look if he sees this.
-Matt
Hi Matt,
thank you for your reply.
Yes I understood the way ADiGator works and that's why it seemed weird to me this error. As you guessed, I am not pointing to the generated files explicitly. So, my solution of deleting any pre-existent file generated by ADiGator and generate them everytime (each time takes less than a minute, so it is not a big time issue anyway) can do the job. I prefer this way respect to generate manually the functions by calling adigatorGenFiles4gpops2 because in the first case I am sure that the files I am using are the updated ones.
Cheers,
Alessandro