CppAD icon indicating copy to clipboard operation
CppAD copied to clipboard

Leppov case missing in local/optimize/get_op_usage.hpp

Open condor-cp opened this issue 2 years ago • 3 comments

Hello, I recently experience that running the "optimize" method of CppAD::ADFun runs into an error.

After debugging, it seems that the operation Leppov is missing from the cases of get_op_usage, I thus fall to the default case here and so to an error.

Is there a fundamental reason for this op not to be in the cases ?

condor-cp avatar Aug 30 '22 10:08 condor-cp

It seems that all the operators, where both arguments are parameters, are missing from https://github.com/coin-or/CppAD/blob/master/include/cppad/local/optimize/get_op_usage.hpp ; i.e.

    EqppOp,   // compare equal
    LeppOp,   // compare <=
    LtppOp,   // compare <
    NeppOp,   // compare !=
    StppOp,   // store in VecAD array

These do appear in https://github.com/coin-or/CppAD/blob/master/include/cppad/local/optimize/get_par_usage.hpp

It will take a while for me to create a test case that demonstrates this bug, understand what if anything should be done, and to then fix it.

In the meantime, you might try removing the

 CPPAD_ASSERT_UNKNOWN(0);

at the end of get_op_usage.hpp

bradbell avatar Aug 30 '22 11:08 bradbell

Ok, thank you

condor-cp avatar Aug 30 '22 12:08 condor-cp

The comparison operators EqppOp, // compare equal LeppOp, // compare <= LtppOp, // compare < NeppOp, // compare != have been fixed. See the following commit: https://github.com/coin-or/CppAD/commit/6966000307ecc09a431fbbdd402c330b562dec89

If this satisfies your problem, please close this bug.

bradbell avatar Aug 30 '22 17:08 bradbell