std::atomic_size_t ncurthreads{0};
117static thread_local intthread_number{-1};
121boolin_parallel(
void)
123 returnncurthreads > 1;
131size_tthread_num(
void)
137 if( thread_number == -1 )
139thread_number =
static_cast<int>(ncurthreads.fetch_add(1, std::memory_order_relaxed));
142threadnum =
static_cast<size_t>(thread_number);
152extern "C"SCIP_EXPORT
charSCIPexprintCppADInitParallel(
void);
154__attribute__((constructor))
156charSCIPexprintCppADInitParallel(
void)
159CppAD::parallel_ad<double>();
164#if !defined(__GNUC__) 169static charinit_parallel_return = SCIPexprintCppADInitParallel();
179structSCIP_ExprIntData
186need_retape_always(false),
204assert(std::binary_search(varidxs.begin(), varidxs.end(), varidx));
205 returnstd::lower_bound(varidxs.begin(), varidxs.end(), varidx) - varidxs.begin();
208vector< int > varidxs;
209vector< AD<double> > X;
210vector< AD<double> > Y;
211CppAD::ADFun<double> f;
216 boolneed_retape_always;
218vector<atomic_userexpr*> userexprs;
223vector<SCIP_Real> hesvalues;
228CppAD::local::internal_sparsity<bool>::pattern_type hessparsity_pattern;
229CppAD::vector<size_t> hessparsity_row;
230CppAD::vector<size_t> hessparsity_col;
231CppAD::sparse_hessian_work heswork;
234#ifndef NO_CPPAD_USER_ATOMIC 242boolunivariate_for_sparse_jac(
244 constCppAD::vector<bool>&
r,
245CppAD::vector<bool>& s
248assert(
r.size() == q);
249assert(s.size() == q);
262boolunivariate_rev_sparse_jac(
264 constCppAD::vector<bool>&
r,
265CppAD::vector<bool>& s
268assert(
r.size() == q);
269assert(s.size() == q);
282boolunivariate_rev_sparse_hes(
283 constCppAD::vector<bool>& vx,
284 constCppAD::vector<bool>& s,
285CppAD::vector<bool>& t,
287 constCppAD::vector<bool>&
r,
288 constCppAD::vector<bool>& u,
289CppAD::vector<bool>& v
292assert(
r.size() == q);
293assert(s.size() == 1);
294assert(t.size() == 1);
295assert(u.size() == q);
296assert(v.size() == q);
305 for(
size_tj = 0; j < q; ++j )
320template<
classType>
321classatomic_posintpower :
publicCppAD::atomic_base<Type>
325: CppAD::atomic_base<
Type>(
"posintpower"),
329this->option(CppAD::atomic_base<Type>::bool_sparsity_enum);
341 virtual voidset_old(
size_t id)
343exponent = (int)
id;
361 constCppAD::vector<bool>& vx,
362CppAD::vector<bool>& vy,
363 constCppAD::vector<Type>& tx,
364CppAD::vector<Type>& ty
367assert(exponent > 1);
368assert(tx.size() >= p+1);
369assert(ty.size() >= p+1);
374assert(vx.size() == 1);
375assert(vy.size() == 1);
383ty[0] = CppAD::pow(tx[0], exponent);
386 if( q <= 1 && 1 <= p )
388ty[1] = CppAD::pow(tx[0], exponent-1) * tx[1];
389ty[1] *= double(exponent);
392 if( q <= 2 && 2 <= p )
397ty[2] = CppAD::pow(tx[0], exponent-2) * tx[1] * tx[1];
398ty[2] *= (exponent-1) / 2.0;
399ty[2] += CppAD::pow(tx[0], exponent-1) * tx[2];
404assert(exponent == 2);
406ty[2] = tx[1] * tx[1] + 2.0 * tx[0] * tx[2];
449 constCppAD::vector<Type>& tx,
450 constCppAD::vector<Type>& ty,
451CppAD::vector<Type>& px,
452 constCppAD::vector<Type>& py
455assert(exponent > 1);
456assert(px.size() >= p+1);
457assert(py.size() >= p+1);
458assert(tx.size() >= p+1);
464px[0] = py[0] * CppAD::pow(tx[0], exponent-1);
470px[0] = py[1] * tx[1] * CppAD::pow(tx[0], exponent-2);
472px[0] += py[0] * CppAD::pow(tx[0], exponent-1);
475px[1] = py[1] * CppAD::pow(tx[0], exponent-1);
486 usingCppAD::atomic_base<Type>::for_sparse_jac;
495 constCppAD::vector<bool>&
r,
496CppAD::vector<bool>& s
499 returnunivariate_for_sparse_jac(q,
r, s);
502 usingCppAD::atomic_base<Type>::rev_sparse_jac;
511 constCppAD::vector<bool>&
r,
512CppAD::vector<bool>& s
515 returnunivariate_rev_sparse_jac(q,
r, s);
518 usingCppAD::atomic_base<Type>::rev_sparse_hes;
526 constCppAD::vector<bool>& vx,
527 constCppAD::vector<bool>& s,
528CppAD::vector<bool>& t,
530 constCppAD::vector<bool>&
r,
531 constCppAD::vector<bool>& u,
532CppAD::vector<bool>& v
535 returnunivariate_rev_sparse_hes(vx, s, t, q,
r, u, v);
540template<
classType>
543 constvector<Type>& in,
548 staticatomic_posintpower<typename Type::value_type> pip;
549pip(in, out, exponent);
555template<
classType>
557 constvector<Type>& in,
562out[0] = pow(in[0], (
int)exponent);
568#ifndef NO_CPPAD_USER_ATOMIC 574#define SIGN(x) ((x) >= 0.0 ? 1.0 : -1.0) 584template<
classType>
585classatomic_signpower :
publicCppAD::atomic_base<Type>
589: CppAD::atomic_base<
Type>(
"signpower"),
593this->option(CppAD::atomic_base<Type>::bool_sparsity_enum);
605 virtual voidset_old(
size_t id)
625 constCppAD::vector<bool>& vx,
626CppAD::vector<bool>& vy,
627 constCppAD::vector<Type>& tx,
628CppAD::vector<Type>& ty
631assert(exponent > 0.0);
632assert(tx.size() >= p+1);
633assert(ty.size() >= p+1);
638assert(vx.size() == 1);
639assert(vy.size() == 1);
647ty[0] =
SIGN(tx[0]) * pow(
REALABS(tx[0]), exponent);
650 if( q <= 1 && 1 <= p )
652ty[1] = pow(
REALABS(tx[0]), exponent - 1.0) * tx[1];
656 if( q <= 2 && 2 <= p )
658 if( exponent != 2.0 )
660ty[2] =
SIGN(tx[0]) * pow(
REALABS(tx[0]), exponent - 2.0) * tx[1] * tx[1];
661ty[2] *= (exponent - 1.0) / 2.0;
662ty[2] += pow(
REALABS(tx[0]), exponent - 1.0) * tx[2];
668ty[2] =
SIGN(tx[0]) * tx[1] * tx[1];
669ty[2] += 2.0 *
REALABS(tx[0]) * tx[2];
712 constCppAD::vector<Type>& tx,
713 constCppAD::vector<Type>& ty,
714CppAD::vector<Type>& px,
715 constCppAD::vector<Type>& py
718assert(exponent > 1);
719assert(px.size() >= p+1);
720assert(py.size() >= p+1);
721assert(tx.size() >= p+1);
727px[0] = py[0] * pow(
REALABS(tx[0]), exponent - 1.0);
732 if( exponent != 2.0 )
735px[0] = py[1] * tx[1] * pow(
REALABS(tx[0]), exponent - 2.0) *
SIGN(tx[0]);
736px[0] *= exponent - 1.0;
737px[0] += py[0] * pow(
REALABS(tx[0]), exponent - 1.0);
740px[1] = py[1] * pow(
REALABS(tx[0]), exponent - 1.0);
746px[0] = py[1] * tx[1] *
SIGN(tx[0]);
747px[0] += py[0] *
REALABS(tx[0]);
750px[1] = py[1] *
REALABS(tx[0]);
762 usingCppAD::atomic_base<Type>::for_sparse_jac;
771 constCppAD::vector<bool>&
r,
772CppAD::vector<bool>& s
775 returnunivariate_for_sparse_jac(q,
r, s);
778 usingCppAD::atomic_base<Type>::rev_sparse_jac;
787 constCppAD::vector<bool>&
r,
788CppAD::vector<bool>& s
791 returnunivariate_rev_sparse_jac(q,
r, s);
794 usingCppAD::atomic_base<Type>::rev_sparse_hes;
802 constCppAD::vector<bool>& vx,
803 constCppAD::vector<bool>& s,
804CppAD::vector<bool>& t,
806 constCppAD::vector<bool>&
r,
807 constCppAD::vector<bool>& u,
808CppAD::vector<bool>& v
811 returnunivariate_rev_sparse_hes(vx, s, t, q,
r, u, v);
817template<
classType>
825vector<Type> in(1, arg);
828 staticatomic_signpower<typename Type::value_type> sp;
829sp(in, out, (
size_t)(
void*)expr);
838template<
classType>
841CppAD::AD<Type>& resultant,
842 constCppAD::AD<Type>& arg,
850assert(exponent >= 1.0);
854resultant = CppAD::CondExpGe(arg, adzero, pow(arg, (
int)exponent), -pow(-arg, (
int)exponent));
861resultant = CppAD::CondExpEq(arg, adzero, pow(arg+std::numeric_limits<SCIP_Real>::epsilon(), exponent)-pow(std::numeric_limits<SCIP_Real>::epsilon(), exponent),
862CppAD::CondExpGe(arg, adzero, pow(arg, exponent), -pow(-arg, exponent)));
915 constCppAD::vector<bool>& vx,
916CppAD::vector<bool>& vy,
917 constCppAD::vector<SCIP_Real>& tx,
918CppAD::vector<SCIP_Real>& ty
922assert(expr !=
NULL);
923assert(ty.size() == p+1);
926 size_tn = tx.size() / (p+1);
934assert(vx.size() == n);
935assert(vy.size() == 1);
940 for(
size_ti = 0; i < n; ++i )
971 for(
size_ti = 0; i < n; ++i )
973 x[i] = tx[i * (p+1) + 0];
974dir[i] = tx[i * (p+1) + 1];
994#if SCIP_DISABLED_CODE 999 if( q <= 2 && 1 <= p )
1001 if( q <= 2 && 2 <= p )
1004 if( exprEvalUser(expr,
x, ty[0], gradient, hessian) !=
SCIP_OKAY)
1012 if( gradient !=
NULL)
1015 for(
size_ti = 0; i < n; ++i )
1016ty[1] += gradient[i] * tx[i * (p+1) + 1];
1019 if( hessian !=
NULL)
1021assert(gradient !=
NULL);
1024 for(
size_ti = 0; i < n; ++i )
1026 for(
size_tj = 0; j < n; ++j )
1027ty[2] += 0.5 * hessian[i*n+j] * tx[i * (p+1) + 1] * tx[j * (p+1) + 1];
1029ty[2] += gradient[i] * tx[i * (p+1) + 2];
1104 constCppAD::vector<SCIP_Real>& tx,
1105 constCppAD::vector<SCIP_Real>& ty,
1106CppAD::vector<SCIP_Real>& px,
1107 constCppAD::vector<SCIP_Real>& py
1110assert(expr !=
NULL);
1111assert(px.size() == tx.size());
1112assert(py.size() == p+1);
1118#ifdef SCIP_DISABLED_CODE 1120 size_tn = tx.size() / (p+1);
1132 for(
size_ti = 0; i < n; ++i )
1133 x[i] = tx[i * (p+1) + 0];
1135 if( exprEvalUser(expr,
x, funcval, gradient, hessian) !=
SCIP_OKAY)
1147 for(
size_ti = 0; i < n; ++i )
1148px[i] = py[0] * gradient[i];
1154assert(hessian !=
NULL);
1155 for(
size_ti = 0; i < n; ++i )
1157px[i*2+0] = py[0] * gradient[i];
1158 for(
size_tj = 0; j < n; ++j )
1159px[i*2+0] += py[1] * hessian[i+n*j] * tx[j*2+1];
1161px[i*2+1] = py[1] * gradient[i];
1173 usingCppAD::atomic_base<SCIP_Real>::for_sparse_jac;
1180 boolfor_sparse_jac(
1182 constCppAD::vector<bool>&
r,
1183CppAD::vector<bool>& s
1186assert(expr !=
NULL);
1187assert(s.size() == q);
1189 size_tn =
r.size() / q;
1193 for(
size_tj = 0; j < q; j++ )
1196 for(
size_ti = 0; i < n; i++ )
1197s[j] |= (
bool)
r[i * q + j];
1203 usingCppAD::atomic_base<SCIP_Real>::rev_sparse_jac;
1210 boolrev_sparse_jac(
1212 constCppAD::vector<bool>& rt,
1213CppAD::vector<bool>& st
1216assert(expr !=
NULL);
1217assert(rt.size() == q);
1219 size_tn = st.size() / q;
1223 for(
size_tj = 0; j < q; j++ )
1224 for(
size_ti = 0; i < n; i++ )
1225st[i * q + j] = rt[j];
1230 usingCppAD::atomic_base<SCIP_Real>::rev_sparse_hes;
1237 boolrev_sparse_hes(
1238 constCppAD::vector<bool>& vx,
1239 constCppAD::vector<bool>& s,
1240CppAD::vector<bool>& t,
1242 constCppAD::vector<bool>&
r,
1243 constCppAD::vector<bool>& u,
1244CppAD::vector<bool>& v
1247assert(expr !=
NULL);
1248 size_tn = vx.size();
1250assert(s.size() == 1);
1251assert(t.size() == n);
1252assert(
r.size() == n * q);
1253assert(u.size() == q);
1254assert(v.size() == n * q);
1259 for( i = 0; i < n; ++i )
1267 for( j = 0; j < q; j++ )
1268 for( i = 0; i < n; i++ )
1269v[ i * q + j] = u[j];
1274 for( j = 0; j < q; j++ )
1275 for( i = 0; i < n; i++ )
1276 for( k = 0; k < n; ++k )
1277v[ i * q + j] |= (
bool)
r[ k * q + j];
1285template<
classType>
1295vector<Type> in(1, arg);
1296vector<Type> out(1);
1304 if( exponent < -1 )
1306vector<Type> in(1, arg);
1307vector<Type> out(1);
1311resultant =
Type(1.0)/out[0];
1315 if( exponent == 1 )
1321 if( exponent == 0 )
1323resultant =
Type(1.0);
1327assert(exponent == -1);
1328resultant =
Type(1.0)/arg;
1332template<
classType>
1338 constvector<Type>&
x,
1344assert(expr !=
NULL);
1368#ifndef EVAL_USE_EXPRHDLR_ALWAYS 1386 else if( exponent == 0.5 )
1388 else if( exponent < 1.0 )
1394AD<double> adzero(0.);
1395val = CppAD::CondExpEq(buf[0], adzero, pow(buf[0]+std::numeric_limits<SCIP_Real>::epsilon(), exponent)-pow(std::numeric_limits<SCIP_Real>::epsilon(), exponent),
1396pow(buf[0], exponent));
1434val = CppAD::CondExpGt(buf[0], AD<double>(0.), -buf[0] * log(buf[0]), -sqrt(buf[0]));
1442vector<Type> out(1);
1445(*exprintdata->userexprs.back())(in, out);
1471 SCIPdebugMessage(
"ignore CppAD error from %sknown source %s:%d: msg: %s exp: %s\n", known ?
"":
"un", file, line, msg, cond);
1480 returnCPPAD_PACKAGE_STRING;
1486 return "Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD)";
1503assert(exprint !=
NULL);
1516assert(exprint !=
NULL);
1540assert(rootexpr !=
NULL);
1541assert(exprintdata !=
NULL);
1543 if( *exprintdata ==
NULL)
1546assert(*exprintdata !=
NULL);
1550(*exprintdata)->need_retape =
true;
1551(*exprintdata)->need_retape_always =
false;
1552(*exprintdata)->hesconstant =
false;
1558std::set<int> varidxs;
1571#ifndef EVAL_USE_EXPRHDLR_ALWAYS 1603(*exprintdata)->varidxs.reserve(varidxs.size());
1604(*exprintdata)->varidxs.insert((*exprintdata)->varidxs.begin(), varidxs.begin(), varidxs.end());
1606 size_tn = (*exprintdata)->varidxs.size();
1607(*exprintdata)->X.resize(n);
1608(*exprintdata)->x.resize(n);
1609(*exprintdata)->Y.resize(1);
1616(*exprintdata)->hesconstant =
true;
1631(*exprintdata)->hesconstant =
false;
1634 SCIPdebugMsg(
scip,
"Hessian found %sconstant\n", (*exprintdata)->hesconstant ?
"":
"not ");
1648assert( exprintdata !=
NULL);
1649assert(*exprintdata !=
NULL);
1654 for( vector<atomic_userexpr*>::iterator it((*exprintdata)->userexprs.begin()); it != (*exprintdata)->userexprs.end(); ++it )
1656(*exprintdata)->userexprs.clear();
1658 delete*exprintdata;
1659*exprintdata =
NULL;
1678assert(exprintdata !=
NULL);
1680 returnexprintdata->userevalcapability;
1693assert(expr !=
NULL);
1694assert(exprintdata !=
NULL);
1695assert(varvals !=
NULL);
1696assert(val !=
NULL);
1698 size_tn = exprintdata->varidxs.size();
1707 if( exprintdata->need_retape_always || exprintdata->need_retape )
1712exprintdata->hesvalues.clear();
1713exprintdata->hesnnz = 0;
1715 for(
size_ti = 0; i < n; ++i )
1717 intidx = exprintdata->varidxs[i];
1718exprintdata->X[i] = varvals[idx];
1719exprintdata->x[i] = varvals[idx];
1723 for( vector<atomic_userexpr*>::iterator it(exprintdata->userexprs.begin()); it != exprintdata->userexprs.end(); ++it )
1725exprintdata->userexprs.clear();
1727CppAD::Independent(exprintdata->X);
1729 SCIP_CALL(
eval(
scip, expr, exprintdata, exprintdata->X, exprintdata->Y[0]) );
1731exprintdata->f.Dependent(exprintdata->X, exprintdata->Y);
1733exprintdata->val = Value(exprintdata->Y[0]);
1734 SCIPdebugMessage(
"Eval retaped and computed value %g\n", exprintdata->val);
1740exprintdata->f.optimize();
1742exprintdata->need_retape =
false;
1746assert(exprintdata->x.size() >= n);
1747 for(
size_ti = 0; i < n; ++i )
1748exprintdata->x[i] = varvals[exprintdata->varidxs[i]];
1750exprintdata->val = exprintdata->f.Forward(0, exprintdata->x)[0];
1751 SCIPdebugMessage(
"Eval used forward sweep to compute value %g\n", exprintdata->val);
1754*val = exprintdata->val;
1771assert(expr !=
NULL);
1772assert(exprintdata !=
NULL);
1773assert(varvals !=
NULL|| new_varvals ==
FALSE);
1774assert(val !=
NULL);
1775assert(gradient !=
NULL);
1782*val = exprintdata->val;
1784 size_tn = exprintdata->varidxs.size();
1790 if( exprintdata->userexprs.empty() )
1791jac = exprintdata->f.Jacobian(exprintdata->x);
1796exprintdata->f.Forward(0, exprintdata->x);
1798CppAD::JacobianFor(exprintdata->f, exprintdata->x, jac);
1801 for(
size_ti = 0; i < n; ++i )
1802gradient[exprintdata->varidxs[i]] = jac[i];
1808 for(
size_ti = 0; i < n; ++i )
1813 for(
size_ti = 0; i < n; ++i )
1840assert(expr !=
NULL);
1841assert(exprintdata !=
NULL);
1842assert(varvals !=
NULL);
1843assert(rowidxs !=
NULL);
1844assert(colidxs !=
NULL);
1845assert(nnz !=
NULL);
1847 if( exprintdata->hesrowidxs ==
NULL)
1849assert(exprintdata->hescolidxs ==
NULL);
1850assert(exprintdata->hesvalues.size() == 0);
1851assert(exprintdata->hesnnz == 0);
1853 size_tn = exprintdata->varidxs.size();
1862 if( exprintdata->need_retape_always )
1865exprintdata->hesnnz = (n * (n+1))/2;
1870 for(
size_ti = 0; i < n; ++i )
1871 for(
size_tj = 0; j <= i; ++j )
1873exprintdata->hesrowidxs[k] = exprintdata->varidxs[i];
1874exprintdata->hescolidxs[k] = exprintdata->varidxs[j];
1884*rowidxs = exprintdata->hesrowidxs;
1885*colidxs = exprintdata->hescolidxs;
1886*nnz = exprintdata->hesnnz;
1891 if( exprintdata->need_retape )
1901vector<bool>
r(nn,
false);
1902 for(
size_ti = 0; i < n; ++i )
1904(void) exprintdata->f.ForSparseJac(n,
r);
1913vector<bool> hessparsity;
1914exprintdata->f.RevSparseHesCase(
true,
false, n, vector<bool>(1,
true), hessparsity);
1917exprintdata->hessparsity_pattern.resize(0, 0);
1918exprintdata->hessparsity_pattern.resize(n, n);
1919 size_thesnnz_full = 0;
1920 for(
size_ti = 0; i < nn; ++i )
1921 if( hessparsity[i] )
1930++exprintdata->hesnnz;
1942exprintdata->hessparsity_row.resize(hesnnz_full);
1943exprintdata->hessparsity_col.resize(hesnnz_full);
1945 for(
size_ti = 0, j = 0, k = 0; i < nn; ++i )
1946 if( hessparsity[i] )
1951 if( (
size_t)exprintdata->hesnnz <= nn/4 )
1954exprintdata->hessparsity_pattern.add_element(row, col);
1961assert(exprintdata->hesnnz + k < hesnnz_full);
1962exprintdata->hessparsity_row[exprintdata->hesnnz + k] = row;
1963exprintdata->hessparsity_col[exprintdata->hesnnz + k] = col;
1968exprintdata->hessparsity_row[j] = row;
1969exprintdata->hessparsity_col[j] = col;
1971assert(j < (
size_t)exprintdata->hesnnz);
1972exprintdata->hesrowidxs[j] = exprintdata->varidxs[row];
1973exprintdata->hescolidxs[j] = exprintdata->varidxs[col];
1981 for(
inti = 0; i < exprintdata->hesnnz; ++i )
1989*rowidxs = exprintdata->hesrowidxs;
1990*colidxs = exprintdata->hescolidxs;
1991*nnz = exprintdata->hesnnz;
2015assert(expr !=
NULL);
2016assert(exprintdata !=
NULL);
2018 if( exprintdata->hesrowidxs ==
NULL)
2024assert(exprintdata->hescolidxs ==
NULL);
2025assert(exprintdata->hesvalues.size() == 0);
2026assert(exprintdata->hesnnz == 0);
2030new_varvals =
FALSE;
2038*val = exprintdata->val;
2040 size_tn = exprintdata->varidxs.size();
2043 if( n > 0 && (!exprintdata->hesconstant || exprintdata->hesvalues.size() < (
size_t)exprintdata->hesnnz) )
2047 if( exprintdata->hesvalues.size() == 0 )
2050exprintdata->hesvalues.resize(exprintdata->hessparsity_row.size());
2054 if( (
size_t)exprintdata->hesnnz > nn/4 )
2058vector<double> hess = exprintdata->f.Hessian(exprintdata->x, 0);
2059 for(
inti = 0; i < exprintdata->hesnnz; ++i )
2060exprintdata->hesvalues[i] = hess[exprintdata->hessparsity_row[i] * n + exprintdata->hessparsity_col[i]];
2067exprintdata->f.SparseHessianCompute(exprintdata->x, vector<double>(1, 1.0), exprintdata->hessparsity_pattern, exprintdata->hessparsity_row, exprintdata->hessparsity_col, exprintdata->hesvalues, exprintdata->heswork);
2071exprintdata->hessparsity_row.clear();
2072exprintdata->hessparsity_col.clear();
2073exprintdata->hessparsity_pattern.resize(0,0);
2082 for(
size_ti = 0; i < n; ++i )
2087 for(
inti = 0; i < exprintdata->hesnnz; ++i )
2089 SCIPinfoMessage(
scip,
NULL,
" (%d,%d)=%g", exprintdata->hesrowidxs[i], exprintdata->hescolidxs[i], exprintdata->hesvalues[i]);
2094*rowidxs = exprintdata->hesrowidxs;
2095*colidxs = exprintdata->hescolidxs;
2096*hessianvals = exprintdata->hesvalues.data();
2097*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 *rootexpr, 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)
interval arithmetics for provable bounds
public functions to work with algebraic expressions
public functions to work with algebraic expressions
#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
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