Skip to main content

Segment

An open segment. Defined in ]StartTime, EndTime[.

note

From unit structure defined in [BT08] Section 4.1

public sealed class Segment : Element, IToCodeString, Unipi.Nancy.Utility.IStableHashCode, System.IEquatable<Segment>

Inheritance ObjectElementSegment
Implements IToCodeString, IStableHashCode, IEquatable<Segment>

Properties

Type

Type identification property for JSON (de)serialization.

public string Type { get; }

Property Value

String

StartTime

Exclusive left endpoint of the support of the segment.

note

Referred to as xix_i in [BT08] Section 4.1

public Rational StartTime { get; }

Property Value

Rational

EndTime

Exclusive rigth endpoint of the support of the segment.

note

Referred to as xix_i in [BT08] Section 4.1

public Rational EndTime { get; }

Property Value

Rational

RightLimitAtStartTime

Right limit of the segment at StartTime, f(a+)f(a+).

note

Referred to as ρi\rho_i in [BT08] Section 4.1

public Rational RightLimitAtStartTime { get; }

Property Value

Rational

Slope

Slope of the segment.

note

Referred to as ρi\rho_i in [BT08] Section 4.1

public Rational Slope { get; }

Property Value

Rational

LeftLimitAtEndTime

Left limit of the segment at EndTime, f(b)f(b-).

public Rational LeftLimitAtEndTime { get; }

Property Value

Rational

IsInfinite

True if the segment has value plus/minus infinite.

public bool IsInfinite { get; }

Property Value

Boolean

IsPlusInfinite

True if the segment has value plus infinite.

public bool IsPlusInfinite { get; }

Property Value

Boolean

IsMinusInfinite

True if the segment has value minus infinite.

public bool IsMinusInfinite { get; }

Property Value

Boolean

IsZero

True if the segment has value 0 over all of its support.

public bool IsZero { get; }

Property Value

Boolean

IsConstant

True if the segment has a constant value

public bool IsConstant { get; }

Property Value

Boolean

StartSlope

Slope, w.r.t. origin, of the left endpoint of the segment.

public Rational StartSlope { get; }

Property Value

Rational

EndSlope

Slope, w.r.t. origin, of the right endpoint of the segment.

public Rational EndSlope { get; }

Property Value

Rational

Length

Length in time of the element. If the element is a Segment, it is strictly greater than 0. If the element is a Point, it is equal to 0.

public Rational Length { get; }

Property Value

Rational

IsFinite

True if the element has finite value.

public bool IsFinite { get; }

Property Value

Boolean

Constructors

Segment(Rational, Rational, Rational, Rational)

Constructor.

public Segment(Rational startTime, Rational endTime, Rational rightLimitAtStartTime, Rational slope)

Parameters

startTime Rational
Left endpoint of the support of the segment.

endTime Rational
Right endpoint of the support of the segment.

rightLimitAtStartTime Rational
Right limit of the segment at startTime, f(a+).

slope Rational
Slope of the segment.

Exceptions

ArgumentException

Methods

Constant(Rational, Rational, Rational)

Constructs a segment with a constant value.

public static Segment Constant(Rational startTime, Rational endTime, Rational value)

Parameters

startTime Rational
Left endpoint of the support of the segment.

endTime Rational
Right endpoint of the support of the segment.

value Rational
Value of the segment.

Returns

Segment

Zero(Rational, Rational)

Constructs a segment with constant value 0.

public static Segment Zero(Rational startTime, Rational endTime)

Parameters

startTime Rational
Left endpoint of the support of the segment.

endTime Rational
Right endpoint of the support of the segment.

Returns

Segment

PlusInfinite(Rational, Rational)

Constructs a segment with constant value ++\infty.

public static Segment PlusInfinite(Rational startTime, Rational endTime)

Parameters

startTime Rational
Left endpoint of the support of the segment.

endTime Rational
Right endpoint of the support of the segment.

Returns

Segment

MinusInfinite(Rational, Rational)

Constructs a segment with constant value -\infty.

public static Segment MinusInfinite(Rational startTime, Rational endTime)

Parameters

startTime Rational
Left endpoint of the support of the segment.

endTime Rational
Right endpoint of the support of the segment.

Returns

Segment

ValueAt(Rational)

public Rational ValueAt(Rational time)

Parameters

time Rational

Returns

Rational

RightLimitAt(Rational)

Computes the right limit of the segment at given time

public Rational RightLimitAt(Rational time)

Parameters

time Rational
The target time of the limit

Returns

Rational
The value of f(t+)f(t^+)

LeftLimitAt(Rational)

Computes the left limit of the segment at given time

public Rational LeftLimitAt(Rational time)

Parameters

time Rational
The target time of the limit

Returns

Rational
The value of f(t)f(t^-)

IsDefinedFor(Rational)

public bool IsDefinedFor(Rational time)

Parameters

time Rational

Returns

Boolean

Split(Rational)

Splits the segment in a segment-point-segment set.

public ValueTuple<Segment, Point, Segment> Split(Rational splitTime)

Parameters

splitTime Rational
The time of split.

Returns

ValueTuple<Segment, Point, Segment>
A tuple containing the segment-point-segment set resulting from the split.

Exceptions

ArgumentException
Thrown if the segment is not defined for the time of split.

Sample(Rational)

Returns a Point sampling of the segment.

public Point Sample(Rational time)

Parameters

time Rational
Time of sampling.

Returns

Point
The sampled .

Exceptions

ArgumentException
Thrown if the segment is not defined for the time of sampling.

Cut(Rational, Rational)

Returns a cut of the segment for a smaller ]start, end[ support.

public Segment Cut(Rational cutStart, Rational cutEnd)

Parameters

cutStart Rational
Left endpoint of the new support.

cutEnd Rational
Right endpoint of the new support.

Returns

Segment
The resulting from the cut.

Exceptions

ArgumentException

        Thrown if the new support is not a subset of the current one.

GetOverlap(Segment, Segment)

Computes the overlap between two segments.

public static Nullable<ValueTuple<Rational, Rational>> GetOverlap(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Nullable<ValueTuple<Rational, Rational>>
The endpoints of the overlap interval, or null if there is none.

GetOverlap(Segment)

Computes the overlap between two elements.

public Nullable<ValueTuple<Rational, Rational>> GetOverlap(Segment secondOperand)

Parameters

secondOperand Segment

Returns

Nullable<ValueTuple<Rational, Rational>>
The endpoints of the overlap interval, or null if there is none.

GetIntersection(Segment, Segment)

Computes the Point of intersection between two Segments, if it exists.

note

The point is computed only if unique. If two segments coincide, even if in part, this method will return null.

public static Point GetIntersection(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Point
The point of intersection, or null if it does not exist.

TimeAt(Rational)

Computes the first time the segment is at or above given value.

public Rational TimeAt(Rational value)

Parameters

value Rational
The value to reach.

Returns

Rational
The first time t at which f(t) = value, or + infinity if it is never reached.

FromJson(String)

Deserializes a Segment.

public static Segment FromJson(string json)

Parameters

json String

Returns

Segment

ToCodeString(Boolean, Int32)

Returns a string containing C# code to create this Segment. Useful to copy and paste from a debugger into another test or notebook for further investigation.

public string ToCodeString(bool formatted, int indentation)

Parameters

formatted Boolean

indentation Int32

Returns

String

GetStableHashCode()

public int GetStableHashCode()

Returns

Int32

Scale(Rational)

Scales the segment by a multiplicative factor.

public Element Scale(Rational scaling)

Parameters

scaling Rational

Returns

Element

Delay(Rational)

public Element Delay(Rational delay)

Parameters

delay Rational

Returns

Element

Anticipate(Rational)

public Element Anticipate(Rational time)

Parameters

time Rational

Returns

Element

VerticalShift(Rational)

Shifts the segment vertically by an additive factor.

public Element VerticalShift(Rational shift)

Parameters

shift Rational

Returns

Element

Negate()

public Element Negate()

Returns

Element

Inverse()

public Element Inverse()

Returns

Element

Equals(Object)

public bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

GetHashCode()

public int GetHashCode()

Returns

Int32

Equals(Segment)

public bool Equals(Segment s)

Parameters

s Segment

Returns

Boolean

IsCertainlyAbove(Segment, Segment)

Returns true if the first segment has always higher value than the second one. Does not consider time overlapping.

public static bool IsCertainlyAbove(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Boolean

IsCertainlyAbove(Segment)

Returns true if the first segment has always higher value than the second one. Does not consider time overlapping.

public bool IsCertainlyAbove(Segment segment)

Parameters

segment Segment

Returns

Boolean

IsCertainlyBelow(Segment, Segment)

Returns true if the first segment has always lower value than the second one. Does not consider time overlapping.

public static bool IsCertainlyBelow(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Boolean

IsCertainlyBelow(Segment)

Returns true if the first segment has always lower value than the second one. Does not consider time overlapping.

public bool IsCertainlyBelow(Segment segment)

Parameters

segment Segment

Returns

Boolean

Addition(Element)

Sums the Segment with an overlapping Element.

public Element Addition(Element element)

Parameters

element Element

Returns

Element
The element resulting from the sum.

Exceptions

ArgumentException
Thrown if the segment and the element do not overlap.

Addition(Segment, Point)

Sums a Segment with an overlapping Point.

public static Point Addition(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Point
The point resulting from the sum.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Addition(Point)

Sums the Segment with an overlapping Point.

public Point Addition(Point point)

Parameters

point Point

Returns

Point
The point resulting from the sum.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Addition(Segment, Segment)

Sums two Segments over their overlapping part.

public static Segment Addition(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Segment
A segment representing the sum.

Exceptions

ArgumentException
Thrown if there is no overlap between the segments.

Addition(Segment)

Sums two Segments over their overlapping part.

public Segment Addition(Segment segment)

Parameters

segment Segment

Returns

Segment
A segment representing the sum.

Exceptions

ArgumentException
Thrown if there is no overlap between the segments.

Subtraction(Element)

Subtracts the Segment with an overlapping Element.

note

The operation does not enforce non-negative values.

public Element Subtraction(Element element)

Parameters

element Element

Returns

Element
The element resulting from the subtraction.

Exceptions

ArgumentException
Thrown if the segment and the element do not overlap.

Subtraction(Segment, Point)

Subtracts a Segment with an overlapping Point.

note

The operation does not enforce non-negative values.

public static Point Subtraction(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Point
The point resulting from the subtraction.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Subtraction(Point)

Subtracts the Segment with an overlapping Point.

note

The operation does not enforce non-negative values.

public Point Subtraction(Point point)

Parameters

point Point

Returns

Point
The point resulting from the subtraction.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Subtraction(Segment, Segment)

Subtracts two Segments over their overlapping part.

note

The operation does not enforce non-negative values.

public static Segment Subtraction(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

Segment
A segment representing the subtraction.

Exceptions

ArgumentException
Thrown if there is no overlap between the segments.

Subtraction(Segment)

Subtracts two Segments over their overlapping part.

note

The operation does not enforce non-negative values.

public Segment Subtraction(Segment segment)

Parameters

segment Segment

Returns

Segment
A segment representing the subtraction.

Exceptions

ArgumentException
Thrown if there is no overlap between the segments.

Minimum(Element)

Computes the minimum of the Segment and the given Element over their overlapping part. The result is either a point, a segment or a segment-point-segment sequence.

public List<Element> Minimum(Element element)

Parameters

element Element

Returns

List<Element>
The set of s resulting from the minimum.

Minimum(Segment, Point)

Computes the minimum of a Segment and a Point over their overlapping part.

public static Point Minimum(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Point
The point resulting from the minimum.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Minimum(Point)

Computes the minimum of the Segment and a Point over their overlapping part.

public Point Minimum(Point point)

Parameters

point Point
Second operand

Returns

Point
The point resulting from the minimum

Exceptions

ArgumentException
Thrown if point and segment do not overlap

Minimum(Segment, Segment)

Computes the minimum of two Segments over their overlapping part. The result is either a segment or, if the segments intersect, a segment-point-segment sequence.

public static List<Element> Minimum(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

List<Element>
The set of s resulting from the minimum.

Exceptions

ArgumentException
Thrown if the segments do not overlap.

Minimum(Segment)

Computes the minimum of two Segments over their overlapping part. The result is either a segment or, if the segments intersect, a segment-point-segment sequence.

public List<Element> Minimum(Segment segment)

Parameters

segment Segment

Returns

List<Element>
The set of s resulting from the minimum

Exceptions

ArgumentException
Thrown if the segments do not overlap

Minimum(IReadOnlyList<Segment>)

Computes the minimum of a set of segments over their overlapping part.

public static List<Element> Minimum(IReadOnlyList<Segment> segments)

Parameters

segments IReadOnlyList<Segment>
Segments of which the minimum has to be computed.

Returns

List<Element>
The result of the overall minimum.

Exceptions

ArgumentException
Thrown if the segments do not overlap.

InvalidOperationException
Thrown if the set of segments is empty.

Maximum(Element)

Computes the maximum of the Segment and the given Element over their overlapping part. The result is either a point, a segment or a segment-point-segment sequence.

public List<Element> Maximum(Element element)

Parameters

element Element

Returns

List<Element>
The set of s resulting from the maximum.

Maximum(Segment, Point)

Computes the maximum of a Segment and a Point over their overlapping part.

public static Point Maximum(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Point
The point resulting from the maximum.

Exceptions

ArgumentException
Thrown if point and segment do not overlap.

Maximum(Point)

Computes the maximum of the Segment and a Point over their overlapping part.

public Point Maximum(Point point)

Parameters

point Point
Second operand

Returns

Point
The point resulting from the maximum

Exceptions

ArgumentException
Thrown if point and segment do not overlap

Maximum(Segment, Segment)

Computes the maximum of two Segments over their overlapping part. The result is either a segment or, if the segments intersect, a segment-point-segment sequence.

public static List<Element> Maximum(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

List<Element>
The set of s resulting from the maximum.

Exceptions

ArgumentException
Thrown if the segments do not overlap.

Maximum(Segment)

Computes the maximum of two Segments over their overlapping part. The result is either a segment or, if the segments intersect, a segment-point-segment sequence.

public List<Element> Maximum(Segment segment)

Parameters

segment Segment

Returns

List<Element>
The set of s resulting from the maximum

Exceptions

ArgumentException
Thrown if the segments do not overlap

Maximum(IReadOnlyList<Segment>)

Computes the maximum of a set of segments over their overlapping part.

public static List<Element> Maximum(IReadOnlyList<Segment> segments)

Parameters

segments IReadOnlyList<Segment>
Segments of which the maximum has to be computed.

Returns

List<Element>
The result of the overall maximum.

Exceptions

ArgumentException
Thrown if the segments do not overlap.

InvalidOperationException
Thrown if the set of segments is empty.

Convolution(Element, Nullable<Rational>, Nullable<Rational>)

Computes the convolution between the Segment and the given Element.

public IEnumerable<Element> Convolution(Element element, Nullable<Rational> cutEnd, Nullable<Rational> cutCeiling)

Parameters

element Element

cutEnd Nullable<Rational>

cutCeiling Nullable<Rational>

Returns

IEnumerable<Element>
The set of s resulting from the convolution.

Convolution(Segment, Point)

Computes the convolution between a Segment and a Point.

note

Defined in [BT08] Section 3.2.1, Lemma 3

public static Segment Convolution(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Segment
The resulting from the convolution.

Convolution(Point)

Computes the convolution between the Segment and a Point.

note

Defined in [BT08] Section 3.2.1, Lemma 3

public Segment Convolution(Point point)

Parameters

point Point

Returns

Segment
The resulting from the convolution.

Convolution(Segment, Segment)

Computes the convolution between two Segments.

note

Defined in [BT08] Section 3.2.1, Lemma 4

public static IEnumerable<Element> Convolution(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

IEnumerable<Element>
The set of s resulting from the convolution.

Convolution(Segment)

Computes the convolution between two Segments.

note

Defined in [BT08] Section 3.2.1, Lemma 4

public IEnumerable<Element> Convolution(Segment segment)

Parameters

segment Segment

Returns

IEnumerable<Element>
The set of s resulting from the convolution.

Deconvolution(Element)

Computes the deconvolution between the Segment and the given Element.

public IEnumerable<Element> Deconvolution(Element element)

Parameters

element Element

Returns

IEnumerable<Element>
The set of s resulting from the deconvolution.

Deconvolution(Segment, Point)

Computes the deconvolution between a Segment and a Point.

note

Defined in [BT08] Section 3.2.2, Lemma 6

public static Segment Deconvolution(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Segment
The resulting from the deconvolution.

Deconvolution(Point)

Computes the deconvolution between the Segment and a Point.

note

Defined in [BT08] Section 3.2.2, Lemma 6

public Segment Deconvolution(Point point)

Parameters

point Point

Returns

Segment
The resulting from the deconvolution.

Deconvolution(Segment, Segment)

Computes the deconvolution between two Segments.

note

Defined in [BT08] Section 3.2.2, Lemma 8

public static IEnumerable<Element> Deconvolution(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

IEnumerable<Element>
The set of s resulting from the deconvolution.

Deconvolution(Segment)

Computes the deconvolution between two Segments.

note

Defined in [BT08] Section 3.2.2, Lemma 8

public IEnumerable<Element> Deconvolution(Segment segment)

Parameters

segment Segment

Returns

IEnumerable<Element>
The set of s resulting from the deconvolution.

MaxPlusConvolution(Element, Nullable<Rational>)

Computes the max-plus convolution between the Segment and the given Element.

public IEnumerable<Element> MaxPlusConvolution(Element element, Nullable<Rational> cutEnd)

Parameters

element Element

cutEnd Nullable<Rational>

Returns

IEnumerable<Element>
The set of s resulting from the max-plus convolution.

MaxPlusConvolution(Segment, Point)

Computes the max-plus convolution between a Segment and a Point.

note

Adapted from the min-plus convolution algorithm described in [BT08] Section 3.2.1, Lemma 3

public static Segment MaxPlusConvolution(Segment segment, Point point)

Parameters

segment Segment

point Point

Returns

Segment
The resulting from the max-plus convolution.

MaxPlusConvolution(Point)

Computes the max-plus convolution between the Segment and a Point.

note

Adapted from the min-plus convolution algorithm described in [BT08] Section 3.2.1, Lemma 3

public Segment MaxPlusConvolution(Point point)

Parameters

point Point

Returns

Segment
The resulting from the max-plus convolution.

MaxPlusConvolution(Segment, Segment)

Computes the max-plus convolution between two Segments.

note

Adapted from the min-plus convolution algorithm described in [BT08] Section 3.2.1, Lemma 4

public static IEnumerable<Element> MaxPlusConvolution(Segment a, Segment b)

Parameters

a Segment

b Segment

Returns

IEnumerable<Element>
The set of s resulting from the max-plus convolution.

MaxPlusConvolution(Segment)

Computes the max-plus convolution between two Segments.

note

Adapted from the min-plus convolution algorithm described in [BT08] Section 3.2.1, Lemma 4

public IEnumerable<Element> MaxPlusConvolution(Segment segment)

Parameters

segment Segment

Returns

IEnumerable<Element>
The set of s resulting from the max-plus convolution.

SubAdditiveClosure(ComputationSettings)

Computes the sub-additive closure of the segment.

note

Described in [BT07] Section 4.6 as algorithm 10

public SubAdditiveCurve SubAdditiveClosure(ComputationSettings settings)

Parameters

settings ComputationSettings

Returns

SubAdditiveCurve
The result of the sub-additive closure.

SubAdditiveClosure(Rational, Rational, ComputationSettings)

Computes the sub-additive closure of the pseudo-periodic segment.

note

Described in [BT07] Section 4.6 as algorithm 11

public SubAdditiveCurve SubAdditiveClosure(Rational pseudoPeriodLength, Rational pseudoPeriodHeight, ComputationSettings settings)

Parameters

pseudoPeriodLength Rational
Length of the pseudo-period.

pseudoPeriodHeight Rational
Step gained after each pseudo-period.

settings ComputationSettings

Returns

SubAdditiveCurve