Skip to main content

ConvexCurve

This class should be used to represent convex curves with f(0)=0f(0) = 0 (see IsRegularConvex), and exploit these properties to optimize computations.

note

f(0)=0f(0) = 0 is required for the curve to be IsRegularSuperAdditive, hence derive from SuperAdditiveCurve, but is not required for convexity to be stable on maximum, addition and convolution. To keep the type system simple for the common cases of DNC, we opted not to support non-regular convex functions with their own type.

public class ConvexCurve : SuperAdditiveCurve, Unipi.Nancy.MinPlusAlgebra.IToCodeString, Unipi.Nancy.Utility.IStableHashCode

Inheritance ObjectCurveSuperAdditiveCurveConvexCurve
Implements IToCodeString, IStableHashCode

Properties

IsSuperAdditive

True if the curve is super-additive.

note

For a SuperAdditiveCurve this will always return true, without performing any checks.

public bool IsSuperAdditive { get; }

Property Value

Boolean

PseudoPeriodStart

Point in time after which the curve has a pseudo-periodic behavior.

note

Referred to as TT or Rank in [BT08] Section 4.1

public Rational PseudoPeriodStart { get; set; }

Property Value

Rational

PseudoPeriodLength

Time length of each pseudo-period.

note

Referred to as dd in [BT08] Section 4.1

public Rational PseudoPeriodLength { get; set; }

Property Value

Rational

PseudoPeriodHeight

Static value gain applied after each pseudo-period. If it's 0, the curve is truly periodic.

note

Referred to as cc in [BT08] Section 4.1

public Rational PseudoPeriodHeight { get; set; }

Property Value

Rational

PseudoPeriodSlope

Average slope of curve in pseudo-periodic behavior. If it's 0, the curve is truly periodic.

public Rational PseudoPeriodSlope { get; }

Property Value

Rational

FirstPseudoPeriodEnd

End time of the first pseudo period.

public Rational FirstPseudoPeriodEnd { get; }

Property Value

Rational

SecondPseudoPeriodEnd

End time of the second pseudo period.

public Rational SecondPseudoPeriodEnd { get; }

Property Value

Rational

BaseSequence

Sequence describing behavior of the curve in [0,T+d[[0, T + d[. Combined with the UPP property, this is also allows to derive f(t)f(t) for any tT+dt \ge T + d.

note

Referred to as [t1,...,tk][t_1, ..., t_k] in [BT08] Section 4.1

public Sequence BaseSequence { get; set; }

Property Value

Sequence

IsFinite

True if the curve has finite value for any tt.

public bool IsFinite { get; }

Property Value

Boolean

FirstFiniteTime

The first instant around which the curve is not infinite. Does not specify whether it's inclusive or not, i.e. if f(t)f(t) is finite.

public Rational FirstFiniteTime { get; }

Property Value

Rational

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 f(t)f(t) is finite.

public Rational FirstFiniteTimeExceptOrigin { get; }

Property Value

Rational

FirstNonZeroTime

The first instant around which the curve is not 0. Does not specify whether it's inclusive or not, i.e. if f(t)=0f(\overline{t}) = 0.

public Rational FirstNonZeroTime { get; }

Property Value

Rational

PseudoPeriodStartInfimum

Returns the minimum TLT_L such that f(t+d)=f(t)+cf(t + d) = f(t) + c for all t>TLt > T_L. It is the infimum of all valid PseudoPeriodStart, i.e. TL=inf{Tf(t+d)=f(t)+ctT}T_L = \inf\{ T | f(t + d) = f(t) + c \forall t \ge T \}.

public Rational PseudoPeriodStartInfimum { get; }

Property Value

Rational

IsZero

True if the curve is 0 for all tt.

public bool IsZero { get; }

Property Value

Boolean

IsPlusInfinite

True if the curve has ++\infty value for any tt.

public bool IsPlusInfinite { get; }

Property Value

Boolean

IsMinusInfinite

True if the curve has -\infty value for any tt.

public bool IsMinusInfinite { get; }

Property Value

Boolean

IsContinuous

True if there is no infinite value or discontinuity within the curve.

public bool IsContinuous { get; }

Property Value

Boolean

IsContinuousExceptOrigin

True if there is no discontinuity within the curve, except at most in origin.

public bool IsContinuousExceptOrigin { get; }

Property Value

Boolean

IsLeftContinuous

True if there is no left-discontinuity within the curve.

public bool IsLeftContinuous { get; }

Property Value

Boolean

IsRightContinuous

True if there is no right-discontinuity within the curve.

public bool IsRightContinuous { get; }

Property Value

Boolean

IsNonNegative

True if the curve is non-negative, i.e. f(t)0f(t) \ge 0 for any tt.

public bool IsNonNegative { get; }

Property Value

Boolean

FirstNonNegativeTime

The first instant around which the curve is non-negative. Does not specify whether it's inclusive or not, i.e. if f(t)>=0f(\overline{t}) >= 0.

public Rational FirstNonNegativeTime { get; }

Property Value

Rational

IsNonDecreasing

True if for any t>st > s, f(t)f(s)f(t) \ge f(s).

public bool IsNonDecreasing { get; }

Property Value

Boolean

IsUltimatelyFinite

True if for all tt \ge PseudoPeriodStart the curve is finite.

note

This property does not check if f(t),t<f(t), t < PseudoPeriodStart is either infinite, finite or both.

public bool IsUltimatelyFinite { get; }

Property Value

Boolean

IsUltimatelyInfinite

True if, for b{,+}b \in \{-\infty, +\infty\} and some TT, f(t)=bf(t) = b for all tTt \ge T.

public bool IsUltimatelyInfinite { get; }

Property Value

Boolean

IsUltimatelyPlain

True if for all t>t > PseudoPeriodStart the curve is either always finite or always infinite.

note

Defined in [BT08], Definition 1.

public bool IsUltimatelyPlain { get; }

Property Value

Boolean

IsPlain

True if ff 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 TT, then always plus or minus infinite (without changing sign)

note

Formally defined in [BT08], Definition 1.

public bool IsPlain { get; }

Property Value

Boolean

IsUltimatelyAffine

True if for all tt \ge PseudoPeriodStart the curve is affine.

public bool IsUltimatelyAffine { get; }

Property Value

Boolean

IsUltimatelyConstant

True if for tt \ge PseudoPeriodStart the curve is constant.

public bool IsUltimatelyConstant { get; }

Property Value

Boolean

IsSubAdditive

True if the curve is sub-additive, i.e. f(t+s)f(t)+f(s)f(t+s) \le f(t) + f(s).

note

Based on [Zippo23] Lemma 9.3: f(0)0,ff(0) \ge 0, f is sub-additive     f=ff\iff f^\circ = f^\circ \otimes f^\circ, where ff^\circ 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

Boolean

IsRegularSubAdditive

True if the curve is sub-additive with f(0)=0f(0) = 0.

public bool IsRegularSubAdditive { get; }

Property Value

Boolean

IsRegularSuperAdditive

True if the curve is super-additive with f(0)=0f(0) = 0.

public bool IsRegularSuperAdditive { get; }

Property Value

Boolean

IsConcave

Tests if the curve is concave, i.e. for any two points (t,f(t))(t, f(t)) the straight line joining them is below ff.

note

The property is checked via the following property: ff is concave     \iff a) ff is continuous, or it is continuous for t>0t > 0 and f(0)f(0+)f(0) \le f(0^+), and b) ff is composed of segments with decreasing slopes.

public bool IsConcave { get; }

Property Value

Boolean

IsRegularConcave

Tests if the curve is concave with f(0)=0f(0) = 0.

public bool IsRegularConcave { get; }

Property Value

Boolean

IsConvex

Tests if the curve is convex, i.e. for any two points (t,f(t))(t, f(t)) the straight line joining them is above ff.

note

The property is checked via the following property: ff is convex     \iff a) ff is continuous, or it is continuous for t>0t > 0 and f(0)f(0+)f(0) \ge f(0^+), and b) ff is composed of segments with increasing slopes.

public bool IsConvex { get; }

Property Value

Boolean

IsRegularConvex

Tests if the curve is convex with f(0)=0f(0) = 0.

public bool IsRegularConvex { get; }

Property Value

Boolean

HasTransient

True if pseudo-periodic behavior starts at T>0T > 0.

public bool HasTransient { get; }

Property Value

Boolean

TransientSequence

Sequence describing the curve in [0,T[[0, T[, before pseudo-periodic behavior.

public Sequence TransientSequence { get; }

Property Value

Sequence

TransientElements

Elements describing the curve from [0,T[[0, T[, before pseudo-periodic behavior.

note

Referred to as [t1,...,ti01][t_1, ..., t_{i_0 - 1}] in [BT08] Section 4.1

public IEnumerable<Element> TransientElements { get; }

Property Value

IEnumerable<Element>

PseudoPeriodicSequence

Sequence describing the pseudo-periodic behavior of the curve in [T,T+d[[T, T + d[.

public Sequence PseudoPeriodicSequence { get; }

Property Value

Sequence

PseudoPeriodicElements

Elements describing the pseudo-periodic behavior of the curve in [T,T+d[[T, T + d[.

note

Referred to as [ti0,...,tk][t_{i_0}, ..., t_k] in [BT08] Section 4.1

public IEnumerable<Element> PseudoPeriodicElements { get; }

Property Value

IEnumerable<Element>

Constructors

ConvexCurve(Sequence, Rational, Rational, Rational)

Constructor.

public ConvexCurve(Sequence baseSequence, Rational pseudoPeriodStart, Rational pseudoPeriodLength, Rational pseudoPeriodHeight)

Parameters

baseSequence Sequence

pseudoPeriodStart Rational

pseudoPeriodLength Rational

pseudoPeriodHeight Rational

ConvexCurve(Curve)

Copy constructor.

public ConvexCurve(Curve other)

Parameters

other Curve

Methods

Addition(Curve)

public Curve Addition(Curve b)

Parameters

b Curve

Returns

Curve

Addition(ConvexCurve)

public ConvexCurve Addition(ConvexCurve b)

Parameters

b ConvexCurve

Returns

ConvexCurve

Maximum(Curve, ComputationSettings)

public Curve Maximum(Curve curve, ComputationSettings settings)

Parameters

curve Curve

settings ComputationSettings

Returns

Curve

Maximum(ConvexCurve, ComputationSettings)

public ConvexCurve Maximum(ConvexCurve curve, ComputationSettings settings)

Parameters

curve ConvexCurve

settings ComputationSettings

Returns

ConvexCurve

Convolution(Curve, ComputationSettings)

public Curve Convolution(Curve curve, ComputationSettings settings)

Parameters

curve Curve

settings ComputationSettings

Returns

Curve

Convolution(ConvexCurve, ComputationSettings)

public ConvexCurve Convolution(ConvexCurve curve, ComputationSettings settings)

Parameters

curve ConvexCurve

settings ComputationSettings

Returns

ConvexCurve