methods to interpret (evaluate) an expression "fast" using CppAD
Definition in file exprinterpret_cppad.cpp.
#include "scip/exprinterpret.h"
#include "scip/def.h"
#include "scip/intervalarith.h"
#include "scip/pub_expr.h"
#include "scip/scip_expr.h"
#include "scip/expr_pow.h"
#include "scip/expr_exp.h"
#include "scip/expr_log.h"
#include "scip/expr_varidx.h"
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cppad/cppad.hpp>
#include <cppad/utility/error_handler.hpp>
Go to the source code of this file.
template<class Type > void posintpower (const vector< Type > &in, vector< Type > &out, size_t exponent) template<class Type > static void evalSignPower (CppAD::AD< Type > &resultant, const CppAD::AD< Type > &arg, SCIP_EXPR *expr) template<class Type > static void evalIntPower (Type &resultant, const Type &arg, const int exponent) template<class Type > static SCIP_RETCODE eval (SCIP *scip, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, const vector< Type > &x, Type &val) static void cppaderrorcallback (bool known, int line, const char *file, const char *cond, const char *msg) static CppAD::ErrorHandler errorhandler (cppaderrorcallback) const char * SCIPexprintGetName (void) const char * SCIPexprintGetDesc (void) SCIP_EXPRINTCAPABILITY SCIPexprintGetCapability (void) SCIP_RETCODE SCIPexprintCreate (SCIP *scip, SCIP_EXPRINT **exprint) SCIP_RETCODE SCIPexprintFree (SCIP *scip, SCIP_EXPRINT **exprint) SCIP_RETCODE SCIPexprintCompile (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *rootexpr, SCIP_EXPRINTDATA **exprintdata) SCIP_RETCODE SCIPexprintFreeData (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA **exprintdata) SCIP_EXPRINTCAPABILITY SCIPexprintGetExprCapability (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata) SCIP_RETCODE SCIPexprintEval (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, SCIP_Real *varvals, SCIP_Real *val) SCIP_RETCODE SCIPexprintGrad (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, SCIP_Real *varvals, SCIP_Bool new_varvals, SCIP_Real *val, SCIP_Real *gradient) SCIP_RETCODE SCIPexprintHessianSparsity (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, SCIP_Real *varvals, int **rowidxs, int **colidxs, int *nnz) SCIP_RETCODE SCIPexprintHessian (SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, SCIP_Real *varvals, SCIP_Bool new_varvals, SCIP_Real *val, int **rowidxs, int **colidxs, SCIP_Real **hessianvals, int *nnz) ◆ NO_CPPAD_USER_ATOMIC ◆ CPPAD_MAX_NUM_THREADS ◆ posintpower() void posintpower ( const vector< Type > & in, vector< Type > & out, size_t exponent )power function with natural exponents
Definition at line 556 of file exprinterpret_cppad.cpp.
Referenced by evalIntPower().
◆ evalSignPower() static void evalSignPower ( CppAD::AD< Type > & resultant, const CppAD::AD< Type > & arg, SCIP_EXPR * expr ) static ◆ evalIntPower() static void evalIntPower ( Type & resultant, const Type & arg, const int exponent ) static ◆ eval()CppAD compatible evaluation of an expression for given arguments
Definition at line 1334 of file exprinterpret_cppad.cpp.
References EPSISINT, eval(), evalIntPower(), evalSignPower(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPexprGetChildren(), SCIPexprGetHdlr(), SCIPexprGetNChildren(), SCIPexprhdlrGetName(), SCIPfreeBufferArray, SCIPgetCoefExprProduct(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetExponentExprPow(), SCIPgetIndexExprVaridx(), SCIPgetValueExprValue(), SCIPisExprExp(), SCIPisExprLog(), SCIPisExprPower(), SCIPisExprProduct(), SCIPisExprSignpower(), SCIPisExprSum(), SCIPisExprValue(), SCIPisExprVaridx(), and x.
Referenced by eval(), SCIPexprhdlrCreate(), SCIPexprintEval(), and SCIPincludeExprhdlr().
◆ cppaderrorcallback() static void cppaderrorcallback ( bool known, int line, const char * file, const char * cond, const char * msg ) staticreplacement for CppAD's default error handler
In debug mode, CppAD gives an error when an evaluation contains a nan. We do not want to stop execution in such a case, since the calling routine should check for nan's and decide what to do. Since we cannot ignore this particular error, we ignore all.
Definition at line 1463 of file exprinterpret_cppad.cpp.
References SCIPdebugMessage.
◆ errorhandler()RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4