Detailed Description
methods and files provided by the default expression interpreters of SCIP
A detailed description what a expression interpreter does and how to add a expression interpreter to SCIP can be found here.
Files | |
file | exprinterpret.h |
methods to interpret (evaluate) an expression "fast" | |
Function Documentation
◆ SCIPexprintGetName()
const char* SCIPexprintGetName | ( | void | ) |
gets name and version of expression interpreter
Definition at line 1462 of file exprinterpret_cppad.cpp.
Referenced by doScipCreate(), and SCIPnlpiOracleCreate().
◆ SCIPexprintGetDesc()
const char* SCIPexprintGetDesc | ( | void | ) |
gets descriptive text of expression interpreter
Definition at line 1468 of file exprinterpret_cppad.cpp.
Referenced by doScipCreate().
◆ SCIPexprintGetCapability()
SCIP_EXPRINTCAPABILITY SCIPexprintGetCapability | ( | void | ) |
gets capabilities of expression interpreter (using bitflags)
Definition at line 1474 of file exprinterpret_cppad.cpp.
References SCIP_EXPRINTCAPABILITY_FUNCVALUE, SCIP_EXPRINTCAPABILITY_GRADIENT, SCIP_EXPRINTCAPABILITY_HESSIAN, and SCIP_EXPRINTCAPABILITY_NONE.
Referenced by SCIP_DECL_NLPISOLVE().
◆ SCIPexprintCreate()
SCIP_RETCODE SCIPexprintCreate | ( | SCIP * | scip, |
SCIP_EXPRINT ** | exprint | ||
) |
creates an expression interpreter object
- Parameters
-
scip SCIP data structure exprint buffer to store pointer to expression interpreter
Definition at line 1482 of file exprinterpret_cppad.cpp.
References NULL, and SCIP_OKAY.
Referenced by SCIPnlpiOracleCreate().
◆ SCIPexprintFree()
SCIP_RETCODE SCIPexprintFree | ( | SCIP * | scip, |
SCIP_EXPRINT ** | exprint | ||
) |
frees an expression interpreter object
- Parameters
-
scip SCIP data structure exprint expression interpreter that should be freed
Definition at line 1495 of file exprinterpret_cppad.cpp.
References NULL, and SCIP_OKAY.
Referenced by SCIPnlpiOracleFree().
◆ SCIPexprintCompile()
SCIP_RETCODE SCIPexprintCompile | ( | SCIP * | scip, |
SCIP_EXPRINT * | exprint, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRINTDATA ** | exprintdata | ||
) |
compiles an expression and returns interpreter-specific data for expression
can be called again with existing exprintdata if expression has been changed
- Attention
- *exprintdata needs to be initialized to NULL at first call
- the expression is assumed to use varidx expressions instead of var expressions
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata buffer to store pointer to compiled data
Definition at line 1514 of file exprinterpret_cppad.cpp.
References FALSE, NULL, SCIP_CALL, SCIP_EXPRINTCAPABILITY_FUNCVALUE, SCIP_EXPRINTCAPABILITY_GRADIENT, SCIP_EXPRITER_DFS, SCIP_OKAY, SCIPcreateExpriter(), SCIPdebugMsg, SCIPexprGetChildren(), SCIPexprGetHdlr(), SCIPexprGetNChildren(), SCIPexprhdlrGetName(), SCIPexprhdlrHasFwdiff(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPfreeExpriter(), SCIPgetExponentExprPow(), SCIPgetIndexExprVaridx(), SCIPisExprExp(), SCIPisExprLog(), SCIPisExprPower(), SCIPisExprProduct(), SCIPisExprSignpower(), SCIPisExprSum(), SCIPisExprValue(), SCIPisExprVar(), and SCIPisExprVaridx().
Referenced by createConstraint(), and SCIPnlpiOracleChgExpr().
◆ SCIPexprintFreeData()
SCIP_RETCODE SCIPexprintFreeData | ( | SCIP * | scip, |
SCIP_EXPRINT * | exprint, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRINTDATA ** | exprintdata | ||
) |
frees interpreter data for expression
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata pointer to pointer to compiled data to be freed
Definition at line 1625 of file exprinterpret_cppad.cpp.
References NULL, SCIP_OKAY, and SCIPfreeBlockMemoryArrayNull.
Referenced by freeConstraint(), SCIPnlpiOracleChgExpr(), and SCIPnlpiOracleDelVarSet().
◆ SCIPexprintGetExprCapability()
SCIP_EXPRINTCAPABILITY SCIPexprintGetExprCapability | ( | SCIP * | scip, |
SCIP_EXPRINT * | exprint, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRINTDATA * | exprintdata | ||
) |
gives the capability to evaluate an expression by the expression interpreter
In cases of user-given expressions, higher order derivatives may not be available for the user-expression, even if the expression interpreter could handle these. This method allows to recognize that, e.g., the Hessian for an expression is not available because it contains a user expression that does not provide Hessians.
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata interpreter-specific data for expression
Definition at line 1651 of file exprinterpret_cppad.cpp.
References NULL, and SCIP_EXPRINTCAPABILITY_NONE.
Referenced by SCIPnlpiOracleGetEvalCapability().
◆ SCIPexprintEval()
SCIP_RETCODE SCIPexprintEval | ( | SCIP * | scip, |
SCIP_EXPRINT * | exprint, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRINTDATA * | exprintdata, | ||
SCIP_Real * | varvals, | ||
SCIP_Real * | val | ||
) |
evaluates an expression
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata interpreter-specific data for expression varvals values of variables val buffer to store value of expression
Definition at line 1664 of file exprinterpret_cppad.cpp.
References eval(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPdebugMessage, SCIPerrorMessage, SCIPevalExpr(), SCIPexprGetEvalValue(), and SCIPfreeBlockMemoryArrayNull.
Referenced by evalFunctionValue(), SCIPexprintGrad(), SCIPexprintHessian(), and SCIPexprintHessianSparsity().
◆ SCIPexprintGrad()
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 | ||
) |
computes value and gradient of an expression
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata interpreter-specific data for expression varvals values of variables, can be NULL if new_varvals is FALSE new_varvals have variable values changed since last call to a point evaluation routine? val buffer to store expression value gradient buffer to store expression gradient
Definition at line 1740 of file exprinterpret_cppad.cpp.
References FALSE, NULL, SCIP_CALL, SCIP_DEBUG, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPerrorMessage, SCIPexprintEval(), SCIPinfoMessage(), and SCIPprintExpr().
Referenced by evalFunctionGradient(), and SCIPnlpiOracleEvalJacobian().
◆ SCIPexprintHessianSparsity()
SCIP_RETCODE SCIPexprintHessianSparsity | ( | SCIP * | scip, |
SCIP_EXPRINT * | exprint, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRINTDATA * | exprintdata, | ||
SCIP_Real * | varvals, | ||
int ** | rowidxs, | ||
int ** | colidxs, | ||
int * | nnz | ||
) |
gives sparsity pattern of lower-triangular part of Hessian
Since the AD code might need to do a forward sweep, variable values need to be passed in here.
Result will have (*colidxs)[i] <= (*rowidixs)[i]
for i=0..*nnz
.
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata interpreter-specific data for expression varvals values of variables rowidxs buffer to return array with row indices of Hessian elements colidxs buffer to return array with column indices of Hessian elements nnz buffer to return length of arrays
Definition at line 1809 of file exprinterpret_cppad.cpp.
References NULL, r, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPallocBlockMemoryArray, SCIPdebugMessage, SCIPerrorMessage, SCIPexprintEval(), SCIPinfoMessage(), and SCIPprintExpr().
Referenced by hessLagSparsitySetNzFlagForExpr(), and SCIPexprintHessian().
◆ SCIPexprintHessian()
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 | ||
) |
computes value and Hessian of an expression
Returned arrays rowidxs
and colidxs
and number of elements nnz
are the same as given by SCIPexprintHessianSparsity(). Returned array hessianvals
will contain the corresponding Hessian elements.
- Parameters
-
scip SCIP data structure exprint interpreter data structure expr expression exprintdata interpreter-specific data for expression varvals values of variables, can be NULL if new_varvals is FALSE new_varvals have variable values changed since last call to an evaluation routine? val buffer to store function value rowidxs buffer to return array with row indices of Hessian elements colidxs buffer to return array with column indices of Hessian elements hessianvals buffer to return array with Hessian elements nnz buffer to return length of arrays
Definition at line 1981 of file exprinterpret_cppad.cpp.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPerrorMessage, SCIPexprintEval(), SCIPexprintHessianSparsity(), SCIPinfoMessage(), and SCIPprintExpr().
Referenced by hessLagAddExpr().