summaryrefslogtreecommitdiff
path: root/src/prop/minisat
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2021-04-12 22:58:14 +0200
committerGitHub <noreply@github.com>2021-04-12 20:58:14 +0000
commitaf398235ef9f3a909991fddbb71d43434d6cf3a1 (patch)
tree8ae4533255a4bf63c808824f67552b588c301649 /src/prop/minisat
parentc422f03d3169d4dc8d5b333de12be14e9121bc93 (diff)
Refactor resource manager (#6322)
This PR does another round of refactoring of the resource manager and related code. - it moves the Resource enum out of the ResourceManager class - it treats the resources in a generic way (storing the statistics in a vector) instead of the manual treatment we had before - weights no longer live in the options, but in the ResourceManager and are changed accordingly in the ResourceManager constructor - following the generic treatment of resources, it also removes all the resource-specific options --x-step in favor of a generic --rweight name=weight - removed several unused methods from the ResourceManager Note that we handle the Resource enum in a way that allows to easily use other enums as additional resources, for example InferenceId. The general idea is that we will at some point have sensible default weights (so that the cumulative resources somewhat simulate the solver runtime) and users (almost) never need to modify them.
Diffstat (limited to 'src/prop/minisat')
-rw-r--r--src/prop/minisat/core/Solver.cc10
-rw-r--r--src/prop/minisat/core/Solver.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/prop/minisat/core/Solver.cc b/src/prop/minisat/core/Solver.cc
index cd3ae5edf..7a7809eef 100644
--- a/src/prop/minisat/core/Solver.cc
+++ b/src/prop/minisat/core/Solver.cc
@@ -1789,7 +1789,7 @@ lbool Solver::search(int nof_conflicts)
}
if ((nof_conflicts >= 0 && conflictC >= nof_conflicts)
- || !withinBudget(ResourceManager::Resource::SatConflictStep))
+ || !withinBudget(Resource::SatConflictStep))
{
// Reached bound on number of conflicts:
progress_estimate = progressEstimate();
@@ -1934,12 +1934,12 @@ lbool Solver::solve_()
while (status == l_Undef){
double rest_base = luby_restart ? luby(restart_inc, curr_restarts) : pow(restart_inc, curr_restarts);
status = search(rest_base * restart_first);
- if (!withinBudget(ResourceManager::Resource::SatConflictStep))
+ if (!withinBudget(Resource::SatConflictStep))
break; // FIXME add restart option?
curr_restarts++;
}
- if (!withinBudget(ResourceManager::Resource::SatConflictStep))
+ if (!withinBudget(Resource::SatConflictStep))
status = l_Undef;
if (verbosity >= 1)
@@ -2188,7 +2188,7 @@ CRef Solver::updateLemmas() {
Debug("minisat::lemmas") << "Solver::updateLemmas() begin" << std::endl;
// Avoid adding lemmas indefinitely without resource-out
- d_proxy->spendResource(ResourceManager::Resource::LemmaStep);
+ d_proxy->spendResource(Resource::LemmaStep);
CRef conflict = CRef_Undef;
@@ -2370,7 +2370,7 @@ void ClauseAllocator::reloc(CRef& cr,
else if (to[cr].has_extra()) to[cr].calcAbstraction();
}
-inline bool Solver::withinBudget(ResourceManager::Resource r) const
+inline bool Solver::withinBudget(Resource r) const
{
Assert(d_proxy);
// spendResource sets async_interrupt or throws UnsafeInterruptException
diff --git a/src/prop/minisat/core/Solver.h b/src/prop/minisat/core/Solver.h
index 9da0e2f89..534587bf7 100644
--- a/src/prop/minisat/core/Solver.h
+++ b/src/prop/minisat/core/Solver.h
@@ -485,7 +485,7 @@ protected:
double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ...
public:
bool withinBudget (uint64_t amount) const;
- bool withinBudget(ResourceManager::Resource r) const;
+ bool withinBudget(Resource r) const;
protected:
// Static helpers:
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback