# Catalog of contractors for static constraints¶

The domains previously presented will be reduced by means of contractors: operators designed to eliminate unfeasible solutions according to constraints. We distinct two categories of contractors: those that are time-related (and that involve tubes) and the static ones presented in this chapter.

Mathematically, a contractor $$\mathcal{C}$$ on a box $$[\mathbf{x}]\in\mathbb{IR}^n$$ is an operator $$\mathbb{IR}^{n}\to\mathbb{IR}^{n}$$ such that

$\begin{split}$$\begin{array}{lll} \mathcal{C}([\mathbf{x}])\subset[\mathbf{x}] & & \text{(contractance)}\\ {}[\mathbf{x}]\subset\left[\mathbf{y}\right]\text{ }\Rightarrow\text{}\mathcal{C}([\mathbf{x}])\subset\mathcal{C}([\mathbf{y}]). & & \text{(monotonicity)} \end{array}$$\end{split}$

In Codac, a contractor is applied on a box by calling the .contract(…) method.

## Static contractors¶

The following contractors apply on intervals and boxes:

Combining contractors

Union, intersection, Cartesian product, or inversion of contractors is achievable. See for instance:

from codac import *
from vibes import vibes

# Define some non-linear function
f = Function('x', 'y', 'x*cos(x-y)+y')

# Build the separator associated to the constraint f(x,y) < 0
sep = SepFwdBwd(f, CmpOp.LEQ)

# Example of Cartesian product of two contractors
c3 = cart_prod([ctc_1, ctc_2])

// todo


How a contractor is implemented

Contractors are C++/Python objects. Some of them can be instantiated according to the problem to deal with. All of them will contract domains with the .contract() method.

Pre-defined contractors

For ease of use, some contractor objects that do not require parameters are predefined in the namespace ctc. They can be used directly without instantiation.

Contractor

Type

Code

Doc

$$\mathcal{C}_{\textrm{polar}}$$

Static

ctc::polar for C++
ctc.polar for Python

$$\mathcal{C}_{\textrm{dist}}$$

Static

ctc::dist for C++
ctc.dist for Python

$$\mathcal{C}_{\frac{d}{dt}}$$

Dynam.

ctc::deriv for C++
ctc.deriv for Python

$$\mathcal{C}_{\textrm{eval}}$$

Dynam.

ctc::eval for C++
ctc.eval for Python

$$\mathcal{C}_{\textrm{delay}}$$
ctc::delay for C++
ctc.delay for Python