本文整理汇总了C++中Enode::getUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::getUpperBound方法的具体用法?C++ Enode::getUpperBound怎么用?C++ Enode::getUpperBound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::getUpperBound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extract_invariants
IVector ode_solver::extract_invariants() {
map<Enode*, pair<double, double>> inv_map;
for (auto inv : m_invs) {
Enode * p = inv->getCdr()->getCdr()->getCdr()->getCdr()->getCar();
Enode * op = p->getCar();
bool pos = true;
// Handle Negation
if (op->getId() == ENODE_ID_NOT) {
p = p->getCdr()->getCar();
op = p->getCar();
pos = false;
}
switch (op->getId()) {
case ENODE_ID_GEQ:
case ENODE_ID_GT:
// Handle >= & >
pos = !pos;
case ENODE_ID_LEQ:
case ENODE_ID_LT: {
// Handle <= & <
Enode * lhs = pos ? p->getCdr()->getCar() : p->getCdr()->getCdr()->getCar();
Enode * rhs = pos ? p->getCdr()->getCdr()->getCar() : p->getCdr()->getCar();
if (lhs->isVar() && rhs->isConstant()) {
if (inv_map.find(lhs) != inv_map.end()) {
inv_map[lhs].second = rhs->getValue();
} else {
inv_map.emplace(lhs, make_pair(lhs->getLowerBound(), rhs->getValue()));
}
} else if (lhs->isConstant() && rhs->isVar()) {
if (inv_map.find(rhs) != inv_map.end()) {
inv_map[rhs].first = lhs->getValue();
} else {
inv_map.emplace(rhs, make_pair(lhs->getValue(), rhs->getUpperBound()));
}
} else {
cerr << "ode_solver::extract_invariant: error:" << p << endl;
}
}
break;
default:
cerr << "ode_solver::extract_invariant: error" << p << endl;
}
}
IVector ret (m_t_vars.size());
unsigned i = 0;
for (auto const & m_t_var : m_t_vars) {
if (inv_map.find(m_t_var) != inv_map.end()) {
auto inv = interval(inv_map[m_t_var].first, inv_map[m_t_var].second);
DREAL_LOG_INFO << "Invariant extracted from " << m_t_var << " = " << inv;
ret[i++] = inv;
} else {
auto inv = interval(m_t_var->getLowerBound(), m_t_var->getUpperBound());
DREAL_LOG_INFO << "Default Invariant set for " << m_t_var << " = " << inv;
ret[i++] = inv;
}
}
return ret;
}