Curve
Class of functions on which NetCal operators are defined. They are piecewise affine and ultimately pseudo-periodic. Pseudo-periodic means that , where is the step gained after each pseudo-period. Ultimately means that the function has such property for .
Implementation of data structure described in [BT08] Section 4.1
public class Curve : IToCodeString, Unipi.Nancy.Utility.IStableHashCode
Inheritance Object → Curve
Implements IToCodeString, IStableHashCode
Properties
PseudoPeriodStart
Point in time after which the curve has a pseudo-periodic behavior.
Referred to as or Rank in [BT08] Section 4.1
public Rational PseudoPeriodStart { get; set; }
Property Value
PseudoPeriodLength
Time length of each pseudo-period.
Referred to as in [BT08] Section 4.1
public Rational PseudoPeriodLength { get; set; }
Property Value
PseudoPeriodHeight
Static value gain applied after each pseudo-period. If it's 0, the curve is truly periodic.
Referred to as in [BT08] Section 4.1
public Rational PseudoPeriodHeight { get; set; }
Property Value
PseudoPeriodSlope
Average slope of curve in pseudo-periodic behavior. If it's 0, the curve is truly periodic.
public Rational PseudoPeriodSlope { get; }
Property Value
FirstPseudoPeriodEnd
End time of the first pseudo period.
public Rational FirstPseudoPeriodEnd { get; }
Property Value
SecondPseudoPeriodEnd
End time of the second pseudo period.
public Rational SecondPseudoPeriodEnd { get; }
Property Value
BaseSequence
Sequence describing behavior of the curve in . Combined with the UPP property, this is also allows to derive for any .
Referred to as in [BT08] Section 4.1
public Sequence BaseSequence { get; set; }
Property Value
IsFinite
True if the curve has finite value for any .
public bool IsFinite { get; }
Property Value
FirstFiniteTime
The first instant around which the curve is not infinite. Does not specify whether it's inclusive or not, i.e. if is finite.
public Rational FirstFiniteTime { get; }
Property Value
FirstFiniteTimeExceptOrigin
The first instant around which the curve is not infinite, excluding the origin point. Does not specify whether it's inclusive or not, i.e. if is finite.
public Rational FirstFiniteTimeExceptOrigin { get; }
Property Value
FirstNonZeroTime
The first instant around which the curve is not 0. Does not specify whether it's inclusive or not, i.e. if .
public Rational FirstNonZeroTime { get; }
Property Value
PseudoPeriodStartInfimum
Returns the minimum such that for all . It is the infimum of all valid PseudoPeriodStart, i.e. .
public Rational PseudoPeriodStartInfimum { get; }
Property Value
IsZero
True if the curve is 0 for all .
public bool IsZero { get; }
Property Value
IsPlusInfinite
True if the curve has value for any .
public bool IsPlusInfinite { get; }
Property Value
IsMinusInfinite
True if the curve has value for any .
public bool IsMinusInfinite { get; }
Property Value
IsContinuous
True if there is no infinite value or discontinuity within the curve.
public bool IsContinuous { get; }
Property Value
IsContinuousExceptOrigin
True if there is no discontinuity within the curve, except at most in origin.
public bool IsContinuousExceptOrigin { get; }
Property Value
IsLeftContinuous
True if there is no left-discontinuity within the curve.
public bool IsLeftContinuous { get; }
Property Value
IsRightContinuous
True if there is no right-discontinuity within the curve.
public bool IsRightContinuous { get; }
Property Value
IsNonNegative
True if the curve is non-negative, i.e. for any .
public bool IsNonNegative { get; }
Property Value
FirstNonNegativeTime
The first instant around which the curve is non-negative. Does not specify whether it's inclusive or not, i.e. if .
public Rational FirstNonNegativeTime { get; }
Property Value
IsNonDecreasing
True if for any , .
public bool IsNonDecreasing { get; }
Property Value
IsUltimatelyFinite
True if for all PseudoPeriodStart the curve is finite.
This property does not check if PseudoPeriodStart is either infinite, finite or both.
public bool IsUltimatelyFinite { get; }
Property Value
IsUltimatelyInfinite
True if, for and some , for all .
public bool IsUltimatelyInfinite { get; }
Property Value
IsUltimatelyPlain
True if for all PseudoPeriodStart the curve is either always finite or always infinite.
Defined in [BT08], Definition 1.
public bool IsUltimatelyPlain { get; }
Property Value
IsPlain
True if is plain, i.e., it is either a) always finite, b) always plus or minus infinite (without changing sign), or c) finite up to a , then always plus or minus infinite (without changing sign)
Formally defined in [BT08], Definition 1.
public bool IsPlain { get; }
Property Value
IsUltimatelyAffine
True if for all PseudoPeriodStart the curve is affine.
public bool IsUltimatelyAffine { get; }
Property Value
IsUltimatelyConstant
True if for PseudoPeriodStart the curve is constant.
public bool IsUltimatelyConstant { get; }
Property Value
IsSubAdditive
True if the curve is sub-additive, i.e. .
Based on [Zippo23] Lemma 9.3: is sub-additive , where is defined in WithZeroOrigin(). Can be computationally expensive the first time it is invoked, the result is cached afterwards.
public bool IsSubAdditive { get; }
Property Value
IsRegularSubAdditive
True if the curve is sub-additive with .
public bool IsRegularSubAdditive { get; }
Property Value
IsSuperAdditive
True if the curve is super-additive, i.e. .
Based on [Zippo23] Lemma 9.4: is super-additive , where is defined in WithZeroOrigin(). Can be computationally expensive the first time it is invoked, the result is cached afterwards.
public bool IsSuperAdditive { get; }
Property Value
IsRegularSuperAdditive
True if the curve is super-additive with .
public bool IsRegularSuperAdditive { get; }
Property Value
IsConcave
Tests if the curve is concave, i.e. for any two points the straight line joining them is below .
The property is checked via the following property: is concave a) is continuous, or it is continuous for and , and b) is composed of segments with decreasing slopes.
public bool IsConcave { get; }
Property Value
IsRegularConcave
Tests if the curve is concave with .
public bool IsRegularConcave { get; }
Property Value
IsConvex
Tests if the curve is convex, i.e. for any two points the straight line joining them is above .
The property is checked via the following property: is convex a) is continuous, or it is continuous for and , and b) is composed of segments with increasing slopes.
public bool IsConvex { get; }
Property Value
IsRegularConvex
Tests if the curve is convex with .
public bool IsRegularConvex { get; }
Property Value
HasTransient
True if pseudo-periodic behavior starts at .
public bool HasTransient { get; }
Property Value
TransientSequence
Sequence describing the curve in , before pseudo-periodic behavior.
public Sequence TransientSequence { get; }
Property Value
TransientElements
Elements describing the curve from , before pseudo-periodic behavior.
Referred to as in [BT08] Section 4.1
public IEnumerable<Element> TransientElements { get; }
Property Value
PseudoPeriodicSequence
Sequence describing the pseudo-periodic behavior of the curve in .
public Sequence PseudoPeriodicSequence { get; }
Property Value
PseudoPeriodicElements
Elements describing the pseudo-periodic behavior of the curve in .
Referred to as in [BT08] Section 4.1
public IEnumerable<Element> PseudoPeriodicElements { get; }
Property Value
Constructors
Curve(Sequence, Rational, Rational, Rational)
Constructor.
public Curve(Sequence baseSequence, Rational pseudoPeriodStart, Rational pseudoPeriodLength, Rational pseudoPeriodHeight)
Parameters
baseSequence
Sequence
Describes the curve in .
pseudoPeriodStart
Rational
Time from which the curve is pseudo-periodic, .
pseudoPeriodLength
Rational
Length of each pseudo-period, .
pseudoPeriodHeight
Rational
Height gained after each pseudo-period, .
Curve(Sequence, Rational, Rational, Rational, Boolean)
Constructor.
public Curve(Sequence baseSequence, Rational pseudoPeriodStart, Rational pseudoPeriodLength, Rational pseudoPeriodHeight, bool isPartialCurve)
Parameters
baseSequence
Sequence
Describes the curve in .
pseudoPeriodStart
Rational
Time from which the curve is pseudo-periodic, .
pseudoPeriodLength
Rational
Length of each pseudo-period, .
pseudoPeriodHeight
Rational
Height gained after each pseudo-period, .
isPartialCurve
Boolean
True if the curve is partially described, and should be filled by pre- and post-pending to BaseSequence.
Curve(Curve)
Copy constructor.
public Curve(Curve other)
Parameters
other
Curve
The Curve object to copy from.
Methods
IsContinuousAt(Rational)
True if the curve is continuous at time
.
public bool IsContinuousAt(Rational time)
Parameters
time
Rational
Returns
IsLeftContinuousAt(Rational)
True if the curve is continuous at time
.
public bool IsLeftContinuousAt(Rational time)
Parameters
time
Rational
Returns
IsRightContinuousAt(Rational)
True if the curve is continuous at time
.
public bool IsRightContinuousAt(Rational time)
Parameters
time
Rational
Returns
IsNonNegativeOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
True if the curve is non-negative over the given interval, i.e. i.e. for any in the given interval.
public bool IsNonNegativeOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If an invalid interval is given.
IsNonDecreasingOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
True if for any pair in the given interval, , .
public bool IsNonDecreasingOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If an invalid interval is given.
IsLeftContinuousOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
True if for any interior (from the left) to the given interval, .
See [Zippo23] Definition 14.4
public bool IsLeftContinuousOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If an invalid interval is given.
IsRightContinuousOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
True if for any interior (from the right) to the given interval, .
See [Zippo23] Definition 14.5
public bool IsRightContinuousOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If an invalid interval is given.
PlusInfinite()
Constructs a curve that is equal to over any .
public static Curve PlusInfinite()
Returns
MinusInfinite()
Constructs a curve that is equal to over any .
public static Curve MinusInfinite()
Returns
Zero()
Constructs a curve that is equal to 0 over any .
public static Curve Zero()
Returns
Equals(Object)
public bool Equals(object obj)
Parameters
obj
Object
Returns
GetHashCode()
public int GetHashCode()
Returns
GetStableHashCode()
A stable hashcode.
public int GetStableHashCode()
Returns
Equivalent(Curve, ComputationSettings)
True if the curves represent the same function.
public bool Equivalent(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
Equivalent(Curve, Curve, ComputationSettings)
True if the curves represent the same function.
public static bool Equivalent(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
b
Curve
settings
ComputationSettings
Returns
Equivalent(IEnumerable<Curve>, ComputationSettings)
True if all the curves in the set represent the same function.
public static bool Equivalent(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
settings
ComputationSettings
Returns
Exceptions
EquivalentAfter(Curve, Curve, Rational, Boolean, ComputationSettings)
True if, starting from time
, the curves represent the same function.
public static bool EquivalentAfter(Curve a, Curve b, Rational time, bool isStartIncluded, ComputationSettings settings)
Parameters
a
Curve
b
Curve
time
Rational
isStartIncluded
Boolean
If true, time
is included in the comparison.
settings
ComputationSettings
Returns
FindFirstInequivalence(Curve, Curve, ComputationSettings)
Returns the first time around which the functions represented by the curves differ. Returns null if the two curves represent the same function. Mostly useful to debug curves that should be equivalent.
public static Nullable<Rational> FindFirstInequivalence(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
b
Curve
settings
ComputationSettings
Returns
FindFirstInequivalenceAfter(Curve, Curve, Rational, Boolean, ComputationSettings)
Returns the first time around which the functions represented by the curves differ. Returns null if the two curves represent the same function. Mostly useful to debug curves that should be equivalent.
public static Nullable<Rational> FindFirstInequivalenceAfter(Curve a, Curve b, Rational time, bool isStartIncluded, ComputationSettings settings)
Parameters
a
Curve
b
Curve
time
Rational
isStartIncluded
Boolean
If true, time
is included in the comparison.
settings
ComputationSettings
Returns
EquivalentExceptOrigin(Curve, ComputationSettings)
True if the curves represent the same function, except for origin.
public bool EquivalentExceptOrigin(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
EquivalentExceptOrigin(Curve, Curve, ComputationSettings)
True if the curves represent the same function, except for origin.
public static bool EquivalentExceptOrigin(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
b
Curve
settings
ComputationSettings
Returns
Dominance(Curve, Curve, ComputationSettings)
Checks if there is dominance between the curves given and, if so, returns their order.
If there is no dominance, the ordering has no actual meaning
public static ValueTuple<bool, Curve, Curve> Dominance(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
b
Curve
settings
ComputationSettings
Returns
ValueTuple<Boolean, Curve, Curve>
AsymptoticDominance(Curve, Curve, ComputationSettings)
Checks if there is asymptotic dominance between the curves given and, if so, returns their order.
If there is no dominance, the ordering has no actual meaning
public static ValueTuple<bool, Curve, Curve> AsymptoticDominance(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
b
Curve
settings
ComputationSettings
Returns
ValueTuple<Boolean, Curve, Curve>
Negate()
Returns the opposite function, .
public Curve Negate()
Returns
ValueAt(Rational, ComputationSettings)
Computes the value of the curve at given time .
public Rational ValueAt(Rational time, ComputationSettings settings)
Parameters
time
Rational
The time of sampling.
settings
ComputationSettings
Returns
Rational
The value of .
RightLimitAt(Rational)
Computes the right limit of the curve at given time .
public Rational RightLimitAt(Rational time)
Parameters
time
Rational
The target time of the limit.
Returns
Rational
The value of .
LeftLimitAt(Rational)
Computes the left limit of the curve at given time .
public Rational LeftLimitAt(Rational time)
Parameters
time
Rational
The target time of the limit.
Returns
Rational
The value of .
Exceptions
ArgumentException
The argument is 0, as a curve is not defined for .
GetElementAt(Rational, ComputationSettings)
Returns the Element that describes the curve in time t.
public Element GetElementAt(Rational time, ComputationSettings settings)
Parameters
time
Rational
Time t of the sample.
settings
ComputationSettings
Returns
Element
The element describing the curve at time t.
Exceptions
ArgumentException
Thrown if t is less than 0.
GetSegmentBefore(Rational)
Returns the Segment that describes the curve before time t.
public Segment GetSegmentBefore(Rational time)
Parameters
time
Rational
Time t of the sample.
Returns
Segment
The describing the curve before time t, or null if there is none.
Exceptions
ArgumentException
Thrown if time 0 is given, as a curve is not defined before 0.
GetSegmentAfter(Rational, Boolean)
Returns the Segment that describes the curve after time .
public Segment GetSegmentAfter(Rational time, bool autoMerge)
Parameters
time
Rational
Time t of the sample.
autoMerge
Boolean
If true, it seeks for possible merges to return the longest finite-length segment, i.e., such that either is not differentiable at its end time or the segment length extends to .
Returns
Segment
The describing the curve after time t.
Match(Element, ComputationSettings)
True if the given element matches, in its support, with the curve.
public bool Match(Element element, ComputationSettings settings)
Parameters
element
Element
settings
ComputationSettings
Returns
Match(Sequence, ComputationSettings)
True if the given sequence matches, in its interval, with the curve.
public bool Match(Sequence sequence, ComputationSettings settings)
Parameters
sequence
Sequence
settings
ComputationSettings
Returns
CutAsEnumerable(Rational, Rational, Boolean, Boolean, ComputationSettings)
Returns a cut of the curve limited to the given interval.
Optimized for minimal allocations.
public IEnumerable<Element> CutAsEnumerable(Rational cutStart, Rational cutEnd, bool isStartIncluded, bool isEndIncluded, ComputationSettings settings)
Parameters
cutStart
Rational
Left endpoint of the interval.
cutEnd
Rational
Right endpoint of the interval.
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed.
settings
ComputationSettings
Returns
IEnumerable<Element>
A list of elements equivalently defined within the given interval.
Cut(Rational, Rational, Boolean, Boolean, ComputationSettings)
Returns a cut of the curve limited to the given interval.
public Sequence Cut(Rational cutStart, Rational cutEnd, bool isStartIncluded, bool isEndIncluded, ComputationSettings settings)
Parameters
cutStart
Rational
Left endpoint of the interval.
cutEnd
Rational
Right endpoint of the interval.
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed.
settings
ComputationSettings
Returns
Sequence
A sequence equivalently defined within the given interval.
Extend(Rational, ComputationSettings)
Generates an extended view on the curve, describing it in .
This is a shorthand for Cut(Rational, Rational, Boolean, Boolean, ComputationSettings) which follows, minus the restrictions, the definition in [BT08] Section 4.1
public Sequence Extend(Rational targetEnd, ComputationSettings settings)
Parameters
targetEnd
Rational
Exclusive end of the resulting Sequence. It is not required to be greater than FirstPseudoPeriodEnd.
settings
ComputationSettings
Returns
Sequence
A sequence equivalently defined from 0 to .
Count(Rational, Rational, Boolean, Boolean)
Returns the number of elements of a cut of the curve limited to the given interval.
public int Count(Rational cutStart, Rational cutEnd, bool isStartIncluded, bool isEndIncluded)
Parameters
cutStart
Rational
Left endpoint of the interval.
cutEnd
Rational
Right endpoint of the interval.
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed.
Returns
Int32
The number of elements of the sequence equivalently defined within the given interval.
TimeAt(Rational)
Computes the first time the curve is at or above given value
,
i.e.,
The current implementation uses ToUpperNonDecreasing() and LowerPseudoInverse(). Thus it is useful as a shortcut but not to optimize computation of for a single point.
public Rational TimeAt(Rational value)
Parameters
value
Rational
The value to reach.
Returns
Rational
The first time t at which = value, or if it is never reached.
Decompose(Nullable<Rational>, Boolean, Boolean)
Splits the curve into two, and ,
so that (if minDecomposition
is true)
or (if minDecomposition
is false).
public ValueTuple<Curve, Curve> Decompose(Nullable<Rational> splitTime, bool leftIncludesEndPoint, bool minDecomposition)
Parameters
splitTime
Nullable<Rational>
Time at which to split the curve. Defaults to PseudoPeriodStart.
leftIncludesEndPoint
Boolean
If true, and splitTime
is , the support of will be .
If false, it will be .
minDecomposition
Boolean
If true (default), the parts have value outside their support, i.e., they can be recomposed by computing their minimum. Conversely, if false the parts have value outside their support, i.e., they can be recomposed by computing their maximum.
Returns
ValueTuple<Curve, Curve>
A tuple containing the two parts. If is 0, the left part will be null.
Exceptions
ArgumentException
If is .
ToString()
Returns string serialization in Json format.
public string ToString()
Returns
FromJson(String)
Deserializes a Curve.
public static Curve FromJson(string json)
Parameters
json
String
Returns
ToCodeString(Boolean, Int32)
Returns a string containing C# code to create this Curve. 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
Scale(Rational)
Scales the curve by a multiplicative factor, i.e. .
public Curve Scale(Rational scaling)
Parameters
scaling
Rational
Returns
DelayBy(Rational)
Delays the curve, adding a 0-valued padding at the start.
public Curve DelayBy(Rational delay)
Parameters
delay
Rational
Returns
AnticipateBy(Rational)
Anticipates the curve, removing the parts from 0 to the given time.
public Curve AnticipateBy(Rational time)
Parameters
time
Rational
Returns
VerticalShift(Rational, Boolean)
Shifts the curve vertically by an additive factor, i.e. .
public Curve VerticalShift(Rational shift, bool exceptOrigin)
Parameters
shift
Rational
exceptOrigin
Boolean
Returns
ToNonNegative()
Computes a non-negative version of this curve, i.e. a curve if , otherwise.
Implements the non-negative closure defined in [DNC18] p. 45 .
public Curve ToNonNegative()
Returns
ToUpperNonDecreasing()
Computes the upper non-decreasing closure of this curve, i.e., the lowest curve so that for any .
This implements the upper non-decreasing closure defined in [DNC18] p. 45, although the implementation differs.
public Curve ToUpperNonDecreasing()
Returns
ToLowerNonDecreasing()
Computes the lower non-decreasing closure of this curve, i.e., the highest curve so that for any .
public Curve ToLowerNonDecreasing()
Returns
ToLeftContinuous()
Computes a left-continuous version of this curve.
public Curve ToLeftContinuous()
Returns
ToRightContinuous()
Computes a right-continuous version of this curve.
public Curve ToRightContinuous()
Returns
WithZeroOrigin()
Enforces , i.e. it returns .
public Curve WithZeroOrigin()
Returns
LowerPseudoInverse()
Computes the lower pseudo-inverse function, .
public Curve LowerPseudoInverse()
Returns
Exceptions
ArgumentException
If the curve is not non-decreasing.
UpperPseudoInverse()
Computes the upper pseudo-inverse function, .
public Curve UpperPseudoInverse()
Returns
Exceptions
ArgumentException
If the curve is not non-decreasing.
LowerPseudoInverseOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
Computes the lower pseudo-inverse function over interval , . The support of the result will be the interval , defined as the smallest interval containing all for . If , the support is extended to start from 0.
Defined and discussed in [ZNS23a].
public Curve LowerPseudoInverseOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If an invalid interval is given.
ArgumentException
If the curve is not non-decreasing or non-negative.
UpperPseudoInverseOverInterval(Rational, Nullable<Rational>, Boolean, Boolean)
Computes the upper pseudo-inverse function over interval , . The support of the result will be the interval , defined as the smallest interval containing all for .
Defined and discussed in [ZNS23a].
public Curve UpperPseudoInverseOverInterval(Rational start, Nullable<Rational> end, bool isStartIncluded, bool isEndIncluded)
Parameters
start
Rational
Start of the interval.
end
Nullable<Rational>
End of the interval. If not specified, it is assumed .
isStartIncluded
Boolean
If true, the interval is left-closed.
isEndIncluded
Boolean
If true, the interval is right-closed. If end
is , it has no effect.
Returns
Exceptions
ArgumentException
If the curve is not non-decreasing or non-negative.
HorizontalDeviation(Curve, Curve, ComputationSettings)
Computes the horizontal deviation between the two curves, .
If a
is an arrival curve and b
a service curve, the result will be the worst-case delay.
public static Rational HorizontalDeviation(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
Must be non-decreasing.
b
Curve
Must be non-decreasing.
settings
ComputationSettings
Returns
Rational
A non-negative horizontal deviation.
VerticalDeviation(Curve, Curve)
Computes the vertical deviation between the two curves, .
If a
is an arrival curve and b
a service curve, the result will be the worst-case backlog.
public static Rational VerticalDeviation(Curve a, Curve b)
Parameters
a
Curve
b
Curve
Returns
Rational
A non-negative vertical deviation.
SupValue()
If the curve is upper-bounded, i.e., exists such that for any , returns . Otherwise, returns .
public Rational SupValue()
Returns
InfValue()
If the curve is lower-bounded, i.e., exists such that for any , returns . Otherwise, returns .
public Rational InfValue()
Returns
Optimize()
Optimizes Curve representation by anticipating periodic start and reducing period length.
This method implements representation minimization, as discussed in [ZS23].
public Curve Optimize()
Returns
Curve
An equivalent minimal representation for the same curve.
Addition(Curve)
Implements (min, +)-algebra addition operation.
Defined in [BT08] Section 4.2
public Curve Addition(Curve b)
Parameters
b
Curve
Second operand.
Returns
Curve
The curve resulting from the sum.
Addition(Curve, Curve)
Implements (min, +)-algebra addition operation.
Defined in [BT08] Section 4.2
public static Curve Addition(Curve a, Curve b)
Parameters
a
Curve
b
Curve
Returns
Curve
The curve resulting from the sum.
Addition(IEnumerable<Curve>, ComputationSettings)
Implements (min, +)-algebra addition operation over a set of curves.
public static Curve Addition(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall addition.
Addition(IReadOnlyCollection<Curve>, ComputationSettings)
Implements (min, +)-algebra addition operation over a set of curves.
public static Curve Addition(IReadOnlyCollection<Curve> curves, ComputationSettings settings)
Parameters
curves
IReadOnlyCollection<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall addition.
Subtraction(Curve, Boolean)
Implements subtraction operation between two curves.
public Curve Subtraction(Curve b, bool nonNegative)
Parameters
b
Curve
Second operand.
nonNegative
Boolean
If true, the result is non-negative.
Returns
Curve
The curve resulting from the subtraction.
Subtraction(Curve, Curve, Boolean)
Implements subtraction operation between two curves.
public static Curve Subtraction(Curve a, Curve b, bool nonNegative)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
nonNegative
Boolean
If true, the result is non-negative.
Returns
Curve
The curve resulting from the subtraction.
IsMinimumUltimatelyPseudoPeriodic(Curve, Curve)
True if is known to be ultimately pseudo-periodic. Tests the sufficient (but not necessary) conditions from [BT08].
If false, the result Minimum(Curve, ComputationSettings) may be invalid.
public static bool IsMinimumUltimatelyPseudoPeriodic(Curve f, Curve g)
Parameters
f
Curve
g
Curve
Returns
Minimum(Curve, ComputationSettings)
Implements (min, +)-algebra minimum operation over two curves.
Defined in [BT08] Section 4.3
public Curve Minimum(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The curve resulting from the minimum.
Minimum(Curve, Curve, ComputationSettings)
Implements (min, +)-algebra minimum operation over two curves.
Defined in [BT08] Section 4.3
public static Curve Minimum(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The curve resulting from the minimum.
Minimum(IReadOnlyCollection<Curve>, ComputationSettings)
Implements (min, +)-algebra minimum operation over a set of curves.
public static Curve Minimum(IReadOnlyCollection<Curve> curves, ComputationSettings settings)
Parameters
curves
IReadOnlyCollection<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall minimum.
Minimum(IEnumerable<Curve>, ComputationSettings)
Implements (min, +)-algebra minimum operation over a set of curves.
public static Curve Minimum(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall minimum.
IsMaximumUltimatelyPseudoPeriodic(Curve, Curve)
True if is known to be ultimately pseudo-periodic. Tests the sufficient (but not necessary) conditions from [BT08].
If false, the result Maximum(Curve, ComputationSettings) may be invalid.
public static bool IsMaximumUltimatelyPseudoPeriodic(Curve f, Curve g)
Parameters
f
Curve
g
Curve
Returns
Maximum(Curve, ComputationSettings)
Implements (max, +)-algebra maximum operation over two curves.
public Curve Maximum(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The curve resulting from the maximum.
Maximum(Curve, Curve, ComputationSettings)
Implements (max, +)-algebra maximum operation over two curves.
public static Curve Maximum(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The curve resulting from the maximum.
Maximum(IReadOnlyCollection<Curve>, ComputationSettings)
Implements (max, +)-algebra maximum operation over a set of curves.
public static Curve Maximum(IReadOnlyCollection<Curve> curves, ComputationSettings settings)
Parameters
curves
IReadOnlyCollection<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall maximum.
Maximum(IEnumerable<Curve>, ComputationSettings)
Implements (max, +)-algebra maximum operation over a set of curves.
public static Curve Maximum(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall maximum.
Minimum(Element, ComputationSettings)
Computes the minimum between the curve and element. The element is considered to have for any outside its support.
public Curve Minimum(Element e, ComputationSettings settings)
Parameters
e
Element
settings
ComputationSettings
Returns
Minimum(Curve, Element, ComputationSettings)
Computes the minimum between the curve and element. The element is considered to have for any outside its support.
public static Curve Minimum(Curve c, Element e, ComputationSettings settings)
Parameters
c
Curve
e
Element
settings
ComputationSettings
Returns
Minimum(Sequence, ComputationSettings)
Computes the minimum between the curve and sequence. The sequence is considered to have for any outside its support.
public Curve Minimum(Sequence s, ComputationSettings settings)
Parameters
s
Sequence
settings
ComputationSettings
Returns
Minimum(Curve, Sequence, ComputationSettings)
Computes the minimum between the curve and sequence. The sequence is considered to have for any outside its support.
public static Curve Minimum(Curve c, Sequence s, ComputationSettings settings)
Parameters
c
Curve
s
Sequence
settings
ComputationSettings
Returns
Maximum(Element, ComputationSettings)
Computes the maximum between the curve and element. The element is considered to have for any outside its support.
public Curve Maximum(Element e, ComputationSettings settings)
Parameters
e
Element
settings
ComputationSettings
Returns
Maximum(Curve, Element, ComputationSettings)
Computes the maximum between the curve and element. The element is considered to have for any outside its support.
public static Curve Maximum(Curve c, Element e, ComputationSettings settings)
Parameters
c
Curve
e
Element
settings
ComputationSettings
Returns
Maximum(Sequence, ComputationSettings)
Computes the maximum between the curve and sequence. The sequence is considered to have for any outside its support.
public Curve Maximum(Sequence s, ComputationSettings settings)
Parameters
s
Sequence
settings
ComputationSettings
Returns
Maximum(Curve, Sequence, ComputationSettings)
Computes the maximum between the curve and sequence. The sequence is considered to have for any outside its support.
public static Curve Maximum(Curve c, Sequence s, ComputationSettings settings)
Parameters
c
Curve
s
Sequence
settings
ComputationSettings
Returns
Convolution(Curve, ComputationSettings)
Computes the convolution of the two curves, .
Described in [BT08] Section 4.4
public Curve Convolution(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
Curve
The curve resulting from the convolution.
Convolution(Curve, Curve, ComputationSettings)
Computes the convolution of the two curves, .
Described in [BT08] Section 4.4
public static Curve Convolution(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The result of the convolution.
Convolution(IReadOnlyCollection<Curve>, ComputationSettings)
Computes the convolution of a set of curves, .
public static Curve Convolution(IReadOnlyCollection<Curve> curves, ComputationSettings settings)
Parameters
curves
IReadOnlyCollection<Curve>
The set of curves to be convolved.
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall convolution.
Convolution(IEnumerable<Curve>, ComputationSettings)
Computes the convolution of a set of curves, .
Optimized for minimal allocations.
public static Curve Convolution(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
The set of curves to be convolved.
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall convolution.
EstimateConvolution(Curve, Boolean, ComputationSettings)
Computes the number of elementary convolutions involved in computing the (min,+) convolution of the two curves, avoiding allocations as much as possible.
public long EstimateConvolution(Curve curve, bool countElements, ComputationSettings settings)
Parameters
curve
Curve
countElements
Boolean
If true, instead of counting only how many convolutions are done, it counts how many convolution elements are produced.
settings
ComputationSettings
Returns
Int64
The number of elementary convolutions involved in computing the result of the (min,+) convolution, or the number of elements resulting from these convolutions if is true.
EstimateConvolution(Curve, Curve, Boolean, ComputationSettings)
Computes the number of elementary convolutions involved in computing the (min,+) convolution of the two curves, avoiding allocations as much as possible.
public static long EstimateConvolution(Curve f, Curve g, bool countElements, ComputationSettings settings)
Parameters
f
Curve
First operand.
g
Curve
Second operand.
countElements
Boolean
If true, instead of counting only how many convolutions are done, it counts how many convolution elements are produced.
settings
ComputationSettings
Returns
Int64
The number of elementary convolutions involved in computing the result of the (min,+) convolution, or the number of elements resulting from these convolutions if is true.
EstimateMaxPlusConvolution(Curve, Boolean, ComputationSettings)
Computes the number of elementary convolutions involved in computing the (max,+) convolution of the two curves, avoiding allocations as much as possible.
public long EstimateMaxPlusConvolution(Curve curve, bool countElements, ComputationSettings settings)
Parameters
curve
Curve
Second operand.
countElements
Boolean
If true, instead of counting only how many convolutions are done, it counts how many convolution elements are produced.
settings
ComputationSettings
Returns
Int64
The number of elementary convolutions involved in computing the result of the (max,+) convolution, or the number of elements resulting from these convolutions if is true.
EstimateMaxPlusConvolution(Curve, Curve, Boolean, ComputationSettings)
Computes the number of elementary convolutions involved in computing the (max,+) convolution of the two curves, avoiding allocations as much as possible.
public static long EstimateMaxPlusConvolution(Curve f, Curve g, bool countElements, ComputationSettings settings)
Parameters
f
Curve
First operand.
g
Curve
Second operand.
countElements
Boolean
If true, instead of counting only how many convolutions are done, it counts how many convolution elements are produced.
settings
ComputationSettings
Returns
Int64
The number of elementary convolutions involved in computing the result of the (max,+) convolution, or the number of elements resulting from these convolutions if is true.
Deconvolution(Curve, ComputationSettings)
Computes the deconvolution of two curves, .
The result is not forced to have , see WithZeroOrigin() to have this property. Described in [BT08] Section 4.5 .
public Curve Deconvolution(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
Curve
The result of the deconvolution.
Deconvolution(Curve, Curve, ComputationSettings)
Computes the deconvolution of the two curves, .
The result is not forced to have , see WithZeroOrigin() to have this property. Described in [BT08] Section 4.5 .
public static Curve Deconvolution(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The result of the deconvolution
SubAdditiveClosure(Curve, ComputationSettings)
Computes the sub-additive closure of the curve.
Described in [BT08] Section 4.6 as algorithm 5
public static SubAdditiveCurve SubAdditiveClosure(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
SubAdditiveCurve
The result of the sub-additive closure.
SubAdditiveClosure(ComputationSettings)
Computes the sub-additive closure of the curve.
Described in [BT08] Section 4.6 as algorithm 5
public SubAdditiveCurve SubAdditiveClosure(ComputationSettings settings)
Parameters
settings
ComputationSettings
Returns
SubAdditiveCurve
The result of the sub-additive closure.
MaxPlusConvolution(Curve, ComputationSettings)
Computes the max-plus convolution of the two curves, .
Adapted from the min-plus convolution algorithm described in [BT08] Section 4.4
public Curve MaxPlusConvolution(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
Curve
The curve resulting from the max-plus convolution.
MaxPlusConvolution(Curve, Curve, ComputationSettings)
Computes the max-plus convolution of the two curves, .
Adapted from the min-plus convolution algorithm described in [BT08] Section 4.4
public static Curve MaxPlusConvolution(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The result of the max-plus convolution
MaxPlusConvolution(IReadOnlyCollection<Curve>, ComputationSettings)
Computes the max-plus convolution of a set of curves.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public static Curve MaxPlusConvolution(IReadOnlyCollection<Curve> curves, ComputationSettings settings)
Parameters
curves
IReadOnlyCollection<Curve>
The set of curves to be convolved.
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall max-plus convolution.
MaxPlusConvolution(IEnumerable<Curve>, ComputationSettings)
Computes the max-plus convolution of a set of curves, .
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public static Curve MaxPlusConvolution(IEnumerable<Curve> curves, ComputationSettings settings)
Parameters
curves
IEnumerable<Curve>
The set of curves to be convolved.
settings
ComputationSettings
Returns
Curve
The curve resulting from the overall max-plus convolution.
MaxPlusDeconvolution(Curve, ComputationSettings)
Computes the max-plus deconvolution of two curves.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public Curve MaxPlusDeconvolution(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
Curve
The result of the max-plus deconvolution.
MaxPlusDeconvolution(Curve, Curve, ComputationSettings)
Computes the max-plus deconvolution of the two curves
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public static Curve MaxPlusDeconvolution(Curve a, Curve b, ComputationSettings settings)
Parameters
a
Curve
First operand.
b
Curve
Second operand.
settings
ComputationSettings
Returns
Curve
The result of the max-plus deconvolution
SuperAdditiveClosure(Curve, ComputationSettings)
Computes the super-additive closure of the curve.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public static SuperAdditiveCurve SuperAdditiveClosure(Curve curve, ComputationSettings settings)
Parameters
curve
Curve
settings
ComputationSettings
Returns
SuperAdditiveCurve
The result of the super-additive closure.
SuperAdditiveClosure(ComputationSettings)
Computes the super-additive closure of the curve.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public SuperAdditiveCurve SuperAdditiveClosure(ComputationSettings settings)
Parameters
settings
ComputationSettings
Returns
SuperAdditiveCurve
The result of the super-additive closure.
Composition(Curve, ComputationSettings)
Compute the composition of this curve, , and , i.e. .
Algorithmic properties discussed in [ZNS23b].
public Curve Composition(Curve g, ComputationSettings settings)
Parameters
g
Curve
Inner function, must be non-negative and non-decreasing.
settings
ComputationSettings
Returns
Curve
The result of the composition.
Exceptions
ArgumentException
If the operands are not defined as expected.
Composition(Curve, Curve, ComputationSettings)
Compute the composition .
Algorithmic properties discussed in [ZNS23b].
public static Curve Composition(Curve f, Curve g, ComputationSettings settings)
Parameters
f
Curve
Outer function.
g
Curve
Inner function, must be non-negative and non-decreasing.
settings
ComputationSettings
Returns
Curve
The result of the composition.
Exceptions
ArgumentException
If the operands are not defined as expected.