Exclusion#
Module for the Exclusion Operation.
- class Exclusion(geometries)[source]#
Bases:
OperationInterface
Implementation of the exclusion operation between of a list of domains.
Given two sets \(A\) and \(B\), define the exclusion of the two sets as:
\[A \setminus B = \{x \mid x \in A \land x \in B \land x \not\in(A \lor B)\},\]where \(x\) is a point in \(\mathbb{R}^N\).
Initialization of the
Exclusion
class.- Parameters:
geometries (list[DomainInterface]) – A list of instances of the
DomainInterface
class on which the exclusion operation is performed.- Example:
>>> # Create two ellipsoid domains >>> ellipsoid1 = EllipsoidDomain({'x': [-1, 1], 'y': [-1, 1]}) >>> ellipsoid2 = EllipsoidDomain({'x': [0, 2], 'y': [0, 2]}) >>> # Define the exclusion between the domains >>> exclusion = Exclusion([ellipsoid1, ellipsoid2])
- is_inside(point, check_border=False)[source]#
Check if a point is inside the resulting domain.
- Parameters:
point (LabelTensor) – Point to be checked.
check_border (bool) – If
True
, the border is considered inside the domain. Default isFalse
.
- Returns:
True
if the point is inside the domain,False
otherwise.- Return type:
- sample(n, mode='random', variables='all')[source]#
Sampling routine.
- Parameters:
- Raises:
NotImplementedError – If the sampling method is not implemented.
- Returns:
Sampled points.
- Return type:
- Example:
>>> # Create two Cartesian domains >>> cartesian1 = CartesianDomain({'x': [0, 2], 'y': [0, 2]}) >>> cartesian2 = CartesianDomain({'x': [1, 3], 'y': [1, 3]}) >>> # Define the exclusion between the domains >>> Exclusion = Exclusion([cartesian1, cartesian2]) >>> # Sample >>> Exclusion.sample(n=5) LabelTensor([[2.4187, 1.5792], [2.7456, 2.3868], [2.3830, 1.7037], [0.8636, 1.8453], [0.1978, 0.3526]]) >>> len(Exclusion.sample(n=5) 5