This PR fixes two issues that were revealed when analyzing decreased performance on trace-enabled builds.
hasIntegerModel() turns out to be a rather expensive method and should thus not be called in a Trace output.
Furthermore, the implementation of Rational::isIntegral() was generally bad because it used getDenominator() (which returns a copy of the denominator as an Integer) instead of directly checking the underlying denominator with equality for zero.
<< " " << effortLevel
<< " " << d_lastContextIntegerAttempted
<< " " << level
- << " " << hasIntegerModel()
<< endl;
if(d_qflraStatus == Result::UNSAT){ return false; }
Debug("arith") << "integer? "
<< " conf/split " << emmittedConflictOrSplit
- << " fulleffort " << Theory::fullEffort(effortLevel)
- << " hasintmodel " << hasIntegerModel() << endl;
+ << " fulleffort " << Theory::fullEffort(effortLevel) << endl;
if(!emmittedConflictOrSplit && Theory::fullEffort(effortLevel) && !hasIntegerModel()){
Node possibleConflict = Node::null();
}
}
- bool isIntegral() const { return getDenominator() == 1; }
+ bool isIntegral() const { return cln::denominator(d_value) == 1; }
Integer floor() const { return Integer(cln::floor1(d_value)); }
return (*this);
}
- bool isIntegral() const { return getDenominator() == 1; }
+ bool isIntegral() const { return mpz_cmp_ui(d_value.get_den_mpz_t(), 1) == 0; }
/** Returns a string representing the rational in the given base. */
std::string toString(int base = 10) const { return d_value.get_str(base); }