Skip to main content

Element

Smallest unit of representation of a min-plus algebra function. Can be either a Point or a Segment.

public abstract class Element : IToCodeString, Unipi.Nancy.Utility.IStableHashCode

Inheritance ObjectElement
Implements IToCodeString, IStableHashCode

Properties

Type

Type identification property for JSON (de)serialization.

public abstract string Type { get; }

Property Value

String

StartTime

Left endpoint of the support of the element. If the element is a Segment, it is exclusive and strictly lower than EndTime. If the element is a Point, it is inclusive and equal to EndTime.

public abstract Rational StartTime { get; }

Property Value

Rational

EndTime

Right endpoint of the support of the element. If the element is a Segment, it is exclusive and strictly greater than StartTime. If the element is a Point, it is inclusive and equal to StartTime.

public abstract Rational EndTime { 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

IsInfinite

True if the element has plus/minus infinite value.

public abstract bool IsInfinite { get; }

Property Value

Boolean

IsPlusInfinite

True if the element has plus infinite value.

public abstract bool IsPlusInfinite { get; }

Property Value

Boolean

IsMinusInfinite

True if the element has minus infinite value.

public abstract bool IsMinusInfinite { get; }

Property Value

Boolean

IsFinite

True if the element has finite value.

public bool IsFinite { get; }

Property Value

Boolean

IsZero

True if the element has 0 value. If the element is a Segment, this must be true for all its support.

public abstract bool IsZero { get; }

Property Value

Boolean

Methods

ValueAt(Rational)

Computes the value of the element at the given time.

public abstract Rational ValueAt(Rational time)

Parameters

time Rational
The time of sampling.

Returns

Rational
Value of the element at the given time or ++\infty if outside definition bounds.

IsDefinedFor(Rational)

True if given time is between the element's definition bounds.

public abstract bool IsDefinedFor(Rational time)

Parameters

time Rational

Returns

Boolean

ToString()

Returns string serialization in Json format.

public string ToString()

Returns

String

FromJson(String)

Deserializes an Element.

public static Element FromJson(string json)

Parameters

json String

Returns

Element

ToCodeString(Boolean, Int32)

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

public abstract string ToCodeString(bool formatted, int indentation)

Parameters

formatted Boolean

indentation Int32

Returns

String

GetStableHashCode()

A stable hashcode.

public abstract int GetStableHashCode()

Returns

Int32

Scale(Rational)

Scales the element by a multiplicative factor.

public abstract Element Scale(Rational scaling)

Parameters

scaling Rational

Returns

Element

Delay(Rational)

Translates forwards the support by the given time quantity.

public abstract Element Delay(Rational delay)

Parameters

delay Rational

Returns

Element

Anticipate(Rational)

Translates backwards the support by the given time quantity.

public abstract Element Anticipate(Rational time)

Parameters

time Rational

Returns

Element

VerticalShift(Rational)

Shifts the element vertically by an additive factor.

public abstract Element VerticalShift(Rational shift)

Parameters

shift Rational

Returns

Element

Negate()

Returns the opposite element, g(t)=f(t)g(t) = -f(t).

public abstract Element Negate()

Returns

Element

Inverse()

Compute the inverse function, f1(x)=inft:f(t)=xf^{-1}(x) = inf { t : f(t) = x }

public abstract Element Inverse()

Returns

Element

Exceptions

InvalidOperationException

        If the element is non-bijective, i.e. a constant segment.

Addition(Element)

Sums two elements over their overlapping part.

public abstract Element Addition(Element element)

Parameters

element Element
Second operand.

Returns

Element
The element resulting from the sum.

Exceptions

ArgumentException
Thown if the two elements do not overlap.

Addition(Element, Element)

Sums two elements over their overlapping part.

public static Element Addition(Element a, Element b)

Parameters

a Element

b Element

Returns

Element
The element resulting from the sum.

Exceptions

ArgumentException
Thown if the two elements do not overlap.

Addition(IEnumerable<Element>)

Sums a set of elements over their overlapping part.

public static Element Addition(IEnumerable<Element> elements)

Parameters

elements IEnumerable<Element>
The elements to be summed.

Returns

Element
The result of the overall sum.

Exceptions

ArgumentException
Thrown if the elements do not overlap.

InvalidOperationException
Thrown if the set of elements is empty.

Subtraction(Element)

Subtracts two elements over their overlapping part.

note

The operation does not enforce non-negative values.

public abstract Element Subtraction(Element element)

Parameters

element Element
Second operand.

Returns

Element
The element resulting from the subtraction.

Exceptions

ArgumentException
Thown if the two elements do not overlap.

Subtraction(Element, Element)

Subtracts two elements over their overlapping part.

note

The operation does not enforce non-negative values.

public static Element Subtraction(Element a, Element b)

Parameters

a Element

b Element

Returns

Element
The element resulting from the subtraction.

Exceptions

ArgumentException
Thown if the two elements do not overlap.

Subtraction(IEnumerable<Element>)

Subtracts a set of elements over their overlapping part.

note

The operation does not enforce non-negative values. As subtraction is not commutative, beware of the order of the operands.

public static Element Subtraction(IEnumerable<Element> elements)

Parameters

elements IEnumerable<Element>
The elements to be summed.

Returns

Element
The result of the overall subtraction.

Exceptions

ArgumentException
Thrown if the elements do not overlap.

InvalidOperationException
Thrown if the set of elements is empty.

Minimum(Element)

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

public abstract List<Element> Minimum(Element element)

Parameters

element Element
Second operand.

Returns

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

Minimum(Element, Element)

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

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

Parameters

a Element

b Element

Returns

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

Minimum(IReadOnlyList<Element>)

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

public static List<Element> Minimum(IReadOnlyList<Element> elements)

Parameters

elements IReadOnlyList<Element>
Elements of which the minimum has to be computed.

Returns

List<Element>
The result of the overall minimum.

Exceptions

ArgumentException
Thrown if the elements do not overlap.

InvalidOperationException
Thrown if the set of elements is empty.

Maximum(Element)

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

public abstract List<Element> Maximum(Element element)

Parameters

element Element
Second operand.

Returns

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

Maximum(Element, Element)

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

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

Parameters

a Element

b Element

Returns

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

Maximum(IReadOnlyList<Element>)

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

public static List<Element> Maximum(IReadOnlyList<Element> elements)

Parameters

elements IReadOnlyList<Element>
Elements of which the maximum has to be computed.

Returns

List<Element>
The result of the overall maximum.

Exceptions

ArgumentException
Thrown if the elements do not overlap.

InvalidOperationException
Thrown if the set of elements is empty.

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

Computes the convolution between two Elements.

note

Described in [BT08] Section 3.2.1

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

Parameters

element Element
Second operand.

cutEnd Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

cutCeiling Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

Returns

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

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

Computes the convolution between two Elements.

note

Described in [BT08] Section 3.2.1

public static IEnumerable<Element> Convolution(Element a, Element b, Nullable<Rational> cutEnd, Nullable<Rational> cutCeiling)

Parameters

a Element
First operand.

b Element
Second operand.

cutEnd Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

cutCeiling Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

Returns

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

Deconvolution(Element)

Computes the deconvolution between two Elements.

note

Described in [BT08] Section 3.2.2

public abstract IEnumerable<Element> Deconvolution(Element element)

Parameters

element Element

Returns

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

Deconvolution(Element, Element)

Computes the deconvolution between two Elements.

note

Described in [BT08] Section 3.2.2

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

Parameters

a Element

b Element

Returns

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

MaxPlusConvolution(Element, Nullable<Rational>)

Computes the max-plus convolution between two Elements.

note

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

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

Parameters

element Element
Second operand.

cutEnd Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

Returns

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

MaxPlusConvolution(Element, Element, Nullable<Rational>)

Computes the max-plus convolution between two Elements.

note

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

public static IEnumerable<Element> MaxPlusConvolution(Element a, Element b, Nullable<Rational> cutEnd)

Parameters

a Element
First operand.

b Element
Second operand.

cutEnd Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.

Returns

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

SubAdditiveClosure(ComputationSettings)

Computes the sub-additive closure of the element.

public abstract SubAdditiveCurve SubAdditiveClosure(ComputationSettings settings)

Parameters

settings ComputationSettings

Returns

SubAdditiveCurve

SubAdditiveClosure(Rational, Rational, ComputationSettings)

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

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

Parameters

pseudoPeriodLength Rational
Lenght of the pseudo-period

pseudoPeriodHeight Rational
Step gained after each pseudo-period

settings ComputationSettings

Returns

SubAdditiveCurve

Exceptions

ArgumentException
Thrown if the period is not greater than 0