QSpace Class Reference

Base class for a quantified space. Base class for a quantified space (with restricted quantifiers or not). The array v has to be kept up-to-date by the copy constructor of any descendant of this class. More...

#include <qecore.hh>

Inherited by Implicative.

Inheritance diagram for QSpace:

Inheritance graph
[legend]
List of all members.

Public Member Functions

QECODE_EXPORT QSpace ()
QECODE_EXPORT QSpace (QSpace &qs)
virtual QECODE_EXPORT ~QSpace ()
QECODE_EXPORT int nv ()
 Returns the number of variablas. returns the number of variables this quantified space contains.
virtual bool quantification (int v)=0
 Returns a variable quantificaion. Returns wether a variable is quantified existentially (false) or universally (true).
virtual int status (int var, unsigned long int &propsteps)=0
 Returns the current partial status of the quantified space. Returns the current status of the quantified space, but limits the computation of this status at the variable given in parameter. So, this method will return "don't know" more often than a complete status computation. Returns 1 for "true", 0 for "false", and -1 for "Don't know, try a next variable". A "Don't know" answer while all the variables have been assigned can be considered as a "true".
virtual int finalStatus (unsigned long int &propsteps)=0
 Returns the thuth value of a completely assigned problem. Performs the last checks to return in a complete way the truth value of the problem. All non-subsumes variables must be assigned for this method to be correct.
virtual bool subsumed (int var)=0
 Returns wether a variable is subsumed or not. A variable is subsumed if it is assigned or it is bound by no more constraint. The answer must be correct, but not complete (so, a "not sure" must return False for the solver to remain correct.
virtual QSpaceclone ()=0
virtual void assign_int (int var, int **vals, int nbVals)=0
 Assigns a set of value to an integer variable. assigns a set of value to an integer variable. Used only by the search engine.
virtual void remove_int (int var, int **vals, int nbVals)=0
 Removes a set of value to an integer variable. Removes a set of value to an integer variable. Used only by the search engine.
virtual void assign_bool (int var, int **vals, int nbVals)=0
 Assigns a set of value to an integer variable. assigns a set of value to an integer variable. Used only by the search engine.
virtual void remove_bool (int var, int **vals, int nbVals)=0
 Removes a set of value to an boolean variable. Removes a set of value to an boolean variable. Used only by the search engine.
virtual void assign_bool (int var, int b)=0
 Assigns a value to a boolean variable. assigns a set of value to an integer variable. Used only by the search engine.
virtual void remove_bool (int var, int b)=0
 Removes a value to a boolean variable. removes a set of value to an integer variable. Used only by the search engine.
virtual void backtrack ()=0
 Method called when the solver backtracks to this quantified space. This method is useful to indicate some new information to the branchong heuristic, like simply updating the scores.
virtual void indicateBranchingHeuristic (BranchingHeuristic *bh)=0
 Indicates the branching heuristic to be used when performing search. Indicates the branching heuristic to be used when performing search. This method is typically invoked by the solver at its construction.
virtual void print ()=0
 Print the space details to the default output.

Public Attributes

void ** v
 Array of the variables of the quantified space. This array contains all the variables of the quantified space (with current domain).
VarTypetype_of_v
 Types of the variables of the quantified space. This aray contains the type of each variable (integer, boolean, etc.).

Protected Attributes

unsigned int n
unsigned long int ps

Detailed Description

Base class for a quantified space. Base class for a quantified space (with restricted quantifiers or not). The array v has to be kept up-to-date by the copy constructor of any descendant of this class.

Definition at line 48 of file qecore.hh.


Constructor & Destructor Documentation

QSpace::QSpace (  ) 

Constructor for a new quantified space with n variables.

Definition at line 28 of file qecore.cc.

QSpace::QSpace ( QSpace qs  ) 

Copy constructor.

Definition at line 30 of file qecore.cc.

References n, ps, type_of_v, and v.

virtual QECODE_EXPORT QSpace::~QSpace (  )  [inline, virtual]

Definition at line 61 of file qecore.hh.


Member Function Documentation

QECODE_EXPORT int QSpace::nv (  )  [inline]

Returns the number of variablas. returns the number of variables this quantified space contains.

Definition at line 67 of file qecore.hh.

Referenced by BranchingHeuristic::BranchingHeuristic(), Implicative::print(), and QSolver::QSolver().

virtual bool QSpace::quantification ( int  v  )  [pure virtual]

Returns a variable quantificaion. Returns wether a variable is quantified existentially (false) or universally (true).

Parameters:
v The variable number.

Implemented in Implicative.

Referenced by BranchingHeuristic::BranchingHeuristic().

virtual int QSpace::status ( int  var,
unsigned long int &  propsteps 
) [pure virtual]

Returns the current partial status of the quantified space. Returns the current status of the quantified space, but limits the computation of this status at the variable given in parameter. So, this method will return "don't know" more often than a complete status computation. Returns 1 for "true", 0 for "false", and -1 for "Don't know, try a next variable". A "Don't know" answer while all the variables have been assigned can be considered as a "true".

Parameters:
var The number of the variable to compute the status around.
propsteps Will be increased by the number of propagation steps performed (for statistical purposes).

Implemented in Implicative.

Referenced by QSolver::rSolve(), and QSolver::solve().

virtual int QSpace::finalStatus ( unsigned long int &  propsteps  )  [pure virtual]

Returns the thuth value of a completely assigned problem. Performs the last checks to return in a complete way the truth value of the problem. All non-subsumes variables must be assigned for this method to be correct.

Parameters:
propsteps Will be increased by the number of propagation steps performed (for statistical purposes).

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual bool QSpace::subsumed ( int  var  )  [pure virtual]

Returns wether a variable is subsumed or not. A variable is subsumed if it is assigned or it is bound by no more constraint. The answer must be correct, but not complete (so, a "not sure" must return False for the solver to remain correct.

Parameters:
var The variable number.

Implemented in Implicative.

Referenced by BranchingHeuristic::nextVar().

virtual QSpace* QSpace::clone (  )  [pure virtual]

Returns a clone of the quantified space (possibly after a propagation call)

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::assign_int ( int  var,
int **  vals,
int  nbVals 
) [pure virtual]

Assigns a set of value to an integer variable. assigns a set of value to an integer variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
vals The values to assign to this variable (represented y ranges).
nbVals The number of ranges in vals.

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::remove_int ( int  var,
int **  vals,
int  nbVals 
) [pure virtual]

Removes a set of value to an integer variable. Removes a set of value to an integer variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
vals The values to remove from this variable (represented y ranges).
nbVals The number of ranges in vals.

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::assign_bool ( int  var,
int **  vals,
int  nbVals 
) [pure virtual]

Assigns a set of value to an integer variable. assigns a set of value to an integer variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
vals The values to assign to this variable (represented y ranges).
nbVals The number of ranges in vals.

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::remove_bool ( int  var,
int **  vals,
int  nbVals 
) [pure virtual]

Removes a set of value to an boolean variable. Removes a set of value to an boolean variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
vals The values to remove from this variable (represented y ranges).
nbVals The number of ranges in vals.

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::assign_bool ( int  var,
int  b 
) [pure virtual]

Assigns a value to a boolean variable. assigns a set of value to an integer variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
b The value to assign to this variable.

Implemented in Implicative.

virtual void QSpace::remove_bool ( int  var,
int  b 
) [pure virtual]

Removes a value to a boolean variable. removes a set of value to an integer variable. Used only by the search engine.

Parameters:
var The number of the variable to assign.
b The value to remove from this variable.

Implemented in Implicative.

virtual void QSpace::backtrack (  )  [pure virtual]

Method called when the solver backtracks to this quantified space. This method is useful to indicate some new information to the branchong heuristic, like simply updating the scores.

Implemented in Implicative.

Referenced by QSolver::rSolve().

virtual void QSpace::indicateBranchingHeuristic ( BranchingHeuristic bh  )  [pure virtual]

Indicates the branching heuristic to be used when performing search. Indicates the branching heuristic to be used when performing search. This method is typically invoked by the solver at its construction.

Implemented in Implicative.

Referenced by QSolver::QSolver().

virtual void QSpace::print (  )  [pure virtual]

Print the space details to the default output.

Implemented in Implicative.

Referenced by QSolver::rSolve().


Member Data Documentation

unsigned int QSpace::n [protected]

Definition at line 50 of file qecore.hh.

Referenced by Implicative::Implicative(), and QSpace().

unsigned long int QSpace::ps [protected]

Definition at line 51 of file qecore.hh.

Referenced by QSpace().

void** QSpace::v

Array of the variables of the quantified space. This array contains all the variables of the quantified space (with current domain).

Definition at line 73 of file qecore.hh.

Referenced by Implicative::cascade(), Implicative::Implicative(), Implicative::makeStructure(), Implicative::print(), Implicative::QBoolVar(), Implicative::QIntVar(), QSpace(), SmallestDomainFirst::score(), and Implicative::subsumed().

VarType* QSpace::type_of_v

Types of the variables of the quantified space. This aray contains the type of each variable (integer, boolean, etc.).

Definition at line 79 of file qecore.hh.

Referenced by Implicative::assign_bool(), Implicative::assign_int(), Implicative::cascade(), valueHeuristic::getBoolVar(), valueHeuristic::getIntVar(), Implicative::Implicative(), Implicative::makeStructure(), Implicative::QBoolVar(), Implicative::QIntVar(), QSpace(), Implicative::remove_bool(), Implicative::remove_int(), QSolver::rSolve(), SmallestDomainFirst::score(), LargestHalfFirst::subSet(), SmallestHalfFirst::subSet(), MedianValueFirst::subSet(), LargestValueFirst::subSet(), SmallestValueFirst::subSet(), FirstFailValue::subSet(), and Implicative::subsumed().


The documentation for this class was generated from the following files:
Generated on Thu Feb 7 14:34:27 2008 for qecode by  doxygen 1.5.2