本文整理汇总了C++中Enode类的典型用法代码示例。如果您正苦于以下问题:C++ Enode类的具体用法?C++ Enode怎么用?C++ Enode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Enode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
lbool SimpSMTSolver::solve( const vec< Enode * > & assumps
, const unsigned conflicts
, bool do_simp
, bool turn_off_simp )
{
vec<Lit> lits;
for ( int i=0; i<assumps.size(); ++i )
{
Enode * e = assumps[ i ];
if ( e->isFalse( ) )
{
return l_False;
}
if ( e->isTrue( ) )
{
continue;
}
Lit l = theory_handler->enodeToLit( e );
lits.push( l );
}
return solve( lits, conflicts, do_simp, turn_off_simp );
}
示例2: assert
//
// Check if a formula is a clause
//
bool Cnfizer::checkClause( Enode * e, set< enodeid_t > & check_cache )
{
assert( e );
if ( e->isLit( ) )
{
check_cache.insert( e->getId( ) ); // Don't check again
return true;
}
if ( !e->isOr( ) )
return false;
if ( check_cache.find( e->getId( ) ) != check_cache.end( ) ) // Already visited term
return true;
bool is_clause = true;
for ( Enode * list = e->getCdr( ) ;
list != egraph.enil && is_clause ;
list = list->getCdr( ) )
is_clause = checkClause( list->getCar( ), check_cache );
if ( !is_clause )
return false;
check_cache.insert( e->getId( ) ); // Don't check again
return true;
}
示例3: make_nlctrs
vector<shared_ptr<nonlinear_constraint>> make_nlctrs(Enode * const e,
unordered_set<Enode *> const & var_set,
lbool const p) {
vector<shared_ptr<nonlinear_constraint>> ret;
if (e->isTrue()) {
return ret;
}
if (e->isFalse()) {
DREAL_LOG_FATAL << "false is not a valid invariant (forall_t constraint)";
throw logic_error("false is not a valid invariant (forall_t constraint)");
}
if (e->isNot()) {
return make_nlctrs(e->get1st(), var_set, !p);
}
if (e->isAnd()) {
Enode * tmp = e->getCdr();
while (!tmp->isEnil()) {
auto const nlctrs = make_nlctrs(e->get1st(), var_set, p);
ret.insert(ret.end(), nlctrs.begin(), nlctrs.end());
tmp = tmp->getCdr();
}
return ret;
}
if (e->isOr()) {
DREAL_LOG_FATAL << "or is not a valid invariant for now, (forall_t constraint)";
throw logic_error("false is not a valid invariant for now, (forall_t constraint)");
}
ret.push_back(make_shared<nonlinear_constraint>(e, var_set, p));
return ret;
}
示例4: checkPureConj
//
// Check if its a pure conjunction of literals
//
bool Cnfizer::checkPureConj( Enode * e, set< enodeid_t > & check_cache )
{
if ( check_cache.find( e->getId( ) ) != check_cache.end( ) )
return true;
if ( e->isLit( ) )
{
check_cache.insert( e->getId( ) );
return true;
}
if ( !e->isAnd( ) )
return false;
bool is_pure_conj = true;
for ( Enode * list = e->getCdr( ) ;
list != egraph.enil && is_pure_conj ;
list = list->getCdr( ) )
is_pure_conj = checkPureConj( list->getCar( ), check_cache );
if ( !is_pure_conj )
return false;
check_cache.insert( e->getId( ) );
return true;
}
示例5: display
ostream& display(ostream& out, box const & b, bool const exact, bool const old_style) {
std::streamsize ss = out.precision();
out.precision(16);
if (old_style) {
out << "delta-sat with the following box:" << endl;
unsigned const s = b.size();
for (unsigned i = 0; i < s; i++) {
Enode * e = b.m_vars[i];
string const & name = e->getCar()->getName();
ibex::Interval const & v = b.m_values[i];
out << "\t" << name << " : " << v;
if (i != (s - 1)) {
out << ";";
}
out << endl;
}
} else {
unsigned const s = b.size();
for (unsigned i = 0; i < s; i++) {
Enode * e = b.m_vars[i];
ibex::Interval const & v = b.m_values[i];
ibex::Interval const & d = b.m_domains[i];
out << e->getCar()->getName()
<< " : ";
display(out, d, exact);
out << " = ";
display(out, v, exact);
out << endl;
}
}
out.precision(ss);
return out;
}
示例6: assert
ibex::SystemFactory * contractor_ibex_polytope::build_system_factory(
vector<Enode *> const & vars, vector<shared_ptr<nonlinear_constraint>> const & ctrs) {
DREAL_LOG_DEBUG << "build_system_factory:";
ibex::SystemFactory * sf = new ibex::SystemFactory();
map<string, ibex::ExprSymbol const *> var_map; // Needed for translateEnodeToExprCtr
// Construct System: add Variables
for (Enode * e : vars) {
string const & name = e->getCar()->getNameFull();
DREAL_LOG_INFO << "build_system_factory: Add Variable " << name;
auto var_it = m_var_cache.find(e);
ibex::ExprSymbol const * var = nullptr;
if (var_it == m_var_cache.end()) {
// Not found
var = &ibex::ExprSymbol::new_(name.c_str(), ibex::Dim::scalar());
DREAL_LOG_INFO << "Added: var " << var << endl;
m_var_cache.emplace(e, var);
} else {
// Found
var = var_it->second;
}
var_map.emplace(name, var);
sf->add_var(*var);
}
DREAL_LOG_DEBUG << "build_system_factory: Add Variable: DONE";
// Construct System: add constraints
for (shared_ptr<nonlinear_constraint> const ctr : ctrs) {
if (ctr->is_neq()) {
continue;
}
DREAL_LOG_INFO << "build_system_factory: Add Constraint: " << *ctr;
Enode * e = ctr->get_enode();
auto p = e->getPolarity();
assert(p == l_True || p == l_False);
auto & m_exprctr_cache = (p == l_True) ? m_exprctr_cache_pos : m_exprctr_cache_neg;
auto exprctr_it = m_exprctr_cache.find(e);
ibex::ExprCtr const * exprctr = nullptr;
if (exprctr_it == m_exprctr_cache.end()) {
// Not found
exprctr = translate_enode_to_exprctr(var_map, e);
m_exprctr_cache.emplace(e, exprctr);
DREAL_LOG_INFO << "Added: exprctr " << p << " " << *exprctr << endl;
} else {
// Found
exprctr = exprctr_it->second;
}
if (exprctr) {
DREAL_LOG_INFO << "build_system_factory: Add Constraint: expr: " << *exprctr;
sf->add_ctr(*exprctr);
}
}
DREAL_LOG_DEBUG << "build_system_factory: Add Constraint: "
<< "DONE";
DREAL_LOG_DEBUG << "build_system_factory: DONE";
return sf;
}
示例7: assert
void THandler::clearVar( Var v )
{
assert( var_to_enode[ v ] != NULL );
Enode * e = var_to_enode[ v ];
assert( e->getId( ) < static_cast< int >( enode_id_to_var.size( ) ) );
assert( enode_id_to_var[ e->getId( ) ] == v );
var_to_enode[ v ] = NULL;
enode_id_to_var[ e->getId( ) ] = var_Undef;
}
示例8: dreal_get_domain_ub
double dreal_get_domain_ub(dreal_context c, dreal_expr v) {
assert(c);
assert(v);
OpenSMTContext * c_ = static_cast<OpenSMTContext *>(c);
OpenSMTContext & context = *c_;
assert(context.getStatus() == l_True);
Enode * var = static_cast<Enode *>(v);
return var->getDomainUpperBound();
}
示例9: dreal_set_domain_ub
void dreal_set_domain_ub(dreal_context c, dreal_expr v, double n) {
assert(c);
assert(v);
OpenSMTContext * c_ = static_cast<OpenSMTContext *>(c);
OpenSMTContext & context = *c_;
assert(context.getStatus() == l_True);
Enode * var = static_cast<Enode *>(v);
var->setDomainUpperBound(n);
}
示例10:
ostream & ode_constraint::display(ostream & out) const {
out << "ode_constraint(" << m_int << ")" << endl;
for (shared_ptr<forallt_constraint> const & inv : m_invs) {
Enode * e = inv->get_enodes()[0];
if (e->hasPolarity() && e->getPolarity() == l_True) {
out << *inv << endl;
}
}
return out;
}
示例11: opensmt_get_domain_lb
double opensmt_get_domain_lb( opensmt_context c, opensmt_expr v )
{
assert( c );
assert( v );
OpenSMTContext * c_ = static_cast< OpenSMTContext * >( c );
OpenSMTContext & context = *c_;
assert( context.getStatus( ) == l_True );
Enode * var = static_cast< Enode * >( v );
return var->getDomainLowerBound();
}
示例12: retrieveTopLevelFormulae
//
// Retrieve the formulae at the top-level
//
void Cnfizer::retrieveTopLevelFormulae( Enode * f, vector< Enode * > & top_level_formulae )
{
if ( f->isAnd( ) )
for ( Enode * list = f->getCdr( ) ;
list != egraph.enil ;
list = list->getCdr( ) )
retrieveTopLevelFormulae( list->getCar( ), top_level_formulae );
else
top_level_formulae.push_back( f );
}
示例13: opensmt_set_domain_lb
void opensmt_set_domain_lb( opensmt_context c, opensmt_expr v, double n )
{
assert( c );
assert( v );
OpenSMTContext * c_ = static_cast< OpenSMTContext * >( c );
OpenSMTContext & context = *c_;
assert( context.getStatus( ) == l_True );
Enode * var = static_cast< Enode * >( v );
var->setDomainLowerBound(n);
}
示例14: inform
//
// Inform Theory-Solvers of Theory-Atoms
//
void THandler::inform( )
{
for ( ; tatoms_given < tatoms_list.size( ) ; tatoms_given ++ )
{
if ( !tatoms_give[ tatoms_given ] ) continue;
Enode * atm = tatoms_list[ tatoms_given ];
assert( atm );
assert( atm->isTAtom( ) );
core_solver.inform( atm );
}
}
示例15: getSuggestion
Lit THandler::getSuggestion( )
{
Enode * e = core_solver.getSuggestion( );
if ( e == NULL )
return lit_Undef;
bool negate = e->getDecPolarity( ) == l_False;
Var v = enodeToVar( e );
return Lit( v, negate );
}