Sets (with project method)

AbstractSet

class disropt.constraints.projection_sets.AbstractSet[source]

Bases: object

Abstract constraint set

projection(x)[source]

Project a point onto the set

to_constraints()[source]

Convert the set in a list of Constraints

Box

class disropt.constraints.projection_sets.Box(lower_bound=None, upper_bound=None)[source]

Bases: disropt.constraints.projection_sets.AbstractSet

Box set

\(X = \{x\mid l\leq x \leq u\}\) with \(l,x,u\in \mathbb{R}^{n}\)

Parameters
  • lower_bound (numpy.ndarray, optional) – array with lower bounds for each axis. Defaults to None.

  • upper_bound (numpy.ndarray, optional) – array with upper bounds for each axis. Defaults to None.

lower_bound

lower bounds

Type

numpy.ndarray

upper_bound

upper bounds

Type

numpy.ndarray

input_shape

space dimensions

Type

tuple

intersection(box)[source]

Compute the intersection with another box

Parameters

box (Box) – box to compute the intersection with

Raises
  • ValueError – Only intersection with another box is supported

  • ValueError – The two boxex must have the same input_shape

projection(x)[source]

Project a point onto the box

Parameters

x (numpy.ndarray) – Point to be projected

Returns

projected point

Return type

numpy.ndarray

to_constraints()[source]

Convert the set in a list of Constraints

Strip

class disropt.constraints.projection_sets.Strip(regressor, shift, width)[source]

Bases: disropt.constraints.projection_sets.AbstractSet

Strip set

\(X = \{x\mid -w<=|a^\top x - s|<=w\}\) with \(a,x\in \mathbb{R}^{n}\) and \(w\in\mathbb{R}\)

Parameters
  • regressor (numpy.ndarray) – regressor of the strip

  • shift (float) – shift from the origin

  • width (float) – width of the strip

regressor

regressor of the strip

Type

numpy.ndarray

shift

shift from the origin

Type

float

upper

upper border (shift + half width)

Type

float

lower

lower border (shift - half width)

Type

float

input_shape

space dimensions

Type

tuple

intersection(strip)[source]

Compute the intersection with another strip

Parameters

strip (Strip) – strip to compute the intersection with

Raises
  • ValueError – Only intersection with another strip is supported

  • ValueError – The two strips must have the same regressor

projection(x)[source]

Project a point onto the strip

Parameters

x (numpy.ndarray) – Point to be projected

Returns

projected point

Return type

numpy.ndarray

to_constraints()[source]

Convert the set in a list of Constraints

Circle

class disropt.constraints.projection_sets.Circle(center, radius)[source]

Bases: disropt.constraints.projection_sets.AbstractSet

Circle set

\(X = \{x\mid \|x - c\|<= r\}\) with \(x,c\in \mathbb{R}^{n}\) and \(r\in\mathbb{R}\)

Parameters
center

center of the circle

Type

numpy.ndarray

radius

radius of the circle

Type

float

input_shape

space dimensions

Type

tuple

intersection(circle)[source]

Compute the intersection with another circle

Parameters

circle (Circle) – circle to compute the intersection with

Raises
  • ValueError – Only intersection with another circle is supported

  • ValueError – The two circles must have the same center

projection(x)[source]

Project a point onto the circle

Parameters

x (numpy.ndarray) – Point to be projected

Returns

projected point

Return type

numpy.ndarray

to_constraints()[source]

Convert the set in a list of Constraints

CircularSector

class disropt.constraints.projection_sets.CircularSector(vertex, angle, radius, width)[source]

Bases: disropt.constraints.projection_sets.AbstractSet

Circular sector set.

Parameters
  • vertex (numpy.ndarray) – vertex of the circular sector

  • angle (float) – direction of the circular sector (in rad)

  • radius (float) – radius of the circular sector

  • width (float) – width of the circular sector (in rad)

vertex

vertex of the circular sector

Type

numpy.ndarray

angle

direction of the circular sector (in rad)

Type

float

radius

radius of the circular sector

Type

float

h_angle

left border (from the vertex pov) of the circular sector (in rad)

Type

float

l_angle

right border (from the vertex pov) of the circular sector (in rad)

Type

float

input_shape

space dimensions

Type

tuple

intersection(circular_sector)[source]

Compute the intersection with another circular sector

Parameters

circular_sector (CircularSector) – circula sector to compute the intersection with

Raises
  • ValueError – Only intersection with another circular_sector is supported

  • ValueError – The two circular_sector must have the same vertex

projection(x)[source]

Project a point onto the ciruclar sector

Parameters

x (numpy.ndarray) – Point to be projected

Returns

projected point

Return type

numpy.ndarray

to_constraints()[source]

Convert the set in a list of Constraints