ibex::Sequence Class Reference
[Contractors]

Sequence of contractors. More...

#include <IbexSequence.h>

Inheritance diagram for ibex::Sequence:

ibex::Contractor ibex::Operator

List of all members.

Public Member Functions

 Sequence (const vector< const Contractor * > &vec, Space &, bool logic_op)
 Sequence (const CSP &csp)
 Sequence (const vector< const Contractor * > &vec)
 Sequence (const Sequence &csp)
 Sequence (const Contractor &c1, const Contractor &c2)
virtual Sequencecopy () const
virtual void contract ()
virtual bool involves (int ent) const
int nb_var () const

Public Attributes

const bool logic_op
ContractorList list


Detailed Description

Sequence of contractors.

A sequence contractor is made by (usually several) subcontractors and is a contractor itself. This is a typical component/composite inductive structure. If each component is related to a constraint (equation, etc.), a sequence can be regarded as the simplest way to propagate through the conjonction of the constraints (i.e., a CSP - constraint satisfaction problem -).

The contractors can either be linked by a logical AND or a logical OR. In case of AND, every subcontractor is simply called in their apparition order. In case of OR, the associated contraction is the hull of all subcontractor contractions. In this case, the result is insensitive to the order of contractors in the sequence.

Author:
Gilles Chabert
Date:
October 2007

Constructor & Destructor Documentation

ibex::Sequence::Sequence ( const vector< const Contractor * > &  vec,
Space space,
bool  logic_op 
)

Create a sequence of contractors.

Parameters:
vec - the vector of contractors
space - the space of the resulting contractor (may be different from the space of contractors in vec).
logic_op - either true (AND) or false (OR).

ibex::Sequence::Sequence ( const CSP csp  ) 

Create a sequence of contractors from a CSP.

In this case: HC4Revise is associated to each constraint and the logic operator is AND.

ibex::Sequence::Sequence ( const vector< const Contractor * > &  vec  ) 

Create a sequence from a vector of contractors. In this case, the space is the one of the first subcontractor and the logic operator is AND.

ibex::Sequence::Sequence ( const Sequence csp  ) 

Duplicate this instance. Every subcontractor is duplicated. Every subcontractor in the new sequence shares the same space as its counterpart (except if the programer of some contractor has decided differently in his implementation of ibex::Contractor::copy() const).

ibex::Sequence::Sequence ( const Contractor c1,
const Contractor c2 
)

Create a sequence of 2 contractors. In this case, the space is the one of the first subcontractor and the logic operator is AND.

Precondition:
the two contractors must share the same space.


Member Function Documentation

Sequence * ibex::Sequence::copy (  )  const [virtual]

Implement the contractor abstract copy.

Generic constraint copy (spaces are passed by reference).

Implements ibex::Contractor.

void ibex::Sequence::contract (  )  [virtual]

Algorithm:

  • In case of logical AND: calls each contractor once (no fixpoint) in sequence. Before each call, synchronizes the subcontractor space with the sequence global space. After ecah call, the sequence space is synchronized back with the subcontractor space.
  • In case of logical OR: calls each contractor once (no fixpoint) in sequence, each time with a copy of the initial space. The sequence space is synchronized in return with the hull of all subcontrator spaces.
See also:
ibex::Cell::space, contract(const Indicators&) .

Implements ibex::Contractor.

virtual bool ibex::Sequence::involves ( int  ent  )  const [inline, virtual]

Return true if the entity ent is in the space.

Reimplemented from ibex::Contractor.

int ibex::Sequence::nb_var (  )  const [inline]

Return the number of variables (in the space).


Member Data Documentation

true means "AND", false means "OR"

list of contractors


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

Generated on Sun Jun 27 15:52:00 2010 for IBEX by  doxygen 1.5.5