GenSolver


ValueRange

Namespace: Informedica.GenSolver.Lib
Parent Module: Variable

Functions and types to handle ValueRange.

Nested types and modules

TypeDescription
Increment

The increment in a Range. Increment has to be a non zero or negative value

Maximum

The maximum value in a Range. Can be inclusive or exclusive.

Message

Failure messages.

Minimum

The minimal value in a Range. Can be inclusive or exclusive.

Range

A Range is restricted by either a Minimum, a Maximum, a Minimum and a increment, an increment and a Maximum or a Minimum and a Maximum. There is no Range with both an min, incr, and max, as that is, in fact, a ValueSet.

ValueRange

ValueRange represents a discrete set of rational numbers. A ValueRange is either unrestricted, a finite set of BigRational or a Range.

ValueRangeException

ValueRange exception type

ModuleDescription
MinMaxCalcultor

Functions to calculate the Minimum and Maximum in a ValueRange

Functions and values

Function or valueDescription
apply unr fValueSet fRange _arg1
Signature: unr:'?6901 -> fValueSet:(Set<BigRational> -> '?6901) -> fRange:(Range -> '?6901) -> _arg1:ValueRange -> '?6901
Type parameters: '?6901

Aply the give functions to Values where unr is used for an Unrestricted ValueRange, fv is used for ValueSet and fr is used for Range

applyIncr f _arg1
Signature: f:(BigRational -> BigRational) -> _arg1:Increment -> Increment

Apply f to the bigrational value of Increment

applyMax f _arg1
Signature: f:(BigRational -> BigRational) -> _arg1:Maximum -> Maximum

Apply f to the bigrational value of Maximum

applyMin f _arg1
Signature: f:(BigRational -> BigRational) -> _arg1:Minimum -> Minimum

Apply f to the bigrational value of Minimum

applyRange (...)
Signature: fMin:(Minimum -> '?6903) -> fMax:(Maximum -> '?6903) -> fMinIncr:(Minimum * Increment -> '?6903) -> fIncrMax:(Increment * Maximum -> '?6903) -> fMinMax:(Minimum * Maximum -> '?6903) -> _arg1:Range -> '?6903
Type parameters: '?6903

Aply the give functions to Range where fMin is used for a range with only a Minimum, fMax is used for range Maximum, fMinIncr is used for MinIncr , fIncrMax for IncrMax and fMinMax for MinMax.

calc op (x1, x2)
Signature: op:(BigRational -> BigRational -> BigRational) -> (x1:ValueRange * x2:ValueRange) -> ValueRange

Applies an infix operator op to ValueRange x1 and x2. Calculates Minimum, increment or Maximum if either x1 or x2 is not a ValueSet. Doesn't perform any calculation when both x1 and x2 are Unrestricted.

calcIncr op incr1 incr2
Signature: op:(BigRational -> BigRational -> BigRational) -> incr1:Increment option -> incr2:Increment option -> Increment option

Calculate an increment with incr1 of x1 and incr2 of x2 in an equation: y = x1 op x2

calcOpt op c v1 v2
Signature: op:(BigRational -> BigRational -> BigRational) -> c:(BigRational -> '?6964) -> v1:BigRational -> v2:BigRational -> '?6964 option
Type parameters: '?6964

Safely calculate v1 and v2 using operator op, returns None if operator is division and v2 is 0.

contains v vr
Signature: v:BigRational -> vr:ValueRange -> bool

Check whether a ValueRange vr contains a BigRational v.

count
Signature: ValueRange -> int

Count the number of values in a ValueRange. Returns 0 if not a ValueSet.

create succ fail unr vs min incr max
Signature: succ:(ValueRange -> '?6949) -> fail:(Message -> '?6949) -> unr:bool -> vs:Set<BigRational> -> min:Minimum option -> incr:Increment option -> max:Maximum option -> '?6949
Type parameters: '?6949

Create a ValueRange using a ValueSet vs an optional Minimum min, incr and Maximum max. If the vs is an empty set then create a Range. If both min, incr and max are None, and unr created an Unrestricted ValueRange else create an empty ValueRange. Pass the result to succ, if failing a Message to fail.

createExc
Signature: bool -> Set<BigRational> -> Minimum option -> Increment option -> Maximum option -> ValueRange

Create ValueRange and raises an exception if it fails.

createIncr succ fail i
Signature: succ:(Increment -> '?6941) -> fail:(BigRational -> '?6941) -> i:BigRational -> '?6941
Type parameters: '?6941

Create an Increment that is a non zero or negative value

createMax isIncl m
Signature: isIncl:bool -> m:BigRational -> Maximum

Create a Maximum that is either inclusive or exclusive.

createMin isIncl m
Signature: isIncl:bool -> m:BigRational -> Minimum

Create a Minimum that is either inclusive or exclusive.

createOpt
Signature: bool -> Set<BigRational> -> Minimum option -> Increment option -> Maximum option -> ValueRange option

Return an optional ValueRange.

createValueSet arg0
Signature: arg0:Set<BigRational> -> ValueRange

Create a ValueSet.

empty
Signature: ValueRange

An empty ValueSet.

filter min incr max
Signature: min:Minimum option -> incr:Increment option -> max:Maximum option -> Set<BigRational> -> Set<BigRational>

Filter a set of BigRational according to min, incr and max constraints

getIncr
Signature: ValueRange -> Increment option
getMax
Signature: ValueRange -> Maximum option

Get an optional Maximum in a ValueRange

getMin
Signature: ValueRange -> Minimum option

Get an optional Minimum in a ValueRange

getRangeMax
Signature: Range -> Maximum option

Get a Maximum option in a Range

getRangeMin
Signature: Range -> Minimum option

Get a Minimum option in a Range

getSetMax s
Signature: s:Set<BigRational> -> Maximum option

Get the maximum value in a BigRational set. Returns None if an empty set.

getSetMin s
Signature: s:Set<BigRational> -> Minimum option

Get the minimal value in a BigRational set. Returns None if an empty set.

getValueSet
Signature: ValueRange -> Set<BigRational>

Get a set of BigRational from a ValueRange, returns an empty set when ValueRange is not a ValueSet or the set of BigRational is actually empty.

incrMaxValueRange incr max
Signature: incr:Increment -> max:Maximum -> ValueRange

Create an IncrMax ValueRange.

incrToValue arg1
Signature: Increment -> BigRational

Convert an Increment to a BigRational

isBetweenAndMultOf min incr max v
Signature: min:Minimum option -> incr:Increment option -> max:Maximum option -> v:BigRational -> bool

Checks whether a BigRational is between an optional min an optional max and is a multiple of incr. When min, incr and max are None then this will return true for any value.

isEmpty vr
Signature: vr:ValueRange -> bool

Checks whether a ValueRange is ValueSet and doesn't contain any value.

isMaxExcl _arg1
Signature: _arg1:Maximum -> bool

Checks whether Maximum is exclusive.

isMaxIncl
Signature: Maximum -> bool

Checks whether Maximum is inclusive.

isMinExcl _arg1
Signature: _arg1:Minimum -> bool

Checks whether Minimum is exclusive.

isMinIncl
Signature: Minimum -> bool

Checks whether Minimum is inclusive.

isRange
Signature: ValueRange -> bool

Checks whether a ValueRange is a Range

isUnrestricted
Signature: ValueRange -> bool

Checks whether a ValueRange is Unrestricted

isValueSet
Signature: ValueRange -> bool

Checks whether a ValueRange is a ValueSet

maxLTmax m1 m2
Signature: m1:Maximum -> m2:Maximum -> bool

Checks whether Maximum m2 > m1

maxMultipleOf incr max
Signature: incr:Increment -> max:Maximum -> BigRational
maxRange isIncl m
Signature: isIncl:bool -> m:BigRational -> Range

Create a Maximum Range that is either inclusive or exclusive.

maxSTEmax m1 m2
Signature: m1:Maximum -> m2:Maximum -> bool

Checks whether Maximum m2 <= m1

maxToValue _arg1
Signature: _arg1:Maximum -> BigRational

Convert a Maximum to a BigRational.

minEQmax max min
Signature: max:Maximum -> min:Minimum -> bool

Checks whether Minimum min = Maximum max

minIncrMaxToValueSet min incr max
Signature: min:Minimum -> incr:Increment -> max:Maximum -> ValueRange

Create a set of BigRational using min, incr and a max.

minIncrValueRange min incr
Signature: min:Minimum -> incr:Increment -> ValueRange

Create a MinIncr ValueRange.

minLTmax max min
Signature: max:Maximum -> min:Minimum -> bool

Checks whether Minimum min > Maximum max

minLTmin m1 m2
Signature: m1:Minimum -> m2:Minimum -> bool

Checks whether Minimum m2 > m1

minMaxValueRange succ fail min max
Signature: succ:(ValueRange -> '?6947) -> fail:(Message -> '?6947) -> min:Minimum -> max:Maximum -> '?6947
Type parameters: '?6947

Create a MinMax ValueRange. If min > max pass a Message to fail else pass result to succ.

minMultipleOf incr min
Signature: incr:Increment -> min:Minimum -> BigRational
minRange isIncl m
Signature: isIncl:bool -> m:BigRational -> Range

Create a Minimum Range that is either inclusive or exclusive.

minSTEmax max min
Signature: max:Maximum -> min:Minimum -> bool

Checks whether Minimum min <= Maximum max

minSTEmin m1 m2
Signature: m1:Minimum -> m2:Minimum -> bool

Checks whether Minimum m2 <= m1

minToValue _arg1
Signature: _arg1:Minimum -> BigRational

Convert a Minimum to a BigRational.

print (...)
Signature: unr:bool -> vals:BigRational list -> min:'?6931 option -> minincl:bool -> incr:'?6932 option -> max:'?6933 option -> maxincl:bool -> string
Type parameters: '?6931, '?6932, '?6933

Create a string (to print) representation of a ValueRange.

raiseExc m
Signature: m:Message -> '?6896
Type parameters: '?6896

Raise a ValueRangeException with Message m.

setIncr incr vr
Signature: incr:Increment -> vr:ValueRange -> ValueRange

Apply a incr to a ValueRange vr. If increment cannot be set the original is returned.

setMax max vr
Signature: max:Maximum -> vr:ValueRange -> ValueRange

Apply a Maximum max to a ValueRange vr. If maximum cannot be set the original is returned.

setMin min vr
Signature: min:Minimum -> vr:ValueRange -> ValueRange

Apply a Minimum min to a ValueRange vr. If minimum cannot be set the original is returned.

setValues vs vr
Signature: vs:Set<BigRational> -> vr:ValueRange -> ValueRange

Appy a set of BigRational to a ValueRange vr. the result is a filtered or the intersect of the set of BigRational and vr.

toString vr
Signature: vr:ValueRange -> string

Convert a ValueRange to a string.

unrestricted
Signature: ValueRange

An Unrestricted ValueRange.

Fork me on GitHub