Classes | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
Clasp::DomainHeuristic Class Reference

A VSIDS heuristic supporting additional domain knowledge. More...

#include <heuristics.h>

Inheritance diagram for Clasp::DomainHeuristic:
Inheritance graph
[legend]

List of all members.

Classes

struct  CmpSymbol
struct  DomAction
struct  DomEntry
class  DomMinimize
struct  DomPrio
struct  Frame

Public Types

typedef ClaspVsids_t< DomScoreBaseType
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 &params=HeuParams())
virtual void startInit (const Solver &s)
 ~DomainHeuristic ()

Protected Member Functions

virtual ConstraintcloneAttach (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_
LitVecminLits_
Solversolver_

Static Private Attributes

static const char *const domEnd_s = "_heuristic)"
static const char *const domKey_s = "_heuristic("

Detailed Description

A VSIDS heuristic supporting additional domain knowledge.

See also:
M. Gebser, B. Kaufmann, R. Otero, J. Romero, T. Schaub, P. Wanko: "Domain-specific Heuristics in Answer Set Programming", http://www.cs.uni-potsdam.de/wv/pdfformat/gekaotroscwa13a.pdf

Definition at line 335 of file heuristics.h.


Member Typedef Documentation

Definition at line 396 of file heuristics.h.

Definition at line 338 of file heuristics.h.

Definition at line 398 of file heuristics.h.

Definition at line 397 of file heuristics.h.

Definition at line 359 of file heuristics.h.

Definition at line 358 of file heuristics.h.


Member Enumeration Documentation

Enumerator:
gmod_level 
gmod_spos 
gmod_true 
gmod_sneg 
gmod_false 
gmod_max_value 

Definition at line 340 of file heuristics.h.

Enumerator:
gpref_atom 
gpref_scc 
gpref_hcc 
gpref_disj 
gpref_min 
gpref_show 

Definition at line 339 of file heuristics.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Note:
Return 0 to indicate that cloning is not supported.

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.

Precondition:
s.numFreeVars() > 0, i.e. there is at least one variable to branch on.
Returns:
  • a literal that is currently free or
  • a sentinel literal. In that case, the heuristic shall have asserted a literal!

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.

Precondition:
p is true in s
Parameters:
sThe solver in which p became true.
pA literal watched by this constraint that recently became true.
dataThe 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]
Precondition:
This constraint is the reason for p being true in s.
Postcondition:
The literals implying p were added to lits.

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.

Parameters:
sThe 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.

Parameters:
sthe solver in which the decision level is undone.

Reimplemented from Clasp::Constraint.

Definition at line 916 of file heuristics.cpp.


Member Data Documentation

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.

Definition at line 416 of file heuristics.h.

Definition at line 417 of file heuristics.h.

Definition at line 414 of file heuristics.h.

Definition at line 413 of file heuristics.h.


The documentation for this class was generated from the following files:


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:40