本文整理汇总了C++中TypeNode::isInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeNode::isInteger方法的具体用法?C++ TypeNode::isInteger怎么用?C++ TypeNode::isInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeNode
的用法示例。
在下文中一共展示了TypeNode::isInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasNonArithmeticVariable
bool InstantiationEngine::hasNonArithmeticVariable( Node f ){
for( int i=0; i<(int)f[0].getNumChildren(); i++ ){
TypeNode tn = f[0][i].getType();
if( !tn.isInteger() && !tn.isReal() ){
return true;
}
}
return false;
}
示例2: hasNonCbqiVariable
bool InstStrategyCbqi::hasNonCbqiVariable( Node q ){
for( unsigned i=0; i<q[0].getNumChildren(); i++ ){
TypeNode tn = q[0][i].getType();
if( !tn.isInteger() && !tn.isReal() && !tn.isBoolean() ){
if( options::cbqiSplx() ){
return true;
}else{
//datatypes supported in new implementation
if( !tn.isDatatype() ){
return true;
}
}
}
}
return false;
}
示例3: getFreeVariableForInstConstant
Node TermDb::getFreeVariableForInstConstant( Node n ){
TypeNode tn = n.getType();
if( d_free_vars.find( tn )==d_free_vars.end() ){
//if integer or real, make zero
if( tn.isInteger() || tn.isReal() ){
Rational z(0);
d_free_vars[tn] = NodeManager::currentNM()->mkConst( z );
}else{
if( d_type_map[ tn ].empty() ){
d_free_vars[tn] = NodeManager::currentNM()->mkSkolem( "freevar_$$", tn, "is a free variable created by termdb" );
Trace("mkVar") << "FreeVar:: Make variable " << d_free_vars[tn] << " : " << tn << std::endl;
}else{
d_free_vars[tn] = d_type_map[ tn ][ 0 ];
}
}
}
return d_free_vars[tn];
}
示例4: registerQuantifier
void ModelEngine::registerQuantifier( Node f ){
if( Trace.isOn("fmf-warn") ){
bool canHandle = true;
for( unsigned i=0; i<f[0].getNumChildren(); i++ ){
TypeNode tn = f[0][i].getType();
if( !tn.isSort() ){
if( !tn.getCardinality().isFinite() ){
if( tn.isInteger() ){
if( !options::fmfBoundInt() ){
canHandle = false;
}
}else{
canHandle = false;
}
}
}
}
if( !canHandle ){
Trace("fmf-warn") << "Warning : Model Engine : may not be able to answer SAT because of formula : " << f << std::endl;
}
}
}
示例5: initialize
bool RepSetIterator::initialize(){
for( size_t i=0; i<d_types.size(); i++ ){
d_index.push_back( 0 );
//store default index order
d_index_order.push_back( i );
d_var_order[i] = i;
//store default domain
d_domain.push_back( RepDomain() );
TypeNode tn = d_types[i];
if( tn.isSort() ){
if( !d_rep_set->hasType( tn ) ){
Node var = NodeManager::currentNM()->mkSkolem( "repSet", tn, "is a variable created by the RepSetIterator" );
Trace("mkVar") << "RepSetIterator:: Make variable " << var << " : " << tn << std::endl;
d_rep_set->add( tn, var );
}
}else if( tn.isInteger() ){
bool inc = false;
//check if it is bound
if( d_owner.getKind()==FORALL && d_qe && d_qe->getBoundedIntegers() ){
if( d_qe->getBoundedIntegers()->isBoundVar( d_owner, d_owner[0][i] ) ){
Trace("bound-int-rsi") << "Rep set iterator: variable #" << i << " is bounded integer." << std::endl;
d_enum_type.push_back( ENUM_RANGE );
}else{
inc = true;
}
}else{
inc = true;
}
if( inc ){
//check if it is otherwise bound
if( d_bounds[0].find(i)!=d_bounds[0].end() && d_bounds[1].find(i)!=d_bounds[1].end() ){
Trace("bound-int-rsi") << "Rep set iterator: variable #" << i << " is bounded." << std::endl;
d_enum_type.push_back( ENUM_RANGE );
}else{
Trace("fmf-incomplete") << "Incomplete because of integer quantification of " << d_owner[0][i] << "." << std::endl;
d_incomplete = true;
}
}
//enumerate if the sort is reasonably small, the upper bound of 1000 is chosen arbitrarily for now
}else if( tn.getCardinality().isFinite() && !tn.getCardinality().isLargeFinite() &&
tn.getCardinality().getFiniteCardinality().toUnsignedInt()<=1000 ){
d_rep_set->complete( tn );
}else{
Trace("fmf-incomplete") << "Incomplete because of quantification of type " << tn << std::endl;
d_incomplete = true;
}
if( d_enum_type.size()<=i ){
d_enum_type.push_back( ENUM_DOMAIN_ELEMENTS );
if( d_rep_set->hasType( tn ) ){
for( size_t j=0; j<d_rep_set->d_type_reps[tn].size(); j++ ){
d_domain[i].push_back( j );
}
}else{
return false;
}
}
}
//must set a variable index order based on bounded integers
if (d_owner.getKind()==FORALL && d_qe && d_qe->getBoundedIntegers()) {
Trace("bound-int-rsi") << "Calculating variable order..." << std::endl;
std::vector< int > varOrder;
for( unsigned i=0; i<d_qe->getBoundedIntegers()->getNumBoundVars(d_owner); i++ ){
varOrder.push_back(d_qe->getBoundedIntegers()->getBoundVarNum(d_owner,i));
}
for( unsigned i=0; i<d_owner[0].getNumChildren(); i++) {
if( !d_qe->getBoundedIntegers()->isBoundVar(d_owner, d_owner[0][i])) {
varOrder.push_back(i);
}
}
Trace("bound-int-rsi") << "Variable order : ";
for( unsigned i=0; i<varOrder.size(); i++) {
Trace("bound-int-rsi") << varOrder[i] << " ";
}
Trace("bound-int-rsi") << std::endl;
std::vector< int > indexOrder;
indexOrder.resize(varOrder.size());
for( unsigned i=0; i<varOrder.size(); i++){
indexOrder[varOrder[i]] = i;
}
Trace("bound-int-rsi") << "Will use index order : ";
for( unsigned i=0; i<indexOrder.size(); i++) {
Trace("bound-int-rsi") << indexOrder[i] << " ";
}
Trace("bound-int-rsi") << std::endl;
setIndexOrder(indexOrder);
}
//now reset the indices
for (unsigned i=0; i<d_index.size(); i++) {
if (!resetIndex(i, true)){
break;
}
}
return true;
}