A VSIDS heuristic supporting additional domain knowledge. More...
#include <heuristics.h>
Classes | |
struct | CmpSymbol |
struct | DomAction |
struct | DomEntry |
class | DomMinimize |
struct | DomPrio |
struct | Frame |
Public Types | |
typedef ClaspVsids_t< DomScore > | BaseType |
enum | GlobalModifier { gmod_level = 1, gmod_spos = 2, gmod_true = 3, gmod_sneg = 4, gmod_false = 5, gmod_max_value } |
enum | GlobalPreference { gpref_atom = 1, gpref_scc = 2, gpref_hcc = 4, gpref_disj = 8, gpref_min = 16, gpref_show = 32 } |
Public Member Functions | |
DomainHeuristic (double d=0.95, const HeuParams ¶ms=HeuParams()) | |
virtual void | startInit (const Solver &s) |
~DomainHeuristic () | |
Protected Member Functions | |
virtual Constraint * | cloneAttach (Solver &) |
Returns a clone of this and adds necessary watches to the given solver. | |
void | detach () |
virtual Literal | doSelect (Solver &s) |
Implements the actual selection process. | |
virtual void | initScores (Solver &s, bool moms) |
virtual PropResult | propagate (Solver &, Literal, uint32 &) |
virtual void | reason (Solver &, Literal, LitVec &) |
virtual void | undoLevel (Solver &s) |
Called when the solver undid a decision level watched by this constraint. | |
Private Types | |
typedef PodVector< DomAction > ::type | ActionVec |
typedef PodVector< Frame >::type | FrameVec |
typedef PodVector< DomPrio >::type | PrioVec |
typedef PodVector< SymbolType > ::type | SymbolMap |
typedef SymbolTable::symbol_type | SymbolType |
Private Member Functions | |
void | addAction (Solver &s, const SymbolType &pre, const DomEntry &e) |
void | addAction (Solver &s, Literal x, uint32 modf, int16 levVal) |
void | applyAction (Solver &s, DomAction &act, uint16 &oldPrio) |
void | endInit (const DomEntry &e, const DomPrio &prio) |
void | pushUndo (Solver &s, uint32 actionId) |
Static Private Member Functions | |
static bool | match (const char *&in, const char *match) |
static bool | matchDom (const char *&in, std::string &out) |
static bool | matchInt (const char *&in, int &out) |
Private Attributes | |
ActionVec | actions_ |
PrioVec | dPrios_ |
FrameVec | frames_ |
LitVec * | minLits_ |
Solver * | solver_ |
Static Private Attributes | |
static const char *const | domEnd_s = "_heuristic)" |
static const char *const | domKey_s = "_heuristic(" |
A VSIDS heuristic supporting additional domain knowledge.
Definition at line 335 of file heuristics.h.
typedef PodVector<DomAction>::type Clasp::DomainHeuristic::ActionVec [private] |
Definition at line 396 of file heuristics.h.
Definition at line 338 of file heuristics.h.
typedef PodVector<Frame>::type Clasp::DomainHeuristic::FrameVec [private] |
Definition at line 398 of file heuristics.h.
typedef PodVector<DomPrio>::type Clasp::DomainHeuristic::PrioVec [private] |
Definition at line 397 of file heuristics.h.
typedef PodVector<SymbolType>::type Clasp::DomainHeuristic::SymbolMap [private] |
Definition at line 359 of file heuristics.h.
typedef SymbolTable::symbol_type Clasp::DomainHeuristic::SymbolType [private] |
Definition at line 358 of file heuristics.h.
Definition at line 340 of file heuristics.h.
Definition at line 339 of file heuristics.h.
Clasp::DomainHeuristic::DomainHeuristic | ( | double | d = 0.95 , |
const HeuParams & | params = HeuParams() |
||
) | [explicit] |
Definition at line 701 of file heuristics.cpp.
Definition at line 704 of file heuristics.cpp.
void Clasp::DomainHeuristic::addAction | ( | Solver & | s, |
const SymbolType & | pre, | ||
const DomEntry & | e | ||
) | [private] |
Definition at line 840 of file heuristics.cpp.
void Clasp::DomainHeuristic::addAction | ( | Solver & | s, |
Literal | x, | ||
uint32 | modf, | ||
int16 | levVal | ||
) | [private] |
Definition at line 857 of file heuristics.cpp.
void Clasp::DomainHeuristic::applyAction | ( | Solver & | s, |
DomAction & | act, | ||
uint16 & | oldPrio | ||
) | [private] |
Definition at line 891 of file heuristics.cpp.
virtual Constraint* Clasp::DomainHeuristic::cloneAttach | ( | Solver & | other | ) | [inline, protected, virtual] |
Returns a clone of this and adds necessary watches to the given solver.
The function shall create and return a copy of this constraint to be used in the given solver. Furthermore, it shall add necessary watches to the given solver.
Implements Clasp::Constraint.
Definition at line 350 of file heuristics.h.
void Clasp::DomainHeuristic::detach | ( | ) | [protected] |
Definition at line 707 of file heuristics.cpp.
Literal Clasp::DomainHeuristic::doSelect | ( | Solver & | ) | [protected, virtual] |
Implements the actual selection process.
Reimplemented from Clasp::ClaspVsids_t< DomScore >.
Definition at line 872 of file heuristics.cpp.
void Clasp::DomainHeuristic::endInit | ( | const DomEntry & | e, |
const DomPrio & | prio | ||
) | [inline, private] |
Definition at line 406 of file heuristics.h.
void Clasp::DomainHeuristic::initScores | ( | Solver & | s, |
bool | moms | ||
) | [protected, virtual] |
Reimplemented from Clasp::ClaspVsids_t< DomScore >.
Definition at line 730 of file heuristics.cpp.
bool Clasp::DomainHeuristic::match | ( | const char *& | in, |
const char * | match | ||
) | [static, private] |
Definition at line 657 of file heuristics.cpp.
bool Clasp::DomainHeuristic::matchDom | ( | const char *& | in, |
std::string & | out | ||
) | [static, private] |
Definition at line 663 of file heuristics.cpp.
bool Clasp::DomainHeuristic::matchInt | ( | const char *& | in, |
int & | out | ||
) | [static, private] |
Definition at line 674 of file heuristics.cpp.
Constraint::PropResult Clasp::DomainHeuristic::propagate | ( | Solver & | s, |
Literal | p, | ||
uint32 & | data | ||
) | [protected, virtual] |
Propagate is called for each constraint that watches p. It shall enqueue all consequences of p becoming true.
s | The solver in which p became true. |
p | A literal watched by this constraint that recently became true. |
data | The data-blob that this constraint passed when the watch for p was registered. |
Implements Clasp::Constraint.
Definition at line 878 of file heuristics.cpp.
void Clasp::DomainHeuristic::pushUndo | ( | Solver & | s, |
uint32 | actionId | ||
) | [private] |
Definition at line 907 of file heuristics.cpp.
virtual void Clasp::DomainHeuristic::reason | ( | Solver & | s, |
Literal | p, | ||
LitVec & | lits | ||
) | [inline, protected, virtual] |
Implements Clasp::Constraint.
Definition at line 351 of file heuristics.h.
void Clasp::DomainHeuristic::startInit | ( | const Solver & | ) | [virtual] |
Called once after all problem variables are known to the solver. The default-implementation is a noop.
s | The solver in which this heuristic is used. |
Reimplemented from Clasp::ClaspVsids_t< DomScore >.
Definition at line 724 of file heuristics.cpp.
void Clasp::DomainHeuristic::undoLevel | ( | Solver & | s | ) | [protected, virtual] |
Called when the solver undid a decision level watched by this constraint.
s | the solver in which the decision level is undone. |
Reimplemented from Clasp::Constraint.
Definition at line 916 of file heuristics.cpp.
ActionVec Clasp::DomainHeuristic::actions_ [private] |
Definition at line 415 of file heuristics.h.
const char *const Clasp::DomainHeuristic::domEnd_s = "_heuristic)" [static, private] |
Definition at line 400 of file heuristics.h.
const char *const Clasp::DomainHeuristic::domKey_s = "_heuristic(" [static, private] |
Definition at line 399 of file heuristics.h.
PrioVec Clasp::DomainHeuristic::dPrios_ [private] |
Definition at line 416 of file heuristics.h.
FrameVec Clasp::DomainHeuristic::frames_ [private] |
Definition at line 417 of file heuristics.h.
LitVec* Clasp::DomainHeuristic::minLits_ [private] |
Definition at line 414 of file heuristics.h.
Solver* Clasp::DomainHeuristic::solver_ [private] |
Definition at line 413 of file heuristics.h.