static bool complexityBelow(const DenseMap<Rational>& row, uint32_t cap);
TheoryArithPrivate::TheoryArithPrivate(TheoryArith& containing,
- context::Context* c,
- context::UserContext* u,
- BranchAndBound& bab,
- ProofNodeManager* pnm)
+ Env& env,
+ BranchAndBound& bab)
: d_containing(containing),
+ d_env(env),
d_foundNl(false),
d_rowTracking(),
d_bab(bab),
- d_pnm(pnm),
+ d_pnm(d_env.isTheoryProofProducing() ? d_env.getProofNodeManager()
+ : nullptr),
d_checker(),
- d_pfGen(new EagerProofGenerator(d_pnm, u)),
- d_constraintDatabase(c,
- u,
+ d_pfGen(new EagerProofGenerator(d_pnm, d_env.getUserContext())),
+ d_constraintDatabase(d_env.getContext(),
+ d_env.getUserContext(),
d_partialModel,
d_congruenceManager,
RaiseConflict(*this),
d_qflraStatus(Result::SAT_UNKNOWN),
d_unknownsInARow(0),
d_hasDoneWorkSinceCut(false),
- d_learner(u),
- d_assertionsThatDoNotMatchTheirLiterals(c),
+ d_learner(d_env.getUserContext()),
+ d_assertionsThatDoNotMatchTheirLiterals(d_env.getContext()),
d_nextIntegerCheckVar(0),
- d_constantIntegerVariables(c),
- d_diseqQueue(c, false),
+ d_constantIntegerVariables(d_env.getContext()),
+ d_diseqQueue(d_env.getContext(), false),
d_currentPropagationList(),
- d_learnedBounds(c),
- d_preregisteredNodes(u),
- d_partialModel(c, DeltaComputeCallback(*this)),
+ d_learnedBounds(d_env.getContext()),
+ d_preregisteredNodes(d_env.getUserContext()),
+ d_partialModel(d_env.getContext(), DeltaComputeCallback(*this)),
d_errorSet(
d_partialModel, TableauSizes(&d_tableau), BoundCountingLookup(*this)),
d_tableau(),
d_tableau,
d_rowTracking,
BasicVarModelUpdateCallBack(*this)),
- d_diosolver(c),
+ d_diosolver(d_env.getContext()),
d_restartsCounter(0),
d_tableauSizeHasBeenModified(false),
d_tableauResetDensity(1.6),
d_tableauResetPeriod(10),
- d_conflicts(c),
- d_blackBoxConflict(c, Node::null()),
- d_blackBoxConflictPf(c, std::shared_ptr<ProofNode>(nullptr)),
- d_congruenceManager(c,
- u,
+ d_conflicts(d_env.getContext()),
+ d_blackBoxConflict(d_env.getContext(), Node::null()),
+ d_blackBoxConflictPf(d_env.getContext(),
+ std::shared_ptr<ProofNode>(nullptr)),
+ d_congruenceManager(d_env.getContext(),
+ d_env.getUserContext(),
d_constraintDatabase,
SetupLiteralCallBack(*this),
d_partialModel,
RaiseEqualityEngineConflict(*this),
d_pnm),
- d_cmEnabled(c, options::arithCongMan()),
+ d_cmEnabled(d_env.getContext(), options().arith.arithCongMan),
d_dualSimplex(
d_linEq, d_errorSet, RaiseConflict(*this), TempVarMalloc(*this)),
d_linEq, d_errorSet, RaiseConflict(*this), TempVarMalloc(*this)),
d_pass1SDP(NULL),
d_otherSDP(NULL),
- d_lastContextIntegerAttempted(c, -1),
+ d_lastContextIntegerAttempted(d_env.getContext(), -1),
d_DELTA_ZERO(0),
- d_approxCuts(c),
+ d_approxCuts(d_env.getContext()),
d_fullCheckCounter(0),
- d_cutCount(c, 0),
- d_cutInContext(c),
- d_likelyIntegerInfeasible(c, false),
- d_guessedCoeffSet(c, false),
+ d_cutCount(d_env.getContext(), 0),
+ d_cutInContext(d_env.getContext()),
+ d_likelyIntegerInfeasible(d_env.getContext(), false),
+ d_guessedCoeffSet(d_env.getContext(), false),
d_guessedCoeffs(),
d_treeLog(NULL),
d_replayVariables(),
d_replayConstraints(),
d_lhsTmp(),
d_approxStats(NULL),
- d_attemptSolveIntTurnedOff(u, 0),
+ d_attemptSolveIntTurnedOff(d_env.getUserContext(), 0),
d_dioSolveResources(0),
d_solveIntMaybeHelp(0u),
d_solveIntAttempts(0u),
if(d_dioSolveResources > 0){
d_dioSolveResources--;
if(d_dioSolveResources == 0){
- d_dioSolveResources = -options::rrTurns();
+ d_dioSolveResources = -options().arith.rrTurns;
}
return true;
}else{
d_dioSolveResources++;
if(d_dioSolveResources >= 0){
- d_dioSolveResources = options::dioSolverTurns();
+ d_dioSolveResources = options().arith.dioSolverTurns;
}
return false;
}
// Add the substitution if not recursive
Assert(elim == Rewriter::rewrite(elim));
- if (right.size() > options::ppAssertMaxSubSize())
+ if (right.size() > options().arith.ppAssertMaxSubSize)
{
Debug("simplify")
<< "TheoryArithPrivate::solve(): did not substitute due to the "
if(d_qflraStatus == Result::UNSAT){ return false; }
if(emmmittedLemmaOrSplit){ return false; }
- if(!options::useApprox()){ return false; }
+ if (!options().arith.useApprox)
+ {
+ return false;
+ }
if(!ApproximateSimplex::enabled()){ return false; }
if(Theory::fullEffort(effortLevel)){
}
}
-
- if(!options::trySolveIntStandardEffort()){ return false; }
+ if (!options().arith.trySolveIntStandardEffort)
+ {
+ return false;
+ }
if (d_lastContextIntegerAttempted <= (level >> 2))
{
if(ci->reconstructed() && ci->proven()){
const DenseMap<Rational>& row = ci->getReconstruction().lhs;
- reject = !complexityBelow(row, options::replayRejectCutSize());
+ reject = !complexityBelow(row, options().arith.replayRejectCutSize);
}
}
if(conflictQueueEmpty()){
/* check if the system is feasible under with the cuts */
if(conflictQueueEmpty()){
- Assert(options::replayEarlyCloseDepths() >= 1);
- if(!nl.isBranch() || depth % options::replayEarlyCloseDepths() == 0 ){
+ Assert(options().arith.replayEarlyCloseDepths >= 1);
+ if (!nl.isBranch() || depth % options().arith.replayEarlyCloseDepths == 0)
+ {
TimerStat::CodeTimer codeTimer(d_statistics.d_replaySimplexTimer);
//test for linear feasibility
d_partialModel.stopQueueingBoundCounts();
resolveOutPropagated(res, propagated);
Debug("approx::replayLogRec") << "replayLogRec() ending" << std::endl;
-
- if(options::replayFailureLemma()){
+ if (options().arith.replayFailureLemma)
+ {
// must be done inside the sat context to get things
// propagated at this level
if(res.empty() && nid == getTreeLog().getRootId()){
Assert(cut->proven());
const DenseMap<Rational>& row = cut->getReconstruction().lhs;
- if(!complexityBelow(row, options::lemmaRejectCutSize())){
+ if (!complexityBelow(row, options().arith.lemmaRejectCutSize))
+ {
++(d_statistics.d_cutsRejectedDuringLemmas);
continue;
}
}
// if integers are attempted,
- Assert(options::useApprox());
+ Assert(options().arith.useApprox);
Assert(ApproximateSimplex::enabled());
int level = getSatContext()->getLevel();
approx->setOptCoeffs(d_guessedCoeffs);
}
static const int32_t depthForLikelyInfeasible = 10;
- int maxDepthPass1 = d_likelyIntegerInfeasible ?
- depthForLikelyInfeasible : options::maxApproxDepth();
+ int maxDepthPass1 = d_likelyIntegerInfeasible
+ ? depthForLikelyInfeasible
+ : options().arith.maxApproxDepth;
approx->setBranchingDepth(maxDepthPass1);
approx->setBranchOnVariableLimit(100);
LinResult relaxRes = approx->solveRelaxation();
}
}
if(!(anyConflict() || !d_approxCuts.empty())){
- turnOffApproxFor(options::replayNumericFailurePenalty());
+ turnOffApproxFor(options().arith.replayNumericFailurePenalty);
}
break;
case BranchesExhausted:
SimplexDecisionProcedure& TheoryArithPrivate::selectSimplex(bool pass1){
if(pass1){
if(d_pass1SDP == NULL){
- if(options::useFC()){
+ if (options().arith.useFC)
+ {
d_pass1SDP = (SimplexDecisionProcedure*)(&d_fcSimplex);
- }else if(options::useSOI()){
+ }
+ else if (options().arith.useSOI)
+ {
d_pass1SDP = (SimplexDecisionProcedure*)(&d_soiSimplex);
- }else{
+ }
+ else
+ {
d_pass1SDP = (SimplexDecisionProcedure*)(&d_dualSimplex);
}
}
return *d_pass1SDP;
}else{
if(d_otherSDP == NULL){
- if(options::useFC()){
- d_otherSDP = (SimplexDecisionProcedure*)(&d_fcSimplex);
- }else if(options::useSOI()){
- d_otherSDP = (SimplexDecisionProcedure*)(&d_soiSimplex);
- }else{
- d_otherSDP = (SimplexDecisionProcedure*)(&d_soiSimplex);
- }
+ if (options().arith.useFC)
+ {
+ d_otherSDP = (SimplexDecisionProcedure*)(&d_fcSimplex);
+ }
+ else if (options().arith.useSOI)
+ {
+ d_otherSDP = (SimplexDecisionProcedure*)(&d_soiSimplex);
+ }
+ else
+ {
+ d_otherSDP = (SimplexDecisionProcedure*)(&d_soiSimplex);
+ }
}
Assert(d_otherSDP != NULL);
return *d_otherSDP;
}
if(d_qflraStatus != Result::UNSAT){
- static const int32_t pass2Limit = 20;
- int16_t oldCap = options::arithStandardCheckVarOrderPivots();
+ static const int64_t pass2Limit = 20;
+ int64_t oldCap = options().arith.arithStandardCheckVarOrderPivots;
Options::current().arith.arithStandardCheckVarOrderPivots = pass2Limit;
SimplexDecisionProcedure& simplex = selectSimplex(false);
d_qflraStatus = simplex.findModel(false);
d_partialModel.processBoundsQueue(utcb);
d_linEq.startTrackingBoundCounts();
- bool noPivotLimit = Theory::fullEffort(effortLevel) ||
- !options::restrictedPivots();
+ bool noPivotLimit =
+ Theory::fullEffort(effortLevel) || !options().arith.restrictedPivots;
SimplexDecisionProcedure& simplex = selectSimplex(true);
- bool useApprox = options::useApprox() && ApproximateSimplex::enabled() && getSolveIntegerResource();
+ bool useApprox = options().arith.useApprox && ApproximateSimplex::enabled()
+ && getSolveIntegerResource();
Debug("TheoryArithPrivate::solveRealRelaxation")
- << "solveRealRelaxation() approx"
- << " " << options::useApprox()
- << " " << ApproximateSimplex::enabled()
- << " " << useApprox
- << " " << safeToCallApprox()
- << endl;
+ << "solveRealRelaxation() approx"
+ << " " << options().arith.useApprox << " "
+ << ApproximateSimplex::enabled() << " " << useApprox << " "
+ << safeToCallApprox() << endl;
bool noPivotLimitPass1 = noPivotLimit && !useApprox;
d_qflraStatus = simplex.findModel(noPivotLimitPass1);
if(anyConflict()){
d_qflraStatus = Result::UNSAT;
- if (options::revertArithModels() && d_previousStatus == Result::SAT)
+ if (options().arith.revertArithModels && d_previousStatus == Result::SAT)
{
++d_statistics.d_revertsOnConflicts;
Debug("arith::bt") << "clearing here "
if(Debug.isOn("arith::consistency")){
Assert(entireStateIsConsistent("sat comit"));
}
- if(useSimplex && options::collectPivots()){
- if(options::useFC()){
+ if (useSimplex && options().arith.collectPivots)
+ {
+ if (options().arith.useFC)
+ {
d_statistics.d_satPivots << d_fcSimplex.getPivots();
- }else{
+ }
+ else
+ {
d_statistics.d_satPivots << d_dualSimplex.getPivots();
}
}
d_partialModel.commitAssignmentChanges();
d_statistics.d_maxUnknownsInARow.maxAssign(d_unknownsInARow);
- if(useSimplex && options::collectPivots()){
- if(options::useFC()){
+ if (useSimplex && options().arith.collectPivots)
+ {
+ if (options().arith.useFC)
+ {
d_statistics.d_unknownPivots << d_fcSimplex.getPivots();
- }else{
+ }
+ else
+ {
d_statistics.d_unknownPivots << d_dualSimplex.getPivots();
}
}
emmittedConflictOrSplit = true;
Debug("arith::conflict") << "simplex conflict" << endl;
- if(useSimplex && options::collectPivots()){
- if(options::useFC()){
+ if (useSimplex && options().arith.collectPivots)
+ {
+ if (options().arith.useFC)
+ {
d_statistics.d_unsatPivots << d_fcSimplex.getPivots();
- }else{
+ }
+ else
+ {
d_statistics.d_unsatPivots << d_dualSimplex.getPivots();
}
}
}
d_statistics.d_avgUnknownsInARow << d_unknownsInARow;
- size_t nPivots =
- options::useFC() ? d_fcSimplex.getPivots() : d_dualSimplex.getPivots();
+ size_t nPivots = options().arith.useFC ? d_fcSimplex.getPivots()
+ : d_dualSimplex.getPivots();
for (std::size_t i = 0; i < nPivots; ++i)
{
d_containing.d_out->spendResource(
// This should be fine if sat or unknown
if (!emmittedConflictOrSplit
- && (options::arithPropagationMode()
+ && (options().arith.arithPropagationMode
== options::ArithPropagationMode::UNATE_PROP
- || options::arithPropagationMode()
+ || options().arith.arithPropagationMode
== options::ArithPropagationMode::BOTH_PROP))
{
TimerStat::CodeTimer codeTimer0(d_statistics.d_newPropTime);
if(!emmittedConflictOrSplit && Theory::fullEffort(effortLevel) && !hasIntegerModel()){
Node possibleConflict = Node::null();
- if(!emmittedConflictOrSplit && options::arithDioSolver()){
+ if (!emmittedConflictOrSplit && options().arith.arithDioSolver)
+ {
possibleConflict = callDioSolver();
if(possibleConflict != Node::null()){
revertOutOfConflict();
}
}
- if(!emmittedConflictOrSplit && d_hasDoneWorkSinceCut && options::arithDioSolver()){
+ if (!emmittedConflictOrSplit && d_hasDoneWorkSinceCut
+ && options().arith.arithDioSolver)
+ {
if(getDioCuttingResource()){
TrustNode possibleLemma = dioCutting();
if(!possibleLemma.isNull()){
}
}
- if(options::maxCutsInContext() <= d_cutCount){
+ if (options().arith.maxCutsInContext <= d_cutCount)
+ {
if(d_diosolver.hasMoreDecompositionLemmas()){
while(d_diosolver.hasMoreDecompositionLemmas()){
Node decompositionLemma = d_diosolver.nextDecompositionLemma();
vector<ArithVar> lemmas;
ArithVar max = d_partialModel.getNumberOfVariables();
- if(options::doCutAllBounded() && max > 0){
+ if (options().arith.doCutAllBounded && max > 0)
+ {
for(ArithVar iter = 0; iter != max; ++iter){
//Do not include slack variables
const DeltaRational& d = d_partialModel.getAssignment(iter);
void TheoryArithPrivate::propagate(Theory::Effort e) {
// This uses model values for safety. Disable for now.
if (d_qflraStatus == Result::SAT
- && (options::arithPropagationMode()
+ && (options().arith.arithPropagationMode
== options::ArithPropagationMode::BOUND_INFERENCE_PROP
- || options::arithPropagationMode()
+ || options().arith.arithPropagationMode
== options::ArithPropagationMode::BOTH_PROP)
&& hasAnyUpdates())
{
- if(options::newProp()){
+ if (options().arith.newProp)
+ {
propagateCandidatesNew();
- }else{
+ }
+ else
+ {
propagateCandidates();
}
}
}
vector<TrustNode> lemmas;
- if(!options::incrementalSolving()) {
- switch(options::arithUnateLemmaMode()){
+ if (!options().base.incrementalSolving)
+ {
+ switch (options().arith.arithUnateLemmaMode)
+ {
case options::ArithUnateLemmaMode::NO: break;
case options::ArithUnateLemmaMode::INEQUALITY:
d_constraintDatabase.outputUnateInequalityLemmas(lemmas);
d_constraintDatabase.outputUnateInequalityLemmas(lemmas);
d_constraintDatabase.outputUnateEqualityLemmas(lemmas);
break;
- default: Unhandled() << options::arithUnateLemmaMode();
+ default: Unhandled() << options().arith.arithUnateLemmaMode;
}
}
DenseSet::const_iterator end = d_updatedBounds.end();
for(; i != end; ++i){
ArithVar var = *i;
- if(d_tableau.isBasic(var) &&
- d_tableau.basicRowLength(var) <= options::arithPropagateMaxLength()){
+ if (d_tableau.isBasic(var)
+ && d_tableau.basicRowLength(var)
+ <= options().arith.arithPropagateMaxLength)
+ {
d_candidateBasics.softAdd(var);
- }else{
+ }
+ else
+ {
Tableau::ColIterator basicIter = d_tableau.colIterator(var);
for(; !basicIter.atEnd(); ++basicIter){
const Tableau::Entry& entry = *basicIter;
ArithVar rowVar = d_tableau.rowIndexToBasic(ridx);
Assert(entry.getColVar() == var);
Assert(d_tableau.isBasic(rowVar));
- if(d_tableau.getRowLength(ridx) <= options::arithPropagateMaxLength()){
+ if (d_tableau.getRowLength(ridx)
+ <= options().arith.arithPropagateMaxLength)
+ {
d_candidateBasics.softAdd(rowVar);
}
}
// * coeffs[0] is for implied
// * coeffs[i+1] is for explain[i]
d_linEq.propagateRow(explain, ridx, rowUp, implied, coeffs);
- if(d_tableau.getRowLength(ridx) <= options::arithPropAsLemmaLength()){
+ if (d_tableau.getRowLength(ridx) <= options().arith.arithPropAsLemmaLength)
+ {
if (Debug.isOn("arith::prop::pf")) {
for (const auto & constraint : explain) {
Assert(constraint->hasProof());
{
outputLemma(clause, InferenceId::ARITH_ROW_IMPL);
}
- }else{
+ }
+ else
+ {
Assert(!implied->negationHasProof());
implied->impliedByFarkas(explain, coeffs, false);
implied->tryToPropagate();
Debug("arith::prop")
<< "propagateCandidateRow " << instance << " attempt " << rowLength << " " << hasCount << endl;
- if (rowLength >= options::arithPropagateMaxLength()
+ if (rowLength >= options().arith.arithPropagateMaxLength
&& Random::getRandom().pickWithProb(
- 1.0 - double(options::arithPropagateMaxLength()) / rowLength))
+ 1.0 - double(options().arith.arithPropagateMaxLength) / rowLength))
{
return false;
}