Main Page | Class Hierarchy | Class List | File List | Class Members

Driver Class Reference

#include <Driver.h>

List of all members.

Public Member Functions

 Driver (Problem &problem, Filter &filter)
void registerDecomposition (Decomposition &decomposition)
void unregisterDecomposition (Decomposition &decomposition)
size_t decompositions () const
 Return the number of decomposition algorithms registered.
Decompositiondecomposition (size_t n) const
const Resourcesresources () const
Resourcesresources ()
const timeval & timeLimit () const
timeval setTimeLimit (const timeval &timeLimit)
bool timeLimitExceeded () const
 Return `true' if the algorithm timed out, `false' otherwise.
const ulonglong nodeLimit () const
ulonglong setNodeLimit (const ulonglong nodeLimit)
bool nodeLimitExceeded () const
ulonglong solutions () const
 Return the number of solutions found so far.
bool canYield (size_t index) const
void setSolutionCallback (bool(*solutionCallback)(Decomposition &, bool &))
ulonglong search ()
void yield (size_t fromIndex, bool voluntary)
double staticOptimismPercentage () const
void setStaticOptimismPercentage (double percentage)
double dynamicOptimismPercentage () const
void setDynamicOptimismPercentage (double percentage)
ulonglong yields () const
 Return the number of times the driver's yield method was called.
ulonglong voluntaryYields () const
ulonglong totalCCKS () const
 Return the number of constraint checks performed so far.
ulonglong failedCCKS () const
 Return the current number of constraint failures.


Detailed Description

Dynamic selection of decomposition algorithms. Using this class it is possible to dynamically change the decomposition algorithm used in the search. A driver keeps a list of registered decomposition algorithms and will allow them to yield control to one another, in the order they have been registered. At a given depth in the search, the driver gives control to the first registered decomposition algorithm, which will inspect the problem and decide whether or not it wants to decompose the problem itself. If it decides that it doesn't want to do that, it can yield control to the next registered algorithm through the driver.

See also:
#idc


Constructor & Destructor Documentation

Driver::Driver Problem problem,
Filter filter
[inline]
 

Constructor for the driver.

Parameters:
problem the problem to be solved.
filter the filter to be used.


Member Function Documentation

bool Driver::canYield size_t  index  )  const [inline]
 

Decomposition algorithms that are capable of yielding control to other decomposition algorithms through the driver should ask the the driver first if that is indeed possible (i.e. whether the or not the driver's table of decomposition algorithms contains another algorithm after `index').

Parameters:
index the index of the decomposition algorithm that currently has control.
Returns:
`true' if control can be yield, `false' otherwise.

Decomposition& Driver::decomposition size_t  n  )  const [inline]
 

Return the nth decomposition algorithm registered.

Parameters:
n the index of the requested algorithm.
Returns:
the nth algorithm registered.

double Driver::dynamicOptimismPercentage  )  const [inline]
 

Return the percentage of dynamic optimism. See setDynamicOptimismPercentage() for details.

const ulonglong Driver::nodeLimit  )  const [inline]
 

Return the number of nodes the search is allowed to create.

bool Driver::nodeLimitExceeded  )  const [inline]
 

Return `true' if the search exceeded the number of nodes allowed, `false' otherwise.

void Driver::registerDecomposition Decomposition decomposition  ) 
 

Register a new decomposition algorithm at the end of the chain.

Parameters:
decomposition the algorithm to be registered.

Resources& Driver::resources  )  [inline]
 

The non-const version of the above.

const Resources& Driver::resources  )  const [inline]
 

Return the resources associated with this driver. These are in fact the resources associated with the first decomposition in the driver's chain, as that counts the times and resources of all others as well. The driver must have at least one decomposition in the chain.

Returns:
a Resources object containing the requested resources.

ulonglong Driver::search  ) 
 

The driver's search method.

Returns:
the number of solutions found.

void Driver::setDynamicOptimismPercentage double  percentage  ) 
 

Set the dynamic optimism percentage. If the decomposition's optimism percentage is greater than 0, then each variable's domain of values is sorted according to the first value ordering heuristic, then the given percentage of values is removed from the end of the sorted domain. A decomposition that implements this should return `true' in `supportsOptimism()'.

Parameters:
factor the percentage of values to be removed.

ulonglong Driver::setNodeLimit const ulonglong  nodeLimit  ) 
 

Control the number of nodes the search is allowed to create. setNodeLimit() should be called _after_ all the decomposition algorithms have been registered.

Parameters:
nodeLimit the new node limit.
Returns:
the previous node limit.

void Driver::setSolutionCallback bool(*)(Decomposition &, bool &)  solutionCallback  ) 
 

Set the function to be called when a solution is found by a decomposition algorithm. This affects all the registered decomposition algorithms.

Parameters:
solutionCallback the function's address.

void Driver::setStaticOptimismPercentage double  percentage  ) 
 

Set the static optimism percentage. If the decomposition's optimism percentage is greater than 0, then each variable's domain of values is sorted according to the first value ordering heuristic, then the given percentage of values is removed from the end of the sorted domain. The search will proceed on the resulting problem, with the expectation that at least one solution will still be found in the smaller problem, potentiall much faster.

Parameters:
factor the percentage of values to be removed.

timeval Driver::setTimeLimit const timeval &  timeLimit  ) 
 

Control the amount of time the search is allowed to run. This is always relative to the moment the algorithm started. setTimeLimit() should be called _after_ all the decomposition algorithms have been registered.

Parameters:
timeLimit the new time limit.
Returns:
the previous time limit.

double Driver::staticOptimismPercentage  )  const [inline]
 

Return the percentage of static optimism. See setStaticOptimismPercentage() for details.

const timeval& Driver::timeLimit  )  const [inline]
 

Return the amount of time the search is allowed to run from the moment it has been started.

void Driver::unregisterDecomposition Decomposition decomposition  ) 
 

Unregister a previously registered decomposition algorithm.

Parameters:
decomposition the decomposition algorithm.

ulonglong Driver::voluntaryYields  )  const [inline]
 

Return the number of times the driver's yield method was called voluntarily.

void Driver::yield size_t  fromIndex,
bool  voluntary
 

Yield control to another decomposition algorithm in the chain. If the control is yield voluntary, then control goes to the next decomposition algorithm in the chain (one is assumed to exist, since the algorithms are required to call canYield() first). Otherwise, control goes to the first algorithm in the chain.

Parameters:
fromIndex the index of the algorithm in control.
voluntary whether or not the yield is voluntary.
See also:
canYield


The documentation for this class was generated from the following files:
Generated on Wed May 25 12:21:18 2005 for csp.kdevelop by  doxygen 1.3.9.1