Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
Clasp::Antecedent Class Reference

Stores a reference to the constraint that implied a literal. More...

#include <constraint.h>

List of all members.

Public Types

enum  Type { generic_constraint = 0, ternary_constraint = 1, binary_constraint = 2 }

Public Member Functions

 Antecedent ()
 Creates a null Antecedent.
 Antecedent (const Literal &p)
 Creates an Antecedent from the literal p.
 Antecedent (const Literal &p, const Literal &q)
 Creates an Antecedent from the literals p and q.
 Antecedent (Constraint *con)
 Creates an Antecedent from the Constraint con.
uint64 asUint () const
uint64 & asUint ()
Constraintconstraint () const
 Extracts the constraint-pointer stored in this object.
Literal firstLiteral () const
 Extracts the first literal stored in this object.
bool isNull () const
 Returns true if this antecedent does not refer to any constraint.
bool learnt () const
 Returns true if the antecedent is a learnt nogood.
template<class S >
bool minimize (S &s, Literal p, CCMinRecursive *rec) const
bool operator== (const Constraint *con) const
 Returns true iff the antecedent refers to the constraint con.
void reason (Solver &s, Literal p, LitVec &lits) const
 Returns the reason for p.
Literal secondLiteral () const
 Extracts the second literal stored in this object.
Type type () const
 Returns the antecedent's type.

Static Public Member Functions

static bool checkPlatformAssumptions ()
 Checks whether the imlementation-assumptions hold on this platform.

Private Attributes

uint64 data_

Detailed Description

Stores a reference to the constraint that implied a literal.

Stores a reference to the constraint that implied a certain literal or null if the literal has no antecedent (i.e. is a decision literal or a top-level fact).

Note:
The constraint that implied a literal can have three different representations:
  • it can be a single literal (binary clause constraint)
  • it can be two literals (ternary clause constraint)
  • it can be a pointer to a constraint (generic constraint)
Implementation:

The class stores all three representations in one 64-bit integer and makes the following platform assumptions:

These assumptions are not guaranteed by the C++ Standard but should nontheless hold on most 32- and 64-bit platforms.

From the 64-bits the first 2-bits encode the type stored:

Definition at line 399 of file constraint.h.


Member Enumeration Documentation

Enumerator:
generic_constraint 
ternary_constraint 
binary_constraint 

Definition at line 401 of file constraint.h.


Constructor & Destructor Documentation

Creates a null Antecedent.

Postcondition:
: isNull() == true && type == generic_constraint

Definition at line 406 of file constraint.h.

Clasp::Antecedent::Antecedent ( const Literal p) [inline]

Creates an Antecedent from the literal p.

Postcondition:
: type() == binary_constraint && firstLiteral() == p

Definition at line 412 of file constraint.h.

Clasp::Antecedent::Antecedent ( const Literal p,
const Literal q 
) [inline]

Creates an Antecedent from the literals p and q.

Postcondition:
type() == ternary_constraint && firstLiteral() == p && secondLiteral() == q

Definition at line 422 of file constraint.h.

Creates an Antecedent from the Constraint con.

Postcondition:
type() == generic_constraint && constraint() == con

Definition at line 433 of file constraint.h.


Member Function Documentation

uint64 Clasp::Antecedent::asUint ( ) const [inline]

Definition at line 518 of file constraint.h.

uint64& Clasp::Antecedent::asUint ( ) [inline]

Definition at line 519 of file constraint.h.

Checks whether the imlementation-assumptions hold on this platform.

throws PlatformError on error

Definition at line 59 of file constraint.cpp.

Extracts the constraint-pointer stored in this object.

Precondition:
type() == generic_constraint

Definition at line 454 of file constraint.h.

Extracts the first literal stored in this object.

Precondition:
type() != generic_constraint

Definition at line 463 of file constraint.h.

bool Clasp::Antecedent::isNull ( ) const [inline]

Returns true if this antecedent does not refer to any constraint.

Definition at line 438 of file constraint.h.

bool Clasp::Antecedent::learnt ( ) const [inline]

Returns true if the antecedent is a learnt nogood.

Definition at line 448 of file constraint.h.

template<class S >
bool Clasp::Antecedent::minimize ( S &  s,
Literal  p,
CCMinRecursive rec 
) const [inline]

Definition at line 495 of file constraint.h.

bool Clasp::Antecedent::operator== ( const Constraint con) const [inline]

Returns true iff the antecedent refers to the constraint con.

Definition at line 508 of file constraint.h.

void Clasp::Antecedent::reason ( Solver s,
Literal  p,
LitVec lits 
) const [inline]

Returns the reason for p.

Precondition:
!isNull()

Definition at line 481 of file constraint.h.

Extracts the second literal stored in this object.

Precondition:
type() == ternary_constraint

Definition at line 472 of file constraint.h.

Type Clasp::Antecedent::type ( ) const [inline]

Returns the antecedent's type.

Definition at line 443 of file constraint.h.


Member Data Documentation

uint64 Clasp::Antecedent::data_ [private]

Definition at line 521 of file constraint.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