Menu

ADiGator-GPOPS-II, Warning-derivative of discontinuous sign function

Help
2015-08-03
2015-08-03
  • Antoine Falisse

    Antoine Falisse - 2015-08-03

    Hi,

    I'm using ADiGator on my GPOPS implementation. It's working fine but I receive some warnings (see below) when running my code (I don't know if they have any impact though). It looks like I have a discontinuous sign function but as it is in a function generated by ADiGator, I don't know how to deal with that. Any guidance would be helpful. I can attach my files or give you more details if needed. Many thanks.

    Antoine

    Call to adigator:
    Transforming user function: 'musdynEndpoint_Antoine'
    taking derivatives wrt: 'v'...
    Printing derivatives to file 'musdynEndpoint_AntoineADiGatorGrd'
    Successfully transformed user function 'musdynEndpoint_Antoine' to derivative function 'musdynEndpoint_AntoineADiGatorGrd'
    Total file generation time: 1.7604
    Call to adigator:
    Transforming user function: 'musdynContinous_Antoine'
    taking derivatives wrt: 'V'...
    Printing derivatives to file 'musdynContinous_AntoineADiGatorGrd'
    Successfully transformed user function 'musdynContinous_Antoine' to derivative function 'musdynContinous_AntoineADiGatorGrd'
    Total file generation time: 3.6152
    Call to adigator:
    Transforming user function: 'musdynEndpoint_AntoineADiGatorGrd'
    taking derivatives wrt: 'v'...
    Printing derivatives to file 'musdynEndpoint_AntoineADiGatorHes'
    Successfully transformed user function 'musdynEndpoint_AntoineADiGatorGrd' to derivative function 'musdynEndpoint_AntoineADiGatorHes'
    Total file generation time: 1.2419
    Call to adigator:
    Transforming user function: 'musdynContinous_AntoineADiGatorGrd'
    taking derivatives wrt: 'V'...
    Warning: derivative of discontinuous sign function - making derivatives zero

    In cada.sign at 5
    In lib\private\adigatortempfunc4 at 106
    In lib\private\adigatortempfunc1 at 822
    In adigator at 535
    In adigatorGenFiles4gpops2 at 261
    In setupandrun at 59
    In musdynMain_Antoine at 180
    In Run_Optimization at 20
    Printing derivatives to file 'musdynContinous_AntoineADiGatorHes'
    Warning: derivative of discontinuous sign function - making derivatives zero
    In cada.sign at 5
    In lib\private\adigatortempfunc4 at 106
    In adigator at 658
    In adigatorGenFiles4gpops2 at 261
    In setupandrun at 59
    In musdynMain_Antoine at 180
    In Run_Optimization at 20
    Successfully transformed user function 'musdynContinous_AntoineADiGatorGrd' to derivative function 'musdynContinous_AntoineADiGatorHes'
    Total file generation time: 7.2503

     
  • Matthew J. Weinstein

    Hi Antoine,

    It looks like you have an y = abs(x) in your continuous function. ADiGator uses derivative rule dy = sgn(x), which it then differentiates again. The warning is just that the sgn() function is piecewise constant and that the coded derivative rule is always zero (dydy = 0 in this example). I placed the warning in there a few years ago - since then I have coded derivative rules for other discontinuous functions (min, max, etc.) with no warnings, so I should probably just remove it.

    My reasoning for the warning in the first place is that Newton based methods (like those used by IPOPT and SNOPT) have some assumptions made regarding how many continuous derivatives a function has, but it is pretty common to just ignore those assumptions (especially if you converge in an area away from the discontinuity).

    Hope this helps!

    -Matt

     
  • Antoine Falisse

    Antoine Falisse - 2015-08-03

    Hi Matt,

    Thanks very much for the answer!

    Antoine

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.