67#define NO_CPPAD_USER_ATOMIC
70#if __cplusplus < 201103L && defined(SCIP_THREADSAFE)
77#ifndef CPPAD_MAX_NUM_THREADS
79#define CPPAD_MAX_NUM_THREADS 64
81#define CPPAD_MAX_NUM_THREADS 1
91#pragma GCC diagnostic ignored "-Wshadow"
94#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
100#define log2(x) (log((double)x) / log(2.0))
103#include <cppad/cppad.hpp>
104#include <cppad/utility/error_handler.hpp>
111#ifdef SCIP_THREADSAFE
116static std::atomic_size_t ncurthreads{0};
117static thread_local int thread_number{-1};
121bool in_parallel(
void)
123 return ncurthreads > 1;
131size_t thread_num(
void)
137 if( thread_number == -1 )
139 thread_number =
static_cast<int>(ncurthreads.fetch_add(1, std::memory_order_relaxed));
142 threadnum =
static_cast<size_t>(thread_number);
152extern "C" SCIP_EXPORT
char SCIPexprintCppADInitParallel(
void);
154__attribute__((constructor))
156char SCIPexprintCppADInitParallel(
void)
159 CppAD::parallel_ad<double>();
164#if !defined(__GNUC__)
169static char init_parallel_return = SCIPexprintCppADInitParallel();
179struct SCIP_ExprIntData
186 need_retape_always(false),
204 assert(std::binary_search(varidxs.begin(), varidxs.end(),
varidx));
205 return std::lower_bound(varidxs.begin(), varidxs.end(),
varidx) - varidxs.begin();
208 vector< int > varidxs;
209 vector< AD<double> > X;
210 vector< AD<double> > Y;
211 CppAD::ADFun<double> f;
216 bool need_retape_always;
218 vector<atomic_userexpr*> userexprs;
223 vector<SCIP_Real> hesvalues;
228 CppAD::local::internal_sparsity<bool>::pattern_type hessparsity_pattern;
229 CppAD::vector<size_t> hessparsity_row;
230 CppAD::vector<size_t> hessparsity_col;
231 CppAD::sparse_hessian_work heswork;
234#ifndef NO_CPPAD_USER_ATOMIC
242bool univariate_for_sparse_jac(
244 const CppAD::vector<bool>&
r,
245 CppAD::vector<bool>& s
262bool univariate_rev_sparse_jac(
264 const CppAD::vector<bool>&
r,
265 CppAD::vector<bool>& s
282bool univariate_rev_sparse_hes(
283 const CppAD::vector<bool>& vx,
284 const CppAD::vector<bool>& s,
285 CppAD::vector<bool>& t,
287 const CppAD::vector<bool>&
r,
288 const CppAD::vector<bool>& u,
289 CppAD::vector<bool>& v
305 for(
size_t j = 0; j < q; ++j )
321class atomic_posintpower :
public CppAD::atomic_base<Type>
325 : CppAD::atomic_base<
Type>(
"posintpower"),
329 this->option(CppAD::atomic_base<Type>::bool_sparsity_enum);
341 virtual void set_old(
size_t id)
361 const CppAD::vector<bool>& vx,
362 CppAD::vector<bool>& vy,
363 const CppAD::vector<Type>& tx,
364 CppAD::vector<Type>& ty
383 ty[0] = CppAD::pow(tx[0], exponent);
386 if( q <= 1 && 1 <= p )
388 ty[1] = CppAD::pow(tx[0], exponent-1) * tx[1];
389 ty[1] *= double(exponent);
392 if( q <= 2 && 2 <= p )
397 ty[2] = CppAD::pow(tx[0], exponent-2) * tx[1] * tx[1];
398 ty[2] *= (exponent-1) / 2.0;
399 ty[2] += CppAD::pow(tx[0], exponent-1) * tx[2];
406 ty[2] = tx[1] * tx[1] + 2.0 * tx[0] * tx[2];
449 const CppAD::vector<Type>& tx,
450 const CppAD::vector<Type>& ty,
451 CppAD::vector<Type>& px,
452 const CppAD::vector<Type>& py
464 px[0] = py[0] * CppAD::pow(tx[0], exponent-1);
470 px[0] = py[1] * tx[1] * CppAD::pow(tx[0], exponent-2);
472 px[0] += py[0] * CppAD::pow(tx[0], exponent-1);
475 px[1] = py[1] * CppAD::pow(tx[0], exponent-1);
486 using CppAD::atomic_base<
Type>::for_sparse_jac;
495 const CppAD::vector<bool>&
r,
496 CppAD::vector<bool>& s
499 return univariate_for_sparse_jac(q,
r, s);
502 using CppAD::atomic_base<
Type>::rev_sparse_jac;
511 const CppAD::vector<bool>&
r,
512 CppAD::vector<bool>& s
515 return univariate_rev_sparse_jac(q,
r, s);
518 using CppAD::atomic_base<
Type>::rev_sparse_hes;
526 const CppAD::vector<bool>& vx,
527 const CppAD::vector<bool>& s,
528 CppAD::vector<bool>& t,
530 const CppAD::vector<bool>&
r,
531 const CppAD::vector<bool>& u,
532 CppAD::vector<bool>& v
535 return univariate_rev_sparse_hes(vx, s, t, q,
r, u, v);
543 const vector<Type>& in,
548 static atomic_posintpower<typename Type::value_type> pip;
549 pip(in, out, exponent);
557 const vector<Type>& in,
562 out[0] = pow(in[0], (
int)exponent);
568#ifndef NO_CPPAD_USER_ATOMIC
574#define SIGN(x) ((x) >= 0.0 ? 1.0 : -1.0)
585class atomic_signpower :
public CppAD::atomic_base<Type>
589 : CppAD::atomic_base<
Type>(
"signpower"),
593 this->option(CppAD::atomic_base<Type>::bool_sparsity_enum);
605 virtual void set_old(
size_t id)
625 const CppAD::vector<bool>& vx,
626 CppAD::vector<bool>& vy,
627 const CppAD::vector<Type>& tx,
628 CppAD::vector<Type>& ty
647 ty[0] =
SIGN(tx[0]) * pow(
REALABS(tx[0]), exponent);
650 if( q <= 1 && 1 <= p )
652 ty[1] = pow(
REALABS(tx[0]), exponent - 1.0) * tx[1];
656 if( q <= 2 && 2 <= p )
658 if( exponent != 2.0 )
660 ty[2] =
SIGN(tx[0]) * pow(
REALABS(tx[0]), exponent - 2.0) * tx[1] * tx[1];
661 ty[2] *= (exponent - 1.0) / 2.0;
662 ty[2] += pow(
REALABS(tx[0]), exponent - 1.0) * tx[2];
668 ty[2] =
SIGN(tx[0]) * tx[1] * tx[1];
669 ty[2] += 2.0 *
REALABS(tx[0]) * tx[2];
712 const CppAD::vector<Type>& tx,
713 const CppAD::vector<Type>& ty,
714 CppAD::vector<Type>& px,
715 const CppAD::vector<Type>& py
727 px[0] = py[0] * pow(
REALABS(tx[0]), exponent - 1.0);
732 if( exponent != 2.0 )
735 px[0] = py[1] * tx[1] * pow(
REALABS(tx[0]), exponent - 2.0) *
SIGN(tx[0]);
736 px[0] *= exponent - 1.0;
737 px[0] += py[0] * pow(
REALABS(tx[0]), exponent - 1.0);
740 px[1] = py[1] * pow(
REALABS(tx[0]), exponent - 1.0);
746 px[0] = py[1] * tx[1] *
SIGN(tx[0]);
747 px[0] += py[0] *
REALABS(tx[0]);
750 px[1] = py[1] *
REALABS(tx[0]);
762 using CppAD::atomic_base<
Type>::for_sparse_jac;
771 const CppAD::vector<bool>&
r,
772 CppAD::vector<bool>& s
775 return univariate_for_sparse_jac(q,
r, s);
778 using CppAD::atomic_base<
Type>::rev_sparse_jac;
787 const CppAD::vector<bool>&
r,
788 CppAD::vector<bool>& s
791 return univariate_rev_sparse_jac(q,
r, s);
794 using CppAD::atomic_base<
Type>::rev_sparse_hes;
802 const CppAD::vector<bool>& vx,
803 const CppAD::vector<bool>& s,
804 CppAD::vector<bool>& t,
806 const CppAD::vector<bool>&
r,
807 const CppAD::vector<bool>& u,
808 CppAD::vector<bool>& v
811 return univariate_rev_sparse_hes(vx, s, t, q,
r, u, v);
824 vector<Type> in(1, arg);
827 static atomic_signpower<typename Type::value_type> sp;
828 sp(in, out, (
size_t)(
void*)expr);
840 CppAD::AD<Type>& resultant,
841 const CppAD::AD<Type>& arg,
853 resultant = CppAD::CondExpGe(arg, adzero, pow(arg, (
int)exponent), -pow(-arg, (
int)exponent));
860 resultant = CppAD::CondExpEq(arg, adzero, pow(arg+std::numeric_limits<SCIP_Real>::epsilon(), exponent)-pow(std::numeric_limits<SCIP_Real>::epsilon(), exponent),
861 CppAD::CondExpGe(arg, adzero, pow(arg, exponent), -pow(-arg, exponent)));
914 const CppAD::vector<bool>& vx,
915 CppAD::vector<bool>& vy,
916 const CppAD::vector<SCIP_Real>& tx,
917 CppAD::vector<SCIP_Real>& ty
925 size_t n = tx.size() / (p+1);
939 for(
size_t i = 0;
i < n; ++
i )
956 ty[0] = std::numeric_limits<double>::infinity();
970 for(
size_t i = 0;
i < n; ++
i )
972 x[
i] = tx[
i * (p+1) + 0];
973 dir[
i] = tx[
i * (p+1) + 1];
979 ty[0] = std::numeric_limits<double>::infinity();
981 ty[1] = std::numeric_limits<double>::infinity();
993#if SCIP_DISABLED_CODE
998 if( q <= 2 && 1 <= p )
1000 if( q <= 2 && 2 <= p )
1003 if( exprEvalUser(expr,
x, ty[0], gradient, hessian) !=
SCIP_OKAY )
1011 if( gradient !=
NULL )
1014 for(
size_t i = 0;
i < n; ++
i )
1015 ty[1] += gradient[
i] * tx[
i * (p+1) + 1];
1018 if( hessian !=
NULL )
1023 for(
size_t i = 0;
i < n; ++
i )
1025 for(
size_t j = 0; j < n; ++j )
1026 ty[2] += 0.5 * hessian[
i*n+j] * tx[
i * (p+1) + 1] * tx[j * (p+1) + 1];
1028 ty[2] += gradient[
i] * tx[
i * (p+1) + 2];
1103 const CppAD::vector<SCIP_Real>& tx,
1104 const CppAD::vector<SCIP_Real>& ty,
1105 CppAD::vector<SCIP_Real>& px,
1106 const CppAD::vector<SCIP_Real>& py
1110 assert(px.size() == tx.size());
1111 assert(py.size() == p+1);
1117#ifdef SCIP_DISABLED_CODE
1119 size_t n = tx.size() / (p+1);
1131 for(
size_t i = 0;
i < n; ++
i )
1132 x[
i] = tx[
i * (p+1) + 0];
1134 if( exprEvalUser(expr,
x, funcval, gradient, hessian) !=
SCIP_OKAY )
1146 for(
size_t i = 0;
i < n; ++
i )
1147 px[
i] = py[0] * gradient[
i];
1154 for(
size_t i = 0;
i < n; ++
i )
1156 px[
i*2+0] = py[0] * gradient[
i];
1157 for(
size_t j = 0; j < n; ++j )
1158 px[
i*2+0] += py[1] * hessian[
i+n*j] * tx[j*2+1];
1160 px[
i*2+1] = py[1] * gradient[
i];
1172 using CppAD::atomic_base<
SCIP_Real>::for_sparse_jac;
1179 bool for_sparse_jac(
1181 const CppAD::vector<bool>&
r,
1182 CppAD::vector<bool>& s
1188 size_t n =
r.size() / q;
1192 for(
size_t j = 0; j < q; j++ )
1195 for(
size_t i = 0;
i < n;
i++ )
1196 s[j] |= (
bool)
r[
i * q + j];
1202 using CppAD::atomic_base<
SCIP_Real>::rev_sparse_jac;
1209 bool rev_sparse_jac(
1211 const CppAD::vector<bool>& rt,
1212 CppAD::vector<bool>& st
1218 size_t n = st.size() / q;
1222 for(
size_t j = 0; j < q; j++ )
1223 for(
size_t i = 0;
i < n;
i++ )
1224 st[
i * q + j] = rt[j];
1229 using CppAD::atomic_base<
SCIP_Real>::rev_sparse_hes;
1236 bool rev_sparse_hes(
1237 const CppAD::vector<bool>& vx,
1238 const CppAD::vector<bool>& s,
1239 CppAD::vector<bool>& t,
1241 const CppAD::vector<bool>&
r,
1242 const CppAD::vector<bool>& u,
1243 CppAD::vector<bool>& v
1247 size_t n = vx.size();
1253 assert(v.size() == n * q);
1258 for(
i = 0;
i < n; ++
i )
1266 for( j = 0; j < q; j++ )
1267 for(
i = 0;
i < n;
i++ )
1268 v[
i * q + j] = u[j];
1273 for( j = 0; j < q; j++ )
1274 for(
i = 0;
i < n;
i++ )
1275 for( k = 0; k < n; ++k )
1276 v[
i * q + j] |= (
bool)
r[ k * q + j];
1294 vector<Type> in(1, arg);
1295 vector<Type> out(1);
1305 vector<Type> in(1, arg);
1306 vector<Type> out(1);
1310 resultant =
Type(1.0)/out[0];
1322 resultant =
Type(1.0);
1327 resultant =
Type(1.0)/arg;
1337 const vector<Type>&
x,
1367#ifndef EVAL_USE_EXPRHDLR_ALWAYS
1385 else if( exponent == 0.5 )
1387 else if( exponent < 1.0 )
1393 AD<double> adzero(0.);
1394 val = CppAD::CondExpEq(buf[0], adzero, pow(buf[0]+std::numeric_limits<SCIP_Real>::epsilon(), exponent)-pow(std::numeric_limits<SCIP_Real>::epsilon(), exponent),
1395 pow(buf[0], exponent));
1433 val = CppAD::CondExpGt(buf[0], AD<double>(0.), -buf[0] * log(buf[0]), -sqrt(buf[0]));
1441 vector<Type> out(1);
1444 (*exprintdata->userexprs.back())(in, out);
1470 SCIPdebugMessage(
"ignore CppAD error from %sknown source %s:%d: msg: %s exp: %s\n", known ?
"" :
"un", file, line, msg, cond);
1479 return CPPAD_PACKAGE_STRING;
1485 return "Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD)";
1542 if( *exprintdata ==
NULL )
1549 (*exprintdata)->need_retape =
true;
1550 (*exprintdata)->need_retape_always =
false;
1551 (*exprintdata)->hesconstant =
false;
1557 std::set<int> varidxs;
1570#ifndef EVAL_USE_EXPRHDLR_ALWAYS
1602 (*exprintdata)->varidxs.reserve(varidxs.size());
1603 (*exprintdata)->varidxs.insert((*exprintdata)->varidxs.begin(), varidxs.begin(), varidxs.end());
1605 size_t n = (*exprintdata)->varidxs.size();
1606 (*exprintdata)->X.resize(n);
1607 (*exprintdata)->x.resize(n);
1608 (*exprintdata)->Y.resize(1);
1615 (*exprintdata)->hesconstant =
true;
1630 (*exprintdata)->hesconstant =
false;
1633 SCIPdebugMsg(
scip,
"Hessian found %sconstant\n", (*exprintdata)->hesconstant ?
"" :
"not ");
1653 for( vector<atomic_userexpr*>::iterator it((*exprintdata)->userexprs.begin()); it != (*exprintdata)->userexprs.end(); ++it )
1655 (*exprintdata)->userexprs.clear();
1657 delete *exprintdata;
1658 *exprintdata =
NULL;
1679 return exprintdata->userevalcapability;
1697 size_t n = exprintdata->varidxs.size();
1706 if( exprintdata->need_retape_always || exprintdata->need_retape )
1711 exprintdata->hesvalues.clear();
1712 exprintdata->hesnnz = 0;
1714 for(
size_t i = 0;
i < n; ++
i )
1716 int idx = exprintdata->varidxs[
i];
1717 exprintdata->X[
i] = varvals[idx];
1718 exprintdata->x[
i] = varvals[idx];
1722 for( vector<atomic_userexpr*>::iterator it(exprintdata->userexprs.begin()); it != exprintdata->userexprs.end(); ++it )
1724 exprintdata->userexprs.clear();
1726 CppAD::Independent(exprintdata->X);
1730 exprintdata->f.Dependent(exprintdata->X, exprintdata->Y);
1732 exprintdata->val = Value(exprintdata->Y[0]);
1733 SCIPdebugMessage(
"Eval retaped and computed value %g\n", exprintdata->val);
1739 exprintdata->f.optimize();
1741 exprintdata->need_retape =
false;
1745 assert(exprintdata->x.size() >= n);
1746 for(
size_t i = 0;
i < n; ++
i )
1747 exprintdata->x[
i] = varvals[exprintdata->varidxs[
i]];
1749 exprintdata->val = exprintdata->f.Forward(0, exprintdata->x)[0];
1750 SCIPdebugMessage(
"Eval used forward sweep to compute value %g\n", exprintdata->val);
1753 *val = exprintdata->val;
1781 *val = exprintdata->val;
1783 size_t n = exprintdata->varidxs.size();
1789 if( exprintdata->userexprs.empty() )
1790 jac = exprintdata->f.Jacobian(exprintdata->x);
1795 exprintdata->f.Forward(0, exprintdata->x);
1797 CppAD::JacobianFor(exprintdata->f, exprintdata->x, jac);
1800 for(
size_t i = 0;
i < n; ++
i )
1801 gradient[exprintdata->varidxs[
i]] = jac[
i];
1807 for(
size_t i = 0;
i < n; ++
i )
1812 for(
size_t i = 0;
i < n; ++
i )
1846 if( exprintdata->hesrowidxs ==
NULL )
1849 assert(exprintdata->hesvalues.size() == 0);
1850 assert(exprintdata->hesnnz == 0);
1852 size_t n = exprintdata->varidxs.size();
1861 if( exprintdata->need_retape_always )
1864 exprintdata->hesnnz = (n * (n+1))/2;
1869 for(
size_t i = 0;
i < n; ++
i )
1870 for(
size_t j = 0; j <=
i; ++j )
1872 exprintdata->hesrowidxs[k] = exprintdata->varidxs[
i];
1873 exprintdata->hescolidxs[k] = exprintdata->varidxs[j];
1883 *rowidxs = exprintdata->hesrowidxs;
1884 *colidxs = exprintdata->hescolidxs;
1885 *nnz = exprintdata->hesnnz;
1890 if( exprintdata->need_retape )
1900 vector<bool>
r(nn,
false);
1901 for(
size_t i = 0;
i < n; ++
i )
1903 (void) exprintdata->f.ForSparseJac(n,
r);
1912 vector<bool> hessparsity;
1913 exprintdata->f.RevSparseHesCase(
true,
false, n, vector<bool>(1,
true), hessparsity);
1916 exprintdata->hessparsity_pattern.resize(0, 0);
1917 exprintdata->hessparsity_pattern.resize(n, n);
1918 size_t hesnnz_full = 0;
1919 for(
size_t i = 0;
i < nn; ++
i )
1920 if( hessparsity[
i] )
1929 ++exprintdata->hesnnz;
1941 exprintdata->hessparsity_row.resize(hesnnz_full);
1942 exprintdata->hessparsity_col.resize(hesnnz_full);
1944 for(
size_t i = 0, j = 0, k = 0;
i < nn; ++
i )
1945 if( hessparsity[
i] )
1950 if( (
size_t)exprintdata->hesnnz <= nn/4 )
1953 exprintdata->hessparsity_pattern.add_element(row, col);
1960 assert(exprintdata->hesnnz + k < hesnnz_full);
1961 exprintdata->hessparsity_row[exprintdata->hesnnz + k] = row;
1962 exprintdata->hessparsity_col[exprintdata->hesnnz + k] = col;
1967 exprintdata->hessparsity_row[j] = row;
1968 exprintdata->hessparsity_col[j] = col;
1970 assert(j < (
size_t)exprintdata->hesnnz);
1971 exprintdata->hesrowidxs[j] = exprintdata->varidxs[row];
1972 exprintdata->hescolidxs[j] = exprintdata->varidxs[col];
1980 for(
int i = 0;
i < exprintdata->hesnnz; ++
i )
1988 *rowidxs = exprintdata->hesrowidxs;
1989 *colidxs = exprintdata->hescolidxs;
1990 *nnz = exprintdata->hesnnz;
2017 if( exprintdata->hesrowidxs ==
NULL )
2024 assert(exprintdata->hesvalues.size() == 0);
2025 assert(exprintdata->hesnnz == 0);
2029 new_varvals =
FALSE;
2037 *val = exprintdata->val;
2039 size_t n = exprintdata->varidxs.size();
2042 if( n > 0 && (!exprintdata->hesconstant || exprintdata->hesvalues.size() < (
size_t)exprintdata->hesnnz) )
2046 if( exprintdata->hesvalues.size() == 0 )
2049 exprintdata->hesvalues.resize(exprintdata->hessparsity_row.size());
2053 if( (
size_t)exprintdata->hesnnz > nn/4 )
2057 vector<double> hess = exprintdata->f.Hessian(exprintdata->x, 0);
2058 for(
int i = 0;
i < exprintdata->hesnnz; ++
i )
2059 exprintdata->hesvalues[
i] = hess[exprintdata->hessparsity_row[
i] * n + exprintdata->hessparsity_col[
i]];
2066 exprintdata->f.SparseHessianCompute(exprintdata->x, vector<double>(1, 1.0), exprintdata->hessparsity_pattern, exprintdata->hessparsity_row, exprintdata->hessparsity_col, exprintdata->hesvalues, exprintdata->heswork);
2070 exprintdata->hessparsity_row.clear();
2071 exprintdata->hessparsity_col.clear();
2072 exprintdata->hessparsity_pattern.resize(0,0);
2081 for(
size_t i = 0;
i < n; ++
i )
2086 for(
int i = 0;
i < exprintdata->hesnnz; ++
i )
2088 SCIPinfoMessage(
scip,
NULL,
" (%d,%d)=%g", exprintdata->hesrowidxs[
i], exprintdata->hescolidxs[
i], exprintdata->hesvalues[
i]);
2093 *rowidxs = exprintdata->hesrowidxs;
2094 *colidxs = exprintdata->hescolidxs;
2095 *hessianvals = exprintdata->hesvalues.data();
2096 *nnz = exprintdata->hesnnz;
atomic_userexpr(SCIP *scip_, SCIP_EXPR *expr_)
common defines and data types used in all packages of SCIP
exponential expression handler
logarithm expression handler
power and signed power expression handlers
handler for variable index expressions
methods to interpret (evaluate) an expression "fast"
#define CPPAD_MAX_NUM_THREADS
void posintpower(const vector< Type > &in, vector< Type > &out, size_t exponent)
static CppAD::ErrorHandler errorhandler(cppaderrorcallback)
static void cppaderrorcallback(bool known, int line, const char *file, const char *cond, const char *msg)
static void evalIntPower(Type &resultant, const Type &arg, const int exponent)
static void evalSignPower(CppAD::AD< Type > &resultant, const CppAD::AD< Type > &arg, SCIP_EXPR *expr)
static SCIP_RETCODE eval(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, const vector< Type > &x, Type &val)
int SCIPgetIndexExprVaridx(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprVaridx(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPisExprLog(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPisExprExp(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPisExprSignpower(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprintCompile(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA **exprintdata)
SCIP_RETCODE SCIPexprintFreeData(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA **exprintdata)
SCIP_EXPRINTCAPABILITY SCIPexprintGetCapability(void)
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 SCIPexprintFree(SCIP *scip, SCIP_EXPRINT **exprint)
SCIP_RETCODE SCIPexprintEval(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, SCIP_Real *varvals, SCIP_Real *val)
const char * SCIPexprintGetName(void)
const char * SCIPexprintGetDesc(void)
SCIP_EXPRINTCAPABILITY SCIPexprintGetExprCapability(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata)
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)
SCIP_RETCODE SCIPexprintCreate(SCIP *scip, SCIP_EXPRINT **exprint)
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)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
const char * SCIPexprhdlrGetName(SCIP_EXPRHDLR *exprhdlr)
SCIP_Bool SCIPexprhdlrHasFwdiff(SCIP_EXPRHDLR *exprhdlr)
SCIP_RETCODE SCIPevalExpr(SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
SCIP_Real SCIPgetExponentExprPow(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprProduct(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPexpriterIsEnd(SCIP_EXPRITER *iterator)
SCIP_Bool SCIPisExprSum(SCIP *scip, SCIP_EXPR *expr)
SCIP_Real * SCIPgetCoefsExprSum(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
SCIP_Real SCIPgetCoefExprProduct(SCIP_EXPR *expr)
SCIP_EXPR * SCIPexpriterGetCurrent(SCIP_EXPRITER *iterator)
SCIP_Bool SCIPisExprVar(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPcallExprEval(SCIP *scip, SCIP_EXPR *expr, SCIP_Real *childrenvalues, SCIP_Real *val)
SCIP_RETCODE SCIPcreateExpriter(SCIP *scip, SCIP_EXPRITER **iterator)
SCIP_RETCODE SCIPcallExprEvalFwdiff(SCIP *scip, SCIP_EXPR *expr, SCIP_Real *childrenvalues, SCIP_Real *direction, SCIP_Real *val, SCIP_Real *dot)
SCIP_RETCODE SCIPprintExpr(SCIP *scip, SCIP_EXPR *expr, FILE *file)
SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprPower(SCIP *scip, SCIP_EXPR *expr)
SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
SCIP_EXPR * SCIPexpriterGetNext(SCIP_EXPRITER *iterator)
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
SCIP_Real SCIPgetConstantExprSum(SCIP_EXPR *expr)
void SCIPfreeExpriter(SCIP_EXPRITER **iterator)
SCIP_RETCODE SCIPexpriterInit(SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit)
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
assert(minobj< SCIPgetCutoffbound(scip))
interval arithmetics for provable bounds
public functions to work with algebraic expressions
public functions to work with algebraic expressions
struct SCIP_Expr SCIP_EXPR
struct SCIP_ExprIter SCIP_EXPRITER
#define SCIP_EXPRINTCAPABILITY_GRADIENT
struct SCIP_ExprIntData SCIP_EXPRINTDATA
#define SCIP_EXPRINTCAPABILITY_HESSIAN
#define SCIP_EXPRINTCAPABILITY_FUNCVALUE
#define SCIP_EXPRINTCAPABILITY_ALL
struct SCIP_ExprInt SCIP_EXPRINT
unsigned int SCIP_EXPRINTCAPABILITY
enum SCIP_Retcode SCIP_RETCODE