This PR tackles cvc5/cvc5-projects#17 by removing static variables or making them constexpr.
Most static variables are either compile-time constants (we make them static constexpr) or used to count how often a function is called for debug output (we remove these).
{
}
-Integer ApproximateSimplex::s_defaultMaxDenom(1<<26);
-
ApproximateSimplex::ApproximateSimplex(const ArithVariables& v, TreeLog& l,
ApproximateStatistics& s)
: d_vars(v)
d_branchLimit = bl;
}
-const double ApproximateSimplex::SMALL_FIXED_DELTA = .000000001;
-const double ApproximateSimplex::TOLERENCE = 1 + .000000001;
-
bool ApproximateSimplex::roughlyEqual(double a, double b){
if (a == 0){
return -SMALL_FIXED_DELTA <= b && b <= SMALL_FIXED_DELTA;
std::optional<Rational> ApproximateSimplex::estimateWithCFE(double d)
{
- return estimateWithCFE(d, s_defaultMaxDenom);
+ return estimateWithCFE(d, Integer(s_defaultMaxDenom));
}
class ApproxNoOp : public ApproximateSimplex {
//DenseMap<ArithVar> d_rowToArithVar;
DenseMap<ArithVar> d_colToArithVar;
- int d_instanceID;
-
bool d_solvedRelaxation;
bool d_solvedMIP;
d_solvedRelaxation(false),
d_solvedMIP(false)
{
- static int instance = 0;
- ++instance;
- d_instanceID = instance;
d_denomGuesses.push_back(Integer(1<<22));
- d_denomGuesses.push_back(ApproximateSimplex::s_defaultMaxDenom);
+ d_denomGuesses.push_back(Integer(ApproximateSimplex::s_defaultMaxDenom));
d_denomGuesses.push_back(Integer(1ul<<29));
d_denomGuesses.push_back(Integer(1ul<<31));
bool ApproxGLPK::loadVB(int nid, int M, int j, int ri, bool wantUb, VirtualBound& tmp){
if(ri <= 0) { return true; }
- static int instance = 0;
- ++instance;
- Debug("glpk::loadVB") << "loadVB() " << instance << endl;
+ Debug("glpk::loadVB") << "loadVB()" << endl;
ArithVar rowVar = _getArithVar(nid, M, ri);
ArithVar contVar = _getArithVar(nid, M, j);
if(rowVar == ARITHVAR_SENTINEL){
- Debug("glpk::loadVB") << "loadVB() " << instance
+ Debug("glpk::loadVB") << "loadVB()"
<< " rowVar is ARITHVAR_SENTINEL " << rowVar << endl;
return true;
}
if(contVar == ARITHVAR_SENTINEL){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " contVar is ARITHVAR_SENTINEL " << contVar << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " contVar is ARITHVAR_SENTINEL " << contVar
+ << endl;
return true; }
if(!d_vars.isAuxiliary(rowVar)){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " rowVar is not auxilliary " << rowVar << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " rowVar is not auxilliary " << rowVar << endl;
return true;
}
// is integer is correct here
if(d_vars.isInteger(contVar)){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " contVar is integer " << contVar << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " contVar is integer " << contVar << endl;
return true;
}
ConstraintP ub = d_vars.getUpperBoundConstraint(rowVar);
if(lb != NullConstraint && ub != NullConstraint){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " lb and ub are both NULL " << lb << " " << ub << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " lb and ub are both NULL " << lb << " " << ub
+ << endl;
return true;
}
ConstraintP rcon = lb == NullConstraint ? ub : lb;
if(rcon == NullConstraint) {
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " rcon is NULL " << rcon << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " rcon is NULL " << rcon << endl;
return true;
}
if(!rcon->getValue().isZero()){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " rcon value is not 0 " << rcon->getValue() << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " rcon value is not 0 " << rcon->getValue()
+ << endl;
return true;
}
if(!d_vars.hasNode(rowVar)){
- Debug("glpk::loadVB") << "loadVB() " << instance
+ Debug("glpk::loadVB") << "loadVB()"
<< " does not have node " << rowVar << endl;
return true;
}
Polynomial p = Polynomial::parsePolynomial(d_vars.asNode(rowVar));
- if(p.size() != 2) {
- Debug("glpk::loadVB") << "loadVB() " << instance << " polynomial is not binary: " << p.getNode() << endl;
+ if (p.size() != 2)
+ {
+ Debug("glpk::loadVB") << "loadVB()"
+ << " polynomial is not binary: " << p.getNode()
+ << endl;
return true;
}
Node nx2 = second.getVarList().getNode();
if(!d_vars.hasArithVar(nx1)) {
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " does not have a variable for nx1: " << nx1 << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " does not have a variable for nx1: " << nx1
+ << endl;
return true;
}
if(!d_vars.hasArithVar(nx2)) {
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " does not have a variable for nx2 " << nx2 << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " does not have a variable for nx2 " << nx2
+ << endl;
return true;
}
ArithVar x1 = d_vars.asArithVar(nx1), x2 = d_vars.asArithVar(nx2);
<< " c2 " << ic << endl;
if(!d_vars.isIntegerInput(iv)){
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " iv is not an integer input variable " << iv << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " iv is not an integer input variable " << iv
+ << endl;
return true;
}
// cc * cv + ic * iv <= 0 or
Debug("glpk::loadVB") << d << " " << cc.sgn() << endl;
bool nowUb = cc.sgn() < 0;
if(wantUb != nowUb) {
- Debug("glpk::loadVB") << "loadVB() " << instance
- << " wantUb is not nowUb " << wantUb << " " << nowUb << endl;
-
+ Debug("glpk::loadVB") << "loadVB()"
+ << " wantUb is not nowUb " << wantUb << " " << nowUb
+ << endl;
+
return true;
}
Kind rel = wantUb ? kind::LEQ : kind::GEQ;
tmp = VirtualBound(contVar, rel, d, iv, rcon);
- Debug("glpk::loadVB") << "loadVB() " << instance << " was successful" << endl;
+ Debug("glpk::loadVB") << "loadVB()"
+ << " was successful" << endl;
return false;
}
/** UTILITIES FOR DEALING WITH ESTIMATES */
- static const double SMALL_FIXED_DELTA;
- static const double TOLERENCE;
+ static constexpr double SMALL_FIXED_DELTA = .000000001;
+ static constexpr double TOLERENCE = 1 + .000000001;
/** Returns true if two doubles are roughly equal based on TOLERENCE and SMALL_FIXED_DELTA.*/
static bool roughlyEqual(double a, double b);
int d_maxDepth;
/* Default denominator for diophatine approximation, 2^{26} .*/
- static Integer s_defaultMaxDenom;
+ static constexpr uint64_t s_defaultMaxDenom = (1 << 26);
};/* class ApproximateSimplex */
} // namespace arith
d_errorSet.reduceToSignals();
d_errorSet.setSelectionRule(options::ErrorSelectionRule::VAR_ORDER);
- static int instance = 0;
- ++instance;
-
if(processSignals()){
- Debug("arith::findModel") << "attemptSolution("<< instance <<") early conflict" << endl;
+ Debug("arith::findModel") << "attemptSolution() early conflict" << endl;
d_conflictVariables.purge();
return Result::UNSAT;
}else if(d_errorSet.errorEmpty()){
- Debug("arith::findModel") << "attemptSolution("<< instance <<") fixed itself" << endl;
+ Debug("arith::findModel") << "attemptSolution() fixed itself" << endl;
return Result::SAT;
}
typedef std::unordered_map<Node, ConstraintP> NodetoConstraintMap;
typedef size_t ConstraintRuleID;
-static const ConstraintRuleID ConstraintRuleIdSentinel = std::numeric_limits<ConstraintRuleID>::max();
+static constexpr ConstraintRuleID ConstraintRuleIdSentinel =
+ std::numeric_limits<ConstraintRuleID>::max();
typedef size_t AntecedentId;
-static const AntecedentId AntecedentIdSentinel = std::numeric_limits<AntecedentId>::max();
-
+static constexpr AntecedentId AntecedentIdSentinel =
+ std::numeric_limits<AntecedentId>::max();
typedef size_t AssertionOrder;
-static const AssertionOrder AssertionOrderSentinel = std::numeric_limits<AssertionOrder>::max();
-
+static constexpr AssertionOrder AssertionOrderSentinel =
+ std::numeric_limits<AssertionOrder>::max();
/**
* A ValueCollection binds together convex constraints that have the same
typedef Constraint* ConstraintP;
typedef const Constraint* ConstraintCP;
-static const ConstraintP NullConstraint = NULL;
+static constexpr ConstraintP NullConstraint = nullptr;
class ConstraintDatabase;
typedef std::vector<Rational> RationalVector;
typedef RationalVector* RationalVectorP;
typedef const RationalVector* RationalVectorCP;
-static const RationalVectorCP RationalVectorCPSentinel = NULL;
-static const RationalVectorP RationalVectorPSentinel = NULL;
+static constexpr RationalVectorCP RationalVectorCPSentinel = nullptr;
+static constexpr RationalVectorP RationalVectorPSentinel = nullptr;
} // namespace arith
} // namespace theory
* the maximum input constraints length than 2**MAX_GROWTH_RATE.
*/
context::CDO<uint32_t> d_maxInputCoefficientLength;
- static const uint32_t MAX_GROWTH_RATE = 3;
+ static constexpr uint32_t MAX_GROWTH_RATE = 3;
/** Returns true if the element on the trail should be dropped.*/
bool anyCoefficientExceedsMaximum(TrailIndex j) const;
Result::Sat DualSimplexDecisionProcedure::dualFindModel(bool exactResult){
Assert(d_conflictVariables.empty());
- static thread_local unsigned int instance = 0;
- instance = instance + 1;
d_pivots = 0;
if(d_errorSet.errorEmpty() && !d_errorSet.moreSignals()){
- Debug("arith::findModel") << "dualFindModel("<< instance <<") trivial" << endl;
+ Debug("arith::findModel") << "dualFindModel() trivial" << endl;
return Result::SAT;
}
if(processSignals()){
d_conflictVariables.purge();
- Debug("arith::findModel") << "dualFindModel("<< instance <<") early conflict" << endl;
+ Debug("arith::findModel") << "dualFindModel() early conflict" << endl;
return Result::UNSAT;
}else if(d_errorSet.errorEmpty()){
- Debug("arith::findModel") << "dualFindModel("<< instance <<") fixed itself" << endl;
+ Debug("arith::findModel") << "dualFindModel() fixed itself" << endl;
Assert(!d_errorSet.moreSignals());
return Result::SAT;
}
- Debug("arith::findModel") << "dualFindModel(" << instance <<") start non-trivial" << endl;
+ Debug("arith::findModel") << "dualFindModel() start non-trivial" << endl;
Result::Sat result = Result::SAT_UNKNOWN;
// ensure that the conflict variable is still in the queue.
d_conflictVariables.purge();
- Debug("arith::findModel") << "end findModel() " << instance << " " << result << endl;
+ Debug("arith::findModel") << "end findModel() " << result << endl;
return result;
}
}
void ErrorSet::debugPrint(std::ostream& out) const {
- static int instance = 0;
- ++instance;
- out << "error set debugprint " << instance << endl;
+ out << "error set debugprint" << endl;
for(error_iterator i = errorBegin(), i_end = errorEnd();
i != i_end; ++i){
ArithVar e = *i;
Assert(d_sgnDisagreements.empty());
d_pivots = 0;
- static thread_local unsigned int instance = 0;
- instance = instance + 1;
if(d_errorSet.errorEmpty() && !d_errorSet.moreSignals()){
- Debug("arith::findModel") << "fcFindModel("<< instance <<") trivial" << endl;
+ Debug("arith::findModel") << "fcFindModel() trivial" << endl;
Assert(d_conflictVariables.empty());
return Result::SAT;
}
if(initialProcessSignals()){
d_conflictVariables.purge();
- Debug("arith::findModel") << "fcFindModel("<< instance <<") early conflict" << endl;
+ Debug("arith::findModel") << "fcFindModel() early conflict" << endl;
Assert(d_conflictVariables.empty());
return Result::UNSAT;
}else if(d_errorSet.errorEmpty()){
- Debug("arith::findModel") << "fcFindModel("<< instance <<") fixed itself" << endl;
+ Debug("arith::findModel") << "fcFindModel() fixed itself" << endl;
Assert(d_conflictVariables.empty());
return Result::SAT;
}
- Debug("arith::findModel") << "fcFindModel(" << instance <<") start non-trivial" << endl;
+ Debug("arith::findModel") << "fcFindModel() start non-trivial" << endl;
exactResult |= d_varOrderPivotLimit < 0;
// ensure that the conflict variable is still in the queue.
d_conflictVariables.purge();
- Debug("arith::findModel") << "end findModel() " << instance << " " << result << endl;
+ Debug("arith::findModel") << "end findModel() " << result << endl;
Assert(d_conflictVariables.empty());
return result;
UpdateInfo FCSimplexDecisionProcedure::selectPrimalUpdate(ArithVar basic, LinearEqualityModule::UpdatePreferenceFunction upf, LinearEqualityModule::VarPreferenceFunction bpf) {
UpdateInfo selected;
- static int instance = 0 ;
- ++instance;
-
Debug("arith::selectPrimalUpdate")
- << "selectPrimalUpdate " << instance << endl
- << basic << " " << d_tableau.basicRowLength(basic)
- << " " << d_linEq.debugBasicAtBoundCount(basic) << endl;
+ << "selectPrimalUpdate" << endl
+ << basic << " " << d_tableau.basicRowLength(basic) << " "
+ << d_linEq.debugBasicAtBoundCount(basic) << endl;
- static const int s_maxCandidatesAfterImprove = 3;
+ static constexpr int s_maxCandidatesAfterImprove = 3;
bool isFocus = basic == d_focusErrorVar;
Assert(isFocus || d_errorSet.inError(basic));
int basicDir = isFocus? 1 : d_errorSet.getSgn(basic);
return w;
}
-bool FCSimplexDecisionProcedure::debugDualLike(WitnessImprovement w, ostream& out, int instance, uint32_t prevFocusSize, uint32_t prevErrorSize ) const{
- out << "DLV("<<instance<<") ";
+bool FCSimplexDecisionProcedure::debugDualLike(WitnessImprovement w,
+ ostream& out,
+ uint32_t prevFocusSize,
+ uint32_t prevErrorSize) const
+{
+ out << "DLV() ";
switch(w){
case ConflictFound:
out << "found conflict" << endl;
}
Result::Sat FCSimplexDecisionProcedure::dualLike(){
- static int instance = 0;
TimerStat::CodeTimer codeTimer(d_statistics.d_fcTimer);
while(d_pivotBudget != 0 && d_errorSize > 0 && d_conflictVariables.empty()){
- ++instance;
- Debug("dualLike") << "dualLike " << instance << endl;
+ Debug("dualLike") << "dualLike " << endl;
Assert(d_errorSet.noSignals());
// - focus went down
Assert(d_focusSize > 1);
ArithVar e = d_errorSet.topFocusVariable();
- static const unsigned s_sumMetricThreshold = 1;
+ static constexpr unsigned s_sumMetricThreshold = 1;
if(d_errorSet.sumMetric(e) <= s_sumMetricThreshold){
Debug("dualLike") << "dualLikeImproveError " << e << endl;
w = dualLikeImproveError(e);
Assert(d_focusSize == d_errorSet.focusSize());
Assert(d_errorSize == d_errorSet.errorSize());
- Assert(debugDualLike(
- w, Debug("dualLike"), instance, prevFocusSize, prevErrorSize));
+ Assert(debugDualLike(w, Debug("dualLike"), prevFocusSize, prevErrorSize));
Debug("dualLike") << "Focus size " << d_focusSize << " (was " << prevFocusSize << ")" << endl;
Debug("dualLike") << "Error size " << d_errorSize << " (was " << prevErrorSize << ")" << endl;
}
Result::Sat dualLike();
private:
- static const uint32_t PENALTY = 4;
- DenseMultiset d_scores;
- void decreasePenalties(){ d_scores.removeOneOfEverything(); }
- uint32_t penalty(ArithVar x) const { return d_scores.count(x); }
- void setPenalty(ArithVar x, WitnessImprovement w){
- if(improvement(w)){
- if(d_scores.count(x) > 0){
- d_scores.removeAll(x);
- }
- }else{
- d_scores.setCount(x, PENALTY);
- }
- }
+ static constexpr uint32_t PENALTY = 4;
+ DenseMultiset d_scores;
+ void decreasePenalties() { d_scores.removeOneOfEverything(); }
+ uint32_t penalty(ArithVar x) const { return d_scores.count(x); }
+ void setPenalty(ArithVar x, WitnessImprovement w)
+ {
+ if (improvement(w))
+ {
+ if (d_scores.count(x) > 0)
+ {
+ d_scores.removeAll(x);
+ }
+ }
+ else
+ {
+ d_scores.setCount(x, PENALTY);
+ }
+ }
/** The size of the focus set. */
uint32_t d_focusSize;
const Rational& focusCoefficient(ArithVar nb) const;
int32_t d_pivotBudget;
- // enum PivotImprovement {
- // ErrorDropped,
- // NonDegenerate,
- // HeuristicDegenerate,
- // BlandsDegenerate
- // };
WitnessImprovement d_prevWitnessImprovement;
uint32_t d_witnessImprovementInARow;
uint32_t degeneratePivotsInARow() const;
- static const uint32_t s_focusThreshold = 6;
- static const uint32_t s_maxDegeneratePivotsBeforeBlandsOnLeaving = 100;
- static const uint32_t s_maxDegeneratePivotsBeforeBlandsOnEntering = 10;
+ static constexpr uint32_t s_focusThreshold = 6;
+ static constexpr uint32_t s_maxDegeneratePivotsBeforeBlandsOnLeaving = 100;
+ static constexpr uint32_t s_maxDegeneratePivotsBeforeBlandsOnEntering = 10;
DenseMap<uint32_t> d_leavingCountSinceImprovement;
void increaseLeavingCount(ArithVar x){
}
bool debugDualLike(WitnessImprovement w, std::ostream& out,
- int instance,
uint32_t prevFocusSize, uint32_t prevErrorSize) const;
void debugPrintSignal(ArithVar updated) const;
ArithVarVec d_sgnDisagreements;
- //static PivotImprovement pivotImprovement(const UpdateInfo& selected, bool useBlands = false);
-
void logPivot(WitnessImprovement w);
void updateAndSignal(const UpdateInfo& selected, WitnessImprovement w);
TimerStat::CodeTimer codeTimer(d_statistics.d_pivotTime);
- static int instance = 0;
-
if(Debug.isOn("arith::tracking::pre")){
- ++instance;
- Debug("arith::tracking") << "pre update #" << instance << endl;
+ Debug("arith::tracking") << "pre update" << endl;
debugCheckTracking();
}
updateTracked(x_j, x_j_value);
if(Debug.isOn("arith::tracking::mid")){
- Debug("arith::tracking") << "postupdate prepivot #" << instance << endl;
+ Debug("arith::tracking") << "postupdate prepivot" << endl;
debugCheckTracking();
}
d_tableau.pivot(x_i, x_j, d_trackCallback);
if(Debug.isOn("arith::tracking::post")){
- Debug("arith::tracking") << "postpivot #" << instance << endl;
+ Debug("arith::tracking") << "postpivot" << endl;
debugCheckTracking();
}
int focusCoeffSgn = focusCoeff.sgn();
- static int instance = 0;
- ++instance;
- Debug("speculativeUpdate") << "speculativeUpdate " << instance << endl;
+ Debug("speculativeUpdate") << "speculativeUpdate" << endl;
Debug("speculativeUpdate") << "nb " << nb << endl;
Debug("speculativeUpdate") << "focusCoeff " << focusCoeff << endl;
struct LazardEvaluationState
{
CoCoA::GlobalManager d_gm;
- static std::unique_ptr<LazardEvaluationStats> d_stats;
+
+ /**
+ * Statistics about the lazard evaluation.
+ * Although this class is short-lived, there is no need to make the statistics
+ * static or store them persistently: this is handled by the statistics
+ * registry, which recovers statistics from their name.
+ * This member is mutable to allow collecting statistics from const methods.
+ */
+ mutable LazardEvaluationStats d_stats;
/**
* Maps libpoly variables to indets in J0. Used when constructing the input
*/
std::vector<std::optional<CoCoA::RingElem>> d_direct;
- LazardEvaluationState()
- {
- if (!d_stats)
- {
- d_stats = std::make_unique<LazardEvaluationStats>();
- }
- }
-
/**
* Converts a libpoly integer to a CoCoA::BigInt.
*/
*/
std::vector<poly::Polynomial> reduce(const poly::Polynomial& qpoly) const
{
- d_stats->d_evaluations++;
+ d_stats.d_evaluations++;
std::vector<poly::Polynomial> res;
Trace("cad::lazard") << "Reducing " << qpoly << std::endl;
auto input = convertQ(qpoly);
while (CoCoA::IsZero(hom(q)))
{
q = q / (var - indets[0]);
- d_stats->d_reductions++;
+ d_stats.d_reductions++;
}
// substitute x_i -> a_i
q = hom(q);
while (CoCoA::IsDivisible(q, tmp))
{
q /= tmp;
- d_stats->d_reductions++;
+ d_stats.d_reductions++;
}
}
q = d_qhom[i](q);
os << "Done" << std::endl;
return os;
}
-std::unique_ptr<LazardEvaluationStats> LazardEvaluationState::d_stats;
LazardEvaluation::LazardEvaluation()
: d_state(std::make_unique<LazardEvaluationState>())
{
d_state->addKRational(var,
CoCoA::RingElem(d_state->d_K.back(), *rational));
- d_state->d_stats->d_directAssignments++;
+ d_state->d_stats.d_directAssignments++;
return;
}
Trace("cad::lazard") << "Got mipo " << polymipo << std::endl;
Trace("cad::lazard") << "Using linear factor " << f << " -> " << var
<< " = " << rat << std::endl;
d_state->addKRational(var, rat);
- d_state->d_stats->d_directAssignments++;
+ d_state->d_stats.d_directAssignments++;
}
else
{
Trace("cad::lazard") << "Using nonlinear factor " << f << std::endl;
d_state->addK(var, f);
- d_state->d_stats->d_ranAssignments++;
+ d_state->d_stats.d_ranAssignments++;
}
used_factor = true;
break;
Assert(d_sgnDisagreements.empty());
d_pivots = 0;
- static thread_local unsigned int instance = 0;
- instance = instance + 1;
if(d_errorSet.errorEmpty() && !d_errorSet.moreSignals()){
- Debug("soi::findModel") << "soiFindModel("<< instance <<") trivial" << endl;
+ Debug("soi::findModel") << "soiFindModel() trivial" << endl;
Assert(d_conflictVariables.empty());
return Result::SAT;
}
if(initialProcessSignals()){
d_conflictVariables.purge();
- Debug("soi::findModel") << "fcFindModel("<< instance <<") early conflict" << endl;
+ Debug("soi::findModel") << "fcFindModel() early conflict" << endl;
Assert(d_conflictVariables.empty());
return Result::UNSAT;
}else if(d_errorSet.errorEmpty()){
- Debug("soi::findModel") << "fcFindModel("<< instance <<") fixed itself" << endl;
+ Debug("soi::findModel") << "fcFindModel() fixed itself" << endl;
Assert(!d_errorSet.moreSignals());
Assert(d_conflictVariables.empty());
return Result::SAT;
}
- Debug("soi::findModel") << "fcFindModel(" << instance <<") start non-trivial" << endl;
+ Debug("soi::findModel") << "fcFindModel() start non-trivial" << endl;
exactResult |= d_varOrderPivotLimit < 0;
// ensure that the conflict variable is still in the queue.
d_conflictVariables.purge();
- Debug("soi::findModel") << "end findModel() " << instance << " " << result << endl;
+ Debug("soi::findModel") << "end findModel() " << result << endl;
Assert(d_conflictVariables.empty());
return result;
UpdateInfo SumOfInfeasibilitiesSPD::selectUpdate(LinearEqualityModule::UpdatePreferenceFunction upf, LinearEqualityModule::VarPreferenceFunction bpf) {
UpdateInfo selected;
- static int instance = 0 ;
- ++instance;
-
Debug("soi::selectPrimalUpdate")
- << "selectPrimalUpdate " << instance << endl
- << d_soiVar << " " << d_tableau.basicRowLength(d_soiVar)
- << " " << d_linEq.debugBasicAtBoundCount(d_soiVar) << endl;
+ << "selectPrimalUpdate " << endl
+ << d_soiVar << " " << d_tableau.basicRowLength(d_soiVar) << " "
+ << d_linEq.debugBasicAtBoundCount(d_soiVar) << endl;
typedef std::vector<Cand> CandVector;
CandVector candidates;
WitnessImprovement SumOfInfeasibilitiesSPD::SOIConflict(){
- static int instance = 0;
- instance++;
-
Debug("arith::SOIConflict") << "SumOfInfeasibilitiesSPD::SOIConflict() start "
- << instance << ": |E| = " << d_errorSize << endl;
+ << ": |E| = " << d_errorSize << endl;
if(Debug.isOn("arith::SOIConflict")){
d_errorSet.debugPrint(cout);
}
//reportConflict(conf); do not do this. We need a custom explanations!
d_conflictVariables.add(d_soiVar);
- Debug("arith::SOIConflict") << "SumOfInfeasibilitiesSPD::SOIConflict() done "
- << instance << "end" << endl;
+ Debug("arith::SOIConflict")
+ << "SumOfInfeasibilitiesSPD::SOIConflict() end" << endl;
return ConflictFound;
}
}
}
-bool SumOfInfeasibilitiesSPD::debugSOI(WitnessImprovement w, ostream& out, int instance) const{
- return true;
- // out << "DLV("<<instance<<") ";
- // switch(w){
- // case ConflictFound:
- // out << "found conflict" << endl;
- // return !d_conflictVariables.empty();
- // case ErrorDropped:
- // return false;
- // // out << "dropped " << prevErrorSize - d_errorSize << endl;
- // // return d_errorSize < prevErrorSize;
- // case FocusImproved:
- // out << "focus improved"<< endl;
- // return d_errorSize == prevErrorSize;
- // case FocusShrank:
- // Unreachable();
- // return false;
- // case BlandsDegenerate:
- // out << "bland degenerate"<< endl;
- // return true;
- // case HeuristicDegenerate:
- // out << "heuristic degenerate"<< endl;
- // return true;
- // case AntiProductive:
- // case Degenerate:
- // return false;
- // }
- // return false;
-}
-
Result::Sat SumOfInfeasibilitiesSPD::sumOfInfeasibilities(){
- static int instance = 0;
-
TimerStat::CodeTimer codeTimer(d_statistics.d_soiTimer);
Assert(d_sgnDisagreements.empty());
while(d_pivotBudget != 0 && d_errorSize > 0 && d_conflictVariables.empty()){
- ++instance;
- Debug("dualLike") << "dualLike " << instance << endl;
+ Debug("dualLike") << "dualLike" << endl;
Assert(d_errorSet.noSignals());
// Possible outcomes:
Debug("dualLike") << "selectFocusImproving -> " << w << endl;
Assert(d_errorSize == d_errorSet.errorSize());
-
- Assert(debugSOI(w, Debug("dualLike"), instance));
}
// - satisfied error set
Result::Sat sumOfInfeasibilities();
- // static const uint32_t PENALTY = 4;
- // DenseMultiset d_scores;
- // void decreasePenalties(){ d_scores.removeOneOfEverything(); }
- // uint32_t penalty(ArithVar x) const { return d_scores.count(x); }
- // void setPenalty(ArithVar x, WitnessImprovement w){
- // if(improvement(w)){
- // if(d_scores.count(x) > 0){
- // d_scores.removeAll(x);
- // }
- // }else{
- // d_scores.setCount(x, PENALTY);
- // }
- // }
-
int32_t d_pivotBudget;
- // enum PivotImprovement {
- // ErrorDropped,
- // NonDegenerate,
- // HeuristicDegenerate,
- // BlandsDegenerate
- // };
WitnessImprovement d_prevWitnessImprovement;
uint32_t d_witnessImprovementInARow;
uint32_t degeneratePivotsInARow() const;
- static const uint32_t s_focusThreshold = 6;
- static const uint32_t s_maxDegeneratePivotsBeforeBlandsOnLeaving = 100;
- static const uint32_t s_maxDegeneratePivotsBeforeBlandsOnEntering = 10;
+ static constexpr uint32_t s_focusThreshold = 6;
+ static constexpr uint32_t s_maxDegeneratePivotsBeforeBlandsOnLeaving = 100;
+ static constexpr uint32_t s_maxDegeneratePivotsBeforeBlandsOnEntering = 10;
DenseMap<uint32_t> d_leavingCountSinceImprovement;
void increaseLeavingCount(ArithVar x){
}
}
- bool debugSOI(WitnessImprovement w, std::ostream& out, int instance) const;
-
void debugPrintSignal(ArithVar updated) const;
ArithVarVec d_sgnDisagreements;
void TheoryArithPrivate::outputConflicts(){
Debug("arith::conflict") << "outputting conflicts" << std::endl;
Assert(anyConflict());
- static unsigned int conflicts = 0;
if(!conflictQueueEmpty()){
Assert(!d_conflicts.empty());
TrustNode trustedConflict = confConstraint->externalExplainConflict();
Node conflict = trustedConflict.getNode();
- ++conflicts;
Debug("arith::conflict")
<< "d_conflicts[" << i << "] " << conflict
<< " has proof: " << hasProof << ", id = " << conf.second << endl;
}
if(!d_blackBoxConflict.get().isNull()){
Node bb = d_blackBoxConflict.get();
- ++conflicts;
Debug("arith::conflict") << "black box conflict" << bb
- //<< "("<<conflicts<<")"
<< endl;
if(Debug.isOn("arith::normalize::external")){
bb = flattenAndSort(bb);
int level = context()->getLevel();
d_lastContextIntegerAttempted = level;
-
- static const int32_t mipLimit = 200000;
+ static constexpr int32_t mipLimit = 200000;
TreeLog& tl = getTreeLog();
ApproximateStatistics& stats = getApproxStats();
if(!d_guessedCoeffs.empty()){
approx->setOptCoeffs(d_guessedCoeffs);
}
- static const int32_t depthForLikelyInfeasible = 10;
+ static constexpr int32_t depthForLikelyInfeasible = 10;
int maxDepthPass1 = d_likelyIntegerInfeasible
? depthForLikelyInfeasible
: options().arith.maxApproxDepth;
}
if(d_qflraStatus != Result::UNSAT){
- static const int64_t pass2Limit = 20;
+ static constexpr int64_t pass2Limit = 20;
SimplexDecisionProcedure& simplex = selectSimplex(false);
simplex.setVarOrderPivotLimit(pass2Limit);
d_qflraStatus = simplex.findModel(false);
if(d_qflraStatus == Result::SAT_UNKNOWN && useApprox && safeToCallApprox()){
// pass2: fancy-final
- static const int32_t relaxationLimit = 10000;
+ static constexpr int32_t relaxationLimit = 10000;
Assert(ApproximateSimplex::enabled());
TreeLog& tl = getTreeLog();
if(Debug.isOn("paranoid:check_tableau")){ d_linEq.debugCheckTableau(); }
- static thread_local unsigned callCount = 0;
if(Debug.isOn("arith::presolve")) {
- Debug("arith::presolve") << "TheoryArithPrivate::presolve #" << callCount << endl;
- callCount = callCount + 1;
+ Debug("arith::presolve") << "TheoryArithPrivate::presolve" << endl;
}
vector<TrustNode> lemmas;
uint32_t rowLength = d_tableau.getRowLength(ridx);
bool success = false;
- static int instance = 0;
- ++instance;
- Debug("arith::prop")
- << "propagateCandidateRow " << instance << " attempt " << rowLength << " " << hasCount << endl;
+ Debug("arith::prop") << "propagateCandidateRow attempt " << rowLength << " "
+ << hasCount << endl;
if (rowLength >= options().arith.arithPropagateMaxLength
&& Random::getRandom().pickWithProb(
class TheoryArithPrivate : protected EnvObj
{
private:
- static const uint32_t RESET_START = 2;
+ static constexpr uint32_t RESET_START = 2;
TheoryArith& d_containing;
bool d_tableauSizeHasBeenModified;
double d_tableauResetDensity;
uint32_t d_tableauResetPeriod;
- static const uint32_t s_TABLEAU_RESET_INCREMENT = 5;
-
+ static constexpr uint32_t s_TABLEAU_RESET_INCREMENT = 5;
/** This is only used by simplex at the moment. */
context::CDList<std::pair<ConstraintCP, InferenceId>> d_conflicts;