|
codac 2.0.0
|
Sequential intersection of several contractors: More...
#include <codac2_CtcInter.h>
Public Member Functions | |
| CtcInter (Index n) | |
| Builds a neutral intersection contractor with a prescribed domain size. | |
| template<typename C> | |
| CtcInter (const C &c) | |
| Builds an intersection contractor from a single contractor. | |
| template<typename... C> | |
| CtcInter (const C &... c) | |
| Builds an intersection contractor from several contractors. | |
| size_t | nb () const |
| Returns the number of stored contractors. | |
| void | contract (X &... x) const |
| Contracts the given domain(s) by applying all stored contractors in sequence. | |
| template<typename C> | |
| CtcInter< X... > & | operator&= (const C &c) |
| Appends a contractor to the current intersection. | |
Protected Attributes | |
| Collection< CtcBase< X... > > | _ctcs |
| Internal collection of contractors composing the intersection. | |
Sequential intersection of several contractors:
\[\mathcal{C}_{\mathrm{inter}} = \mathcal{C}_1 \cap \mathcal{C}_2 \cap \dots \cap \mathcal{C}_n. \]
Each sub-contractor is applied successively to the current domain. If two contractors implement two constraints, then their intersection corresponds to the logical conjunction of these constraints. This corresponds to the classical intersection/composition pattern of contractor programming.
CtcInter stores a collection of contractors acting on the same contracted types and applies them one after the other. For instance, for contractors acting on a single box \([\mathbf{x}]\):
\[\left(\mathcal{C}_1 \cap \mathcal{C}_2\right)([\mathbf{x}]) := \mathcal{C}_1([\mathbf{x}]) \cap \mathcal{C}_2([\mathbf{x}]). \]
In practice, each stored contractor contracts the current domain in place; the next one then works on the already reduced result. It does not perform any fixpoint iteration. If the domain becomes empty at some step, the contraction stops immediately.
A CtcInter object can be built explicitly, extended incrementally with &=, or constructed implicitly with the binary & operator between two contractors.
In C++, a variadic .contract(..) function is available when the intersected contractors act on several domains rather than on a single box. Such contractors can be combined provided they are homogeneous, i.e. they act on the same sequence of input types.
| X | Contracted domain type(s). For the common box-contractor case, this is typically IntervalVector. |
|
inlineexplicit |
Builds a neutral intersection contractor with a prescribed domain size.
This constructor is mainly useful when building a contractor incrementally with operator&=. Otherwise it has no effect.
| n | Dimension of the contracted object. |
Builds an intersection contractor from a single contractor.
The contractor is stored internally in the collection of composed contractors.
| C | Type of the contractor or contractor pointer. |
| c | Contractor to store. |
|
inline |
Builds an intersection contractor from several contractors.
All contractors must act on contracted objects of the same size.
| C | Contractor or contractor-pointer types. |
| c | Contractors to compose sequentially. |
|
inline |
Returns the number of stored contractors.
|
inline |
Contracts the given domain(s) by applying all stored contractors in sequence.
The domains are updated in place. If one contractor empties one of the domains, the remaining contractors are not evaluated.
| x | Domain(s) to contract. |
|
inline |
Appends a contractor to the current intersection.
The contractor is added at the end of the internal sequence, so it will be applied after the already stored ones.
| C | Type of the contractor or contractor pointer. |
| c | Contractor to append. |