Implicative Class Reference

#include <Implicative.hh>

Collaboration diagram for Implicative:

Collaboration graph
[legend]
List of all members.

Public Member Functions

QECODE_EXPORT int nv ()
QECODE_EXPORT Implicative (int ns, bool *quant, int *nv)
 Default constructor for a restricted-quantified space.
QECODE_EXPORT ~Implicative ()
QECODE_EXPORT void QIntVar (int var, int min, int max)
 Defines an integer variable in the quantified space.
QECODE_EXPORT void QIntVar (int var, IntSet dom)
 Defines an integer variable in the quantified space.
QECODE_EXPORT void QBoolVar (int var)
 Defines a boolean variable in the quantified space.
QECODE_EXPORT MySpacespace ()
 Returns the current declarating space.
QECODE_EXPORT IntVar var (int n)
 Returns an integer variable from the space we are currently declaring.
QECODE_EXPORT BoolVar bvar (int n)
 Returns a boolean variable from the space we are currently declaring.
QECODE_EXPORT int nextScope ()
 Switch to the next space for constraint declaration.
QECODE_EXPORT void makeStructure ()
 Finalizes the object construction.
QECODE_EXPORT OptVargetAggregate (int scope, OptVar *opt, Aggregator *agg)
 returns an aggregate of the problem
QECODE_EXPORT OptVargetExistential (int var)
QECODE_EXPORT void optimize (int scope, int optType, OptVar *var)
QECODE_EXPORT bool qt_of_var (int v)
 returns uantifier of variable 'v'
QECODE_EXPORT bool quantification (int scope)
 returns quantifier of scope 'scope'
QECODE_EXPORT int spaces ()
 returns the number of scopes of the problem
QECODE_EXPORT int nbVarInScope (int scope)
 returns the number of variables present in scope 'scope'
QECODE_EXPORT MySpacegetSpace (int scope)
 returns a copy of the Gecode::Space corresponding to the 'scope'-th restricted quantifier of the problem
QECODE_EXPORT MySpacegetGoal ()
QECODE_EXPORT int getOptType (int scope)
 returns theoptimization type of the 'scope'-th scope of the problem
QECODE_EXPORT OptVargetOptVar (int scope)
 returns the optimization variable of the 'scope'-th scope of the problem

Private Attributes

int n
int nbSpaces
void ** v
VarTypetype_of_v
bool * Quantifiers
MySpace ** rules
MySpacegoal
Optsoptim
int * nbVarBySpace
int * whichSpaceOwns
bool * varInitialised
int currentDeclareSpace

Friends

class valueHeuristic
class QSolverOpt

Classes

struct  Opts

Detailed Description

Definition at line 32 of file Implicative.hh.


Constructor & Destructor Documentation

Implicative::Implicative ( int  ns,
bool *  quant,
int *  nv 
)

Default constructor for a restricted-quantified space.

This is the first step for building a QCSP+/QCOP+ problem. The prefix is defined here.

Parameters:
ns The number of scopes in the prefix.
quant Array of booleans which contains the quantifier of every scope (true for universal, false for existential).
nv Array of integer which contains the number of variables by scope.

Definition at line 25 of file Implicative.cc.

References currentDeclareSpace, goal, n, nbSpaces, nbVarBySpace, optim, Quantifiers, rules, type_of_v, v, varInitialised, and whichSpaceOwns.

Implicative::~Implicative (  ) 

Definition at line 62 of file Implicative.cc.

References goal, nbSpaces, and rules.


Member Function Documentation

QECODE_EXPORT int Implicative::nv (  )  [inline]

Definition at line 57 of file Implicative.hh.

void Implicative::QIntVar ( int  var,
int  min,
int  max 
)

Defines an integer variable in the quantified space.

Defines an integer variable in the quantifies space using a fully declared domain.

Parameters:
var Number of the variable to be defined.
dom The initial domain of the variable.

Definition at line 77 of file Implicative.cc.

References goal, nbSpaces, rules, type_of_v, MySpace::type_of_v, MySpace::v, v, varInitialised, VTYPE_INT, and whichSpaceOwns.

Referenced by main().

void Implicative::QIntVar ( int  var,
IntSet  dom 
)

Defines an integer variable in the quantified space.

Defines an integer variable in the quantifies space using a fully declared domain.

Parameters:
var Number of the variable to be defined.
dom The initial domain of the variable.

Definition at line 94 of file Implicative.cc.

References goal, nbSpaces, rules, type_of_v, MySpace::type_of_v, MySpace::v, v, varInitialised, VTYPE_INT, and whichSpaceOwns.

void Implicative::QBoolVar ( int  var  ) 

Defines a boolean variable in the quantified space.

Defines a boolean variable with a full initial domain in the quantified space.

Parameters:
var Number of the variable to be defined.

Definition at line 111 of file Implicative.cc.

References goal, nbSpaces, rules, type_of_v, MySpace::type_of_v, MySpace::v, v, varInitialised, VTYPE_BOOL, and whichSpaceOwns.

Referenced by main().

MySpace * Implicative::space (  ) 

Returns the current declarating space.

Return the space we are currently declarating constraints in. nextScope() is used to set the nextspace as the current one.

Definition at line 127 of file Implicative.cc.

References currentDeclareSpace, goal, nbSpaces, and rules.

Referenced by bvar(), main(), and var().

IntVar Implicative::var ( int  n  ) 

Returns an integer variable from the space we are currently declaring.

Returns an integer variable from the cpace we are currently declaring. Will abort if the variable is not integer.

Parameters:
n The number of the variable to return.

Definition at line 136 of file Implicative.cc.

References space(), type_of_v, MySpace::v, varInitialised, and VTYPE_INT.

Referenced by main(), and optimize().

BoolVar Implicative::bvar ( int  n  ) 

Returns a boolean variable from the space we are currently declaring.

Returns a boolean variable from the space we are currently declaring. Will abort if the variable is not boolean.

Parameters:
n The number of the variable to return.

Definition at line 149 of file Implicative.cc.

References space(), type_of_v, MySpace::v, varInitialised, and VTYPE_BOOL.

Referenced by main().

int Implicative::nextScope (  ) 

Switch to the next space for constraint declaration.

Switches to the next space for constraint declaration. var, bvar and space methods will now refer to the next rule space (or to the goal space if the current space was the last rule one). Returns the new space number, or -1 if it was called while there was no next space to declare constraints in.

Definition at line 162 of file Implicative.cc.

References currentDeclareSpace, and nbSpaces.

Referenced by main().

void Implicative::makeStructure (  ) 

Finalizes the object construction.

Finalizes the restricted-quantified space construction. Must be invoked once all the variable and all the constraints have been declared, and before the search is performed on this space. calling this method is not mandatory, although it is recommanded to besure that the problem have been well built. For the existential scopes on which an optimization condition have not been defined yet, this method will post a "Any" optimization condition (i.e. do not optimize).

Definition at line 169 of file Implicative.cc.

References getExistential(), n, nbSpaces, nbVarBySpace, optim, optimize(), Quantifiers, and varInitialised.

Referenced by main().

OptVar * Implicative::getAggregate ( int  scope,
OptVar opt,
Aggregator agg 
)

returns an aggregate of the problem

Creates an aggregate at a given universal scope. This aggregate is an optimization variable that an existential scope can use for optimizing.

Parameters:
scope the scope where this aggregate will be defined. Must be an unversal scope
opt The optimization variable we want to aggregate. There must not be any universal scope between an agregate and thisoptimization variable.
agg The aggregator function that will be used for this aggregate.

Definition at line 185 of file Implicative.cc.

References OptVar::getScope(), optim, Quantifiers, and Implicative::Opts::vars.

Referenced by main().

OptVar * Implicative::getExistential ( int  var  ) 

returns an existential optimization variable

Creates an optimization variable that will have the value of an existential variable defined in the problem.

Parameters:
var the number of the existential variable that must be considered

Definition at line 198 of file Implicative.cc.

References Quantifiers, and whichSpaceOwns.

Referenced by main(), and makeStructure().

void Implicative::optimize ( int  scope,
int  optType,
OptVar var 
)

set an optimization condition on an existential scope

set an optimization condition on a given existential scope of the problem. An optimizaiton condition is composed of an optimization variable (aggregate or existential variable), and of an optimization type.

Parameters:
scope the scope on which the optimization condition is posted. Must be existential.
optType the optimization type of the condision we post. 0 is for ANY, 1 is for MIN, 2 is for MAX.
var the optimization variable to be minimized/maximized

Definition at line 205 of file Implicative.cc.

References Implicative::Opts::opt_type, optim, Quantifiers, var(), and Implicative::Opts::vars.

Referenced by main(), and makeStructure().

bool Implicative::qt_of_var ( int  v  ) 

returns uantifier of variable 'v'

Definition at line 218 of file Implicative.cc.

References Quantifiers, and whichSpaceOwns.

QECODE_EXPORT bool Implicative::quantification ( int  scope  )  [inline]

returns quantifier of scope 'scope'

Definition at line 155 of file Implicative.hh.

Referenced by QSolver::rSolve().

int Implicative::spaces (  ) 

returns the number of scopes of the problem

Definition at line 72 of file Implicative.cc.

References nbSpaces.

Referenced by QSolver::rSolve().

QECODE_EXPORT int Implicative::nbVarInScope ( int  scope  )  [inline]

returns the number of variables present in scope 'scope'

Definition at line 157 of file Implicative.hh.

Referenced by QSolver::rSolve().

MySpace * Implicative::getSpace ( int  scope  ) 

returns a copy of the Gecode::Space corresponding to the 'scope'-th restricted quantifier of the problem

Definition at line 223 of file Implicative.cc.

References goal, nbSpaces, and rules.

Referenced by QSolver::rSolve().

MySpace * Implicative::getGoal (  ) 

Definition at line 249 of file Implicative.cc.

References goal.

Referenced by QSolver::rSolve().

int Implicative::getOptType ( int  scope  ) 

returns theoptimization type of the 'scope'-th scope of the problem

Definition at line 255 of file Implicative.cc.

References Implicative::Opts::opt_type, optim, and Quantifiers.

Referenced by QSolver::rSolve().

OptVar * Implicative::getOptVar ( int  scope  ) 

returns the optimization variable of the 'scope'-th scope of the problem

Definition at line 261 of file Implicative.cc.

References optim, Quantifiers, and Implicative::Opts::vars.

Referenced by QSolver::rSolve().


Friends And Related Function Documentation

friend class valueHeuristic [friend]

Definition at line 33 of file Implicative.hh.

friend class QSolverOpt [friend]

Definition at line 34 of file Implicative.hh.


Member Data Documentation

int Implicative::n [private]

Definition at line 41 of file Implicative.hh.

Referenced by Implicative(), and makeStructure().

int Implicative::nbSpaces [private]

Definition at line 42 of file Implicative.hh.

Referenced by getSpace(), Implicative(), makeStructure(), nextScope(), QBoolVar(), QIntVar(), space(), spaces(), and ~Implicative().

void** Implicative::v [private]

Definition at line 43 of file Implicative.hh.

Referenced by Implicative(), QBoolVar(), and QIntVar().

VarType* Implicative::type_of_v [private]

Definition at line 44 of file Implicative.hh.

Referenced by bvar(), Implicative(), QBoolVar(), QIntVar(), and var().

bool* Implicative::Quantifiers [private]

Definition at line 46 of file Implicative.hh.

Referenced by getAggregate(), getExistential(), getOptType(), getOptVar(), Implicative(), makeStructure(), optimize(), and qt_of_var().

MySpace** Implicative::rules [private]

Definition at line 47 of file Implicative.hh.

Referenced by getSpace(), Implicative(), QBoolVar(), QIntVar(), space(), and ~Implicative().

MySpace* Implicative::goal [private]

Definition at line 48 of file Implicative.hh.

Referenced by getGoal(), getSpace(), Implicative(), QBoolVar(), QIntVar(), space(), and ~Implicative().

Opts* Implicative::optim [private]

Definition at line 49 of file Implicative.hh.

Referenced by getAggregate(), getOptType(), getOptVar(), Implicative(), makeStructure(), and optimize().

int* Implicative::nbVarBySpace [private]

Definition at line 50 of file Implicative.hh.

Referenced by Implicative(), and makeStructure().

int* Implicative::whichSpaceOwns [private]

Definition at line 51 of file Implicative.hh.

Referenced by getExistential(), Implicative(), QBoolVar(), QIntVar(), and qt_of_var().

bool* Implicative::varInitialised [private]

Definition at line 52 of file Implicative.hh.

Referenced by bvar(), Implicative(), makeStructure(), QBoolVar(), QIntVar(), and var().

int Implicative::currentDeclareSpace [private]

Definition at line 54 of file Implicative.hh.

Referenced by Implicative(), nextScope(), and space().


The documentation for this class was generated from the following files:
Generated on Tue Jun 10 18:32:00 2008 for qecode by  doxygen 1.5.2