Logo GenPRES

ValueRange Module

Creates a value range, restricts the range with a minimum, increment, maximum or value set, and calculates with two value ranges.

Nested modules

Modules Description

Increment

Creates an increment from the positive values of a ValueUnit, removing multiples of a smaller value, and restricts and calculates with increments. Raises a solver exception for an empty increment.

Maximum

Creates an inclusive or exclusive maximum from a single value, compares and restricts maximums, and rounds a maximum down to a multiple of an increment. Raises a solver exception when the ValueUnit does not hold a single value.

MinMaxCalculator

Calculates the minimum and the maximum of the product, quotient, sum or difference of two ranges from the limits and signs of both ranges. Raises a DivideByZeroException for a division by a range with zero as an inclusive limit. For example, <1N..3N] * <4N..5N> = <4N..15N>, where an angle bracket marks an exclusive limit and a square bracket an inclusive limit.

Minimum

Creates an inclusive or exclusive minimum from a single value, compares and restricts minimums, and rounds a minimum up to a multiple of an increment. Raises a solver exception when the ValueUnit does not hold a single value.

Operators

Holds the operators to calculate with two value ranges, on all values or on minimum, increment and maximum only, and to restrict a range.

Property

Creates a minimum, maximum, increment or value set property of a variable, and converts a property to a value range or to text.

ValueSet

Creates a sorted set of values, intersects, prunes and calculates with value sets, and expands a minimum, increment and maximum to a value set. Raises a solver exception for an empty set.

Functions and values

Function or value Description

allSameUnitGroup vr

Full Usage: allSameUnitGroup vr

Parameters:
Returns: bool True if all ValueUnits belong to the same ValueUnit.Group

Check whether all ValueUnits in a ValueRange belong to the same ValueUnit.Group.

vr : ValueRange

The ValueRange

Returns: bool

True if all ValueUnits belong to the same ValueUnit.Group

apply unr nonZero fMin fMax fMinMax fIncr fMinIncr fIncrMax fMinIncrMax fValueSet _arg1

Full Usage: apply unr nonZero fMin fMax fMinMax fIncr fMinIncr fIncrMax fMinIncrMax fValueSet _arg1

Parameters:
    unr : 'a - Constant for Unrestricted
    nonZero : 'a - Constant for NonZeroNoneNegative
    fMin : Minimum -> 'a - The function to apply to a Minimum
    fMax : Maximum -> 'a - The function to apply to a Maximum
    fMinMax : Minimum * Maximum -> 'a - The function to apply to a MinMax
    fIncr : Increment -> 'a - The function to apply to an Increment
    fMinIncr : Minimum * Increment -> 'a - The function to apply to a MinIncr
    fIncrMax : Increment * Maximum -> 'a - The function to apply to an IncrMax
    fMinIncrMax : Minimum * Increment * Maximum -> 'a - The function to apply to a MinIncrMax
    fValueSet : ValueSet -> 'a - The function to apply to a ValueSet
    _arg1 : ValueRange

Returns: 'a The result of applying the function to the ValueRange
Type parameters: 'a

Apply a function to a ValueRange.

unr : 'a

Constant for Unrestricted

nonZero : 'a

Constant for NonZeroNoneNegative

fMin : Minimum -> 'a

The function to apply to a Minimum

fMax : Maximum -> 'a

The function to apply to a Maximum

fMinMax : Minimum * Maximum -> 'a

The function to apply to a MinMax

fIncr : Increment -> 'a

The function to apply to an Increment

fMinIncr : Minimum * Increment -> 'a

The function to apply to a MinIncr

fIncrMax : Increment * Maximum -> 'a

The function to apply to an IncrMax

fMinIncrMax : Minimum * Increment * Maximum -> 'a

The function to apply to a MinIncrMax

fValueSet : ValueSet -> 'a

The function to apply to a ValueSet

_arg1 : ValueRange
Returns: 'a

The result of applying the function to the ValueRange

applyExpr y expr

Full Usage: applyExpr y expr

Parameters:
Returns: ValueRange The resulting (restricted) ValueRange

Set a ValueRange expr to a ValueRange y. So, the result is equal to or more restrictive than the original y.

y : ValueRange

The ValueRange to apply to

expr : ValueRange

The ValueRange to apply

Returns: ValueRange

The resulting (restricted) ValueRange

Example

 let min = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Minimum.create true
 let incr = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Increment.create
 let max = 8N |> ValueUnit.singleWithUnit Units.Count.times |> Maximum.create false
 let vr1 = create true (Some min) (Some incr) None None
 let vr2 = create true None None (Some max) None
 vr1 |> applyExpr vr2
 // returns
 // MinIncrMax
 //   (MinIncl (ValueUnit ([|2N|], Count (Times 1N))),
 //    Increment (ValueUnit ([|2N|], Count (Times 1N))),
 //    MaxIncl (ValueUnit ([|6N|], Count (Times 1N))))
val min: obj
val incr: obj
val max: obj
val vr1: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val vr2: obj

applyValueUnit f vr

Full Usage: applyValueUnit f vr

Parameters:
    f : ValueUnit -> 'a option - The function to apply to the ValueUnit
    vr : ValueRange - The ValueRange

Returns: 'a option The mapped ValueRange
Type parameters: 'a

Map a function to the ValueUnit of a ValueRange.

f : ValueUnit -> 'a option

The function to apply to the ValueUnit

vr : ValueRange

The ValueRange

Returns: 'a option

The mapped ValueRange

calc onlyMinIncrMax op (vr1, vr2)

Full Usage: calc onlyMinIncrMax op (vr1, vr2)

Parameters:
    onlyMinIncrMax : bool - Whether only the minimum, increment and maximum should be calculated
    op : ValueUnit -> ValueUnit -> ValueUnit - The infix operator
    vr1 : ValueRange - The first ValueRange
    vr2 : ValueRange - The second ValueRange

Returns: ValueRange The resulting ValueRange

Applies an infix operator op (either *, /, + or -) to ValueRange vr1 and vr2. If onlyMinIncrMax then only the minimum, increment and maximum are calculated.

onlyMinIncrMax : bool

Whether only the minimum, increment and maximum should be calculated

op : ValueUnit -> ValueUnit -> ValueUnit

The infix operator

vr1 : ValueRange

The first ValueRange

vr2 : ValueRange

The second ValueRange

Returns: ValueRange

The resulting ValueRange

Example

 let vs1 = [| 1N; 2N; 3N |] |> ValueUnit.withUnit Units.Count.times |> ValueSet.create
 let vs2 = [| 4N; 5N; 6N |] |> ValueUnit.withUnit Units.Count.times |> ValueSet.create
 let vr1 = create true None None None (Some vs1)
 let vr2 = create true None None None (Some vs2)
 calc true (*) (vr1, vr2)
 // returns a ValueRange with a Minimum = 4 and a Maximum = 18
 calc false (*) (vr1, vr2)
 // returns a ValueRange [|4N; 5N; 6N; 8N; 10N; 12N; 15N; 18N|]
val vs1: obj
val vs2: obj
val vr1: obj
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val vr2: obj

cardinality

Full Usage: cardinality

Returns: ValueRange -> int

Count the number of values in a ValueRange. Returns 0 if no count is possible.

Only when value range is a ValueSet there can be a count.

Returns: ValueRange -> int

clear var

Full Usage: clear var

Parameters:
Returns: Variable

Set the ValueRange to Unrestricted.

var : Variable
Returns: Variable

contains vu vr

Full Usage: contains vu vr

Parameters:
Returns: bool

Checks whether a value is in a ValueRange.

vu : ValueUnit

The ValueUnit (value)

vr : ValueRange

The ValueRange

Returns: bool
Example

 let min = Minimum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let vr = create true min None None None
 let vu = [| 4N |] |> ValueUnit.create Units.Mass.gram
 vr |> contains vu // returns true
 let incr = Increment.create ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let vr = create true None incr None None
 vr |> contains vu // returns false
val min: obj option
union case Option.Some: Value: 'T -> Option<'T>
val vr: obj
union case Option.None: Option<'T>
val vu: obj
val incr: obj option

convertToUnit u

Full Usage: convertToUnit u

Parameters:
    u : Unit - The unit to convert to

Returns: ValueRange -> ValueRange

Convert the unit of a ValueRange to u.

u : Unit

The unit to convert to

Returns: ValueRange -> ValueRange

create min incr max vs

Full Usage: create min incr max vs

Parameters:
    min : Minimum option - Optional Minimum
    incr : Increment option - Optional Increment
    max : Maximum option - Optional Maximum
    vs : ValueSet option - Optional ValueSet

Returns: ValueRange A ValueRange

Create a ValueRange depending on the values of min, incr and max.

min : Minimum option

Optional Minimum

incr : Increment option

Optional Increment

max : Maximum option

Optional Maximum

vs : ValueSet option

Optional ValueSet

Returns: ValueRange

A ValueRange

Example

 let min = Minimum.create ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let max = Maximum.create ( [| 5N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let incr = None
 let vs = None
 create true min incr max vs
 // returns MinMax (Minimum.MinIncl (ValueUnit ([|3N|], Mass (Gram 1N))), Maximum.MaxIncl (ValueUnit ([|5N|], Mass (Gram 1N))))
val min: obj option
union case Option.Some: Value: 'T -> Option<'T>
val max: obj option
val incr: 'a option
union case Option.None: Option<'T>
val vs: 'a option

createIncr

Full Usage: createIncr

Returns: ValueUnit -> ValueRange

Create a ValueRange with a Minimum, Increment and a Maximum.

Returns: ValueUnit -> ValueRange

createIncrMax incr max maxIncl

Full Usage: createIncrMax incr max maxIncl

Parameters:
Returns: ValueRange

Create a IncrMax ValueRange.

incr : ValueUnit
max : ValueUnit
maxIncl : bool
Returns: ValueRange

createMax isIncl m

Full Usage: createMax isIncl m

Parameters:
Returns: ValueRange

Create a Maximum Range that is either inclusive or exclusive.

isIncl : bool
m : ValueUnit
Returns: ValueRange

createMin isIncl m

Full Usage: createMin isIncl m

Parameters:
Returns: ValueRange

Create a Minimum Range that is either inclusive or exclusive.

isIncl : bool
m : ValueUnit
Returns: ValueRange

createMinIncr min minIncl incr

Full Usage: createMinIncr min minIncl incr

Parameters:
Returns: ValueRange

Create a MinIncr ValueRange.

min : bool
minIncl : ValueUnit
incr : ValueUnit
Returns: ValueRange

createMinMax min minIncl max maxIncl

Full Usage: createMinMax min minIncl max maxIncl

Parameters:
    min : ValueUnit - The minimum
    minIncl : bool - Whether the minimum is inclusive
    max : ValueUnit - The maximum
    maxIncl : bool - Whether the maximum is inclusive

Returns: ValueRange

Create a Range with a Minimum and a Maximum.

min : ValueUnit

The minimum

minIncl : bool

Whether the minimum is inclusive

max : ValueUnit

The maximum

maxIncl : bool

Whether the maximum is inclusive

Returns: ValueRange

createValSet brs

Full Usage: createValSet brs

Parameters:
Returns: ValueRange

Create a ValueSet ValueRange.

brs : ValueUnit
Returns: ValueRange

diffWith vr1 vr2

Full Usage: diffWith vr1 vr2

Parameters:
Returns: Set<Property> The difference between the two ValueRanges

Get the difference between two ValueRanges.

vr1 : ValueRange

The first ValueRange

vr2 : ValueRange

The second ValueRange

Returns: Set<Property>

The difference between the two ValueRanges

Example

 let min = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Minimum.create true
 let incr = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Increment.create
 let max = 8N |> ValueUnit.singleWithUnit Units.Count.times |> Maximum.create false
 let vr1 = create true (Some min) (Some incr) None None
 let vr2 = create true None None (Some max) None
 vr1 |> diffWith vr2
val min: obj
val incr: obj
val max: obj
val vr1: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val vr2: obj

eqs vr1 vr2

Full Usage: eqs vr1 vr2

Parameters:
Returns: bool

Check if ValueRange vr1 is equal to ValueRange vr2.

vr1 : ValueRange
vr2 : ValueRange
Returns: bool

eqsUnitGroup vr1 vr2

Full Usage: eqsUnitGroup vr1 vr2

Parameters:
Returns: bool True if both ValueRanges have the same ValueUnit.Group

Check whether two ValueRanges have the same ValueUnit.Group.

vr1 : ValueRange

The first ValueRange

vr2 : ValueRange

The second ValueRange

Returns: bool

True if both ValueRanges have the same ValueUnit.Group

filter minOpt incrOpt maxOpt arg4

Full Usage: filter minOpt incrOpt maxOpt arg4

Parameters:
    minOpt : Minimum option - The optional minimum
    incrOpt : Increment option - The optional increment
    maxOpt : Maximum option - The optional maximum
    arg3 : ValueSet

Returns: ValueSet A ValueSet that contains the values that are between min and max and that are a multiple of incr.

Filter a set of ValueSet according to min max and incr constraints

minOpt : Minimum option

The optional minimum

incrOpt : Increment option

The optional increment

maxOpt : Maximum option

The optional maximum

arg3 : ValueSet
Returns: ValueSet

A ValueSet that contains the values that are between min and max and that are a multiple of incr.

Example

 let vs = [| 1N; 2N; 3N; 4N; 5N; 6N; 7N; 8N; 9N; 10N |] |> ValueUnit.create Units.Mass.gram |> ValueSet.create
 vs |> filter (Some (Minimum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram))) None None
 // returns ValueSet (ValueUnit ([|3N; 4N; 5N; 6N; 7N; 8N; 9N; 10N|], Mass (Gram 1N)))
 vs |> filter None None None // will return the same ValueSet
val vs: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>

getIncr

Full Usage: getIncr

Returns: ValueRange -> Increment option

Get an optional Increment in a ValueRange

Returns: ValueRange -> Increment option

getIndices vr1 vr2

Full Usage: getIndices vr1 vr2

Parameters:
Returns: int array

Get the indices of the values in a ValueRange vr1 that are also in a ValueRange vr2.

vr1 : ValueRange
vr2 : ValueRange
Returns: int array

getMax

Full Usage: getMax

Returns: ValueRange -> Maximum option

Get an optional Maximum in a ValueRange

Returns: ValueRange -> Maximum option

getMin

Full Usage: getMin

Returns: ValueRange -> Minimum option

Get an optional Minimum in a ValueRange

Returns: ValueRange -> Minimum option

getMinIncrMaxOrValueSet vr

Full Usage: getMinIncrMaxOrValueSet vr

Parameters:
Returns: Minimum option * Increment option * Maximum option * ValueSet option

Get all of min, incr, max and valSet in a ValueRange as a tuple

vr : ValueRange
Returns: Minimum option * Increment option * Maximum option * ValueSet option

getUnit vr

Full Usage: getUnit vr

Parameters:
Returns: Unit option The unit of the ValueRange or None

Get the unit of a ValueRange if all ValueUnits belong to the same ValueUnit.Group. Otherwise return None.

vr : ValueRange

The ValueRange

Returns: Unit option

The unit of the ValueRange or None

getValSet

Full Usage: getValSet

Returns: ValueRange -> ValueSet option

Get an optional ValueSet in a ValueRange

Returns: ValueRange -> ValueSet option

incrMaxToValueRange incr max

Full Usage: incrMaxToValueRange incr max

Parameters:
Returns: ValueRange An IncrMaxValueRange

Create an IncrMaxValueRange.

Note that the resulting max is always inclusive and smaller than or equal to the original max and is a multiple of incr.

incr : Increment

The increment

max : Maximum

The maximum

Returns: ValueRange

An IncrMaxValueRange

Example

 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create false ( [| 5N |] |> ValueUnit.create Units.Mass.gram)
 incrMaxToValueRange incr max
 // returns IncrMax (Increment (ValueUnit ([|2N|], Mass (Gram 1N))), Maximum.MaxIncl (ValueUnit ([|4N|], Mass (Gram 1N))))
val incr: obj
val max: obj

increaseIncrement maxCount incrs vr

Full Usage: increaseIncrement maxCount incrs vr

Parameters:
Returns: ValueRange The resulting (more restrictive) ValueRange

Try and increase the increment of a ValueRange vr to an increment in incrs such that the resulting ValueRange contains at most maxCount values.

A ValueRange that already holds at most maxCount values is left as it is. When there is no increment in the list that can be used to increase the increment of the ValueRange to the maximum count, the largest possible increment is used.

maxCount : RationalX

The maximum count

incrs : Increment list

The increment list

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) ValueRange

Example

 let min = Minimum.create true ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create true ( [| 1_000N |] |> ValueUnit.create Units.Mass.gram)
 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 minIncrMaxCount min incr max // returns 500
 let incrs = [2N;20N;50N;100N;500N] |> List.map (fun i -> Increment.create ( [| i |] |> ValueUnit.create Units.Mass.gram))
 let vr = create true (Some min) (Some incr) (Some max) None
 increaseIncrement 10N incrs vr
 // returns a ValueRange with a Minimum = 100 and an Increment = 100
 // and a Maximum = 1_000, such that the count of the ValueRange is <= 10
val min: obj
val max: obj
val incr: obj
val incrs: obj list
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...
val map: mapping: ('T -> 'U) -> list: 'T list -> 'U list
val i: obj
val vr: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>

isBetweenMinMax min max br

Full Usage: isBetweenMinMax min max br

Parameters:
    min : Minimum option - The optional minimum
    max : Maximum option - The optional maximum
    br : BigRational - The BigRational to check

Returns: bool True if br is between min and max

Checks whether a BigRational is between an optional min and an optional max

min : Minimum option

The optional minimum

max : Maximum option

The optional maximum

br : BigRational

The BigRational to check

Returns: bool

True if br is between min and max

Example

 let min = Minimum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let max = Maximum.create true ( [| 5N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let br = 4N
 br |> isBetweenMinMax min max // returns true
 let br = 6N
 br |> isBetweenMinMax min max // returns false
 let max = None
 br |> isBetweenMinMax min max // returns true
val min: obj option
union case Option.Some: Value: 'T -> Option<'T>
val max: obj option
val br: obj
val max: 'a option
union case Option.None: Option<'T>

isMinExclusiveZero vr

Full Usage: isMinExclusiveZero vr

Parameters:
Returns: bool

Check whether a ValueRange has a minimum that is exclusive and zero.

vr : ValueRange
Returns: bool

isMultipleOfIncr incrOpt br

Full Usage: isMultipleOfIncr incrOpt br

Parameters:
Returns: bool

Checks whether a BigRational is a multiple of an optional incr.

incrOpt : Increment option

br : BigRational

Returns: bool
Example

 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let br = 4N
 br |> isMultipleOfIncr incr // returns true
 let br = 5N
 br |> isMultipleOfIncr incr // returns false
 let incr = None
 br |> isMultipleOfIncr incr // returns true
val incr: obj option
union case Option.Some: Value: 'T -> Option<'T>
val br: obj
val incr: 'a option
union case Option.None: Option<'T>

isSolved

Full Usage: isSolved

Returns: ValueRange -> bool
Returns: ValueRange -> bool

isSubSetOf vr2 vr1

Full Usage: isSubSetOf vr2 vr1

Parameters:
Returns: bool
vr2 : ValueRange
vr1 : ValueRange
Returns: bool

map fMin fMax fMinMax fIncr fMinIncr fIncrMax fMinIncrMax fValueSet vr

Full Usage: map fMin fMax fMinMax fIncr fMinIncr fIncrMax fMinIncrMax fValueSet vr

Parameters:
Returns: ValueRange The mapped ValueRange

Map a function over a ValueRange.

fMin : Minimum -> Minimum

The function to apply to a Minimum

fMax : Maximum -> Maximum

The function to apply to a Maximum

fMinMax : Minimum * Maximum -> Minimum * Maximum

The function to apply to a MinMax

fIncr : Increment -> Increment

The function to apply to an Increment

fMinIncr : Minimum * Increment -> Minimum * Increment

The function to apply to a MinIncr

fIncrMax : Increment * Maximum -> Increment * Maximum

The function to apply to an IncrMax

fMinIncrMax : Minimum * Increment * Maximum -> Minimum * Increment * Maximum

The function to apply to a MinIncrMax

fValueSet : ValueSet -> ValueSet

The function to apply to a ValueSet

vr : ValueRange

The ValueRange

Returns: ValueRange

The mapped ValueRange

mapValueUnit f vr

Full Usage: mapValueUnit f vr

Parameters:
Returns: ValueRange The mapped ValueRange

Map a function to the ValueUnit of a ValueRange.

f : ValueUnit -> ValueUnit

The function to apply to the ValueUnit

vr : ValueRange

The ValueRange

Returns: ValueRange

The mapped ValueRange

maxIsMultipleOf incr max

Full Usage: maxIsMultipleOf incr max

Parameters:
Returns: bool

Check if max is a multiple of incr

incr : Increment
max : Maximum
Returns: bool

maxMultipleOf incr max

Full Usage: maxMultipleOf incr max

Parameters:
Returns: Maximum

Create a Maximum that is a multiple of incr.

Note that the resulting max is always inclusive and smaller than or equal to the original max.

incr : Increment

The increment

max : Maximum

The maximum

Returns: Maximum
Example

 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create false ( [| 5N |] |> ValueUnit.create Units.Mass.gram)
 max |> maxMultipleOf incr // returns Maximum.MaxIncl (ValueUnit ([|4N|], Mass (Gram 1N)))
val incr: obj
val max: obj

minEQmax max min

Full Usage: minEQmax max min

Parameters:
Returns: bool

Check if max = min.

Min can only be equal to max if both are inclusive!

max : Maximum

The maximum

min : Minimum

The minimum

Returns: bool

minGTmax max min

Full Usage: minGTmax max min

Parameters:
Returns: bool

Checks whether Minimum min > Maximum max. Note that inclusivity or exclusivity of a minimum and maximum must be accounted for.

max : Maximum

The maximum

min : Minimum

The minimum

Returns: bool
Example

 let min = Minimum.create false ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 min |> minGTmax max // returns true
val min: obj
val max: obj

minIncrMaxCount min incr max

Full Usage: minIncrMaxCount min incr max

Parameters:
Returns: RationalX The count of the ValueRange

Get the count of a ValueRange with a Minimum, Increment and a Maximum.

The Minimum and Maximum are restricted to multiples of the Increment. Therefore, they will also be inclusive.

min : Minimum

The Minimum

incr : Increment

The Increment

max : Maximum

The Maximum

Returns: RationalX

The count of the ValueRange

Example

 let min = Minimum.create false ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create true ( [|7N |] |> ValueUnit.create Units.Mass.gram)
 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 minIncrMaxCount min incr max // returns 2
val min: obj
val max: obj
val incr: obj

minIncrMaxToValueRange min incr max

Full Usage: minIncrMaxToValueRange min incr max

Parameters:
Returns: ValueRange

Create a MinIncrMaxValueRange.

min : Minimum

The minimum

incr : Increment

The increment

max : Maximum

The maximum

Returns: ValueRange
Exceptions.ValueRangeMinLargerThanMaxException When min > max

minIncrToValueRange min incr

Full Usage: minIncrToValueRange min incr

Parameters:
Returns: ValueRange A MinIncrValueRange

Create a MinIncrValueRange.

Note that the resulting min is always inclusive and greater than or equal to the original min and is a multiple of incr.

min : Minimum

The minimum

incr : Increment

The increment

Returns: ValueRange

A MinIncrValueRange

Example

 let min = Minimum.create false ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 minIncrToValueRange min incr
 // returns MinIncr (Minimum.MinIncl (ValueUnit ([|4N|], Mass (Gram 1N))), Increment (ValueUnit ([|2N|], Mass (Gram 1N))))
val min: obj
val incr: obj

minIsMultipleOf incr min

Full Usage: minIsMultipleOf incr min

Parameters:
Returns: bool
incr : Increment
min : Minimum
Returns: bool

minMaxToValueRange min max

Full Usage: minMaxToValueRange min max

Parameters:
Returns: ValueRange A MinMaxValueRange

Create a MinMaxValueRange. If min > max raises an MinLargerThanMax exception. If min equals max, a ValueSet with value min (= max).

min : Minimum

The minimum

max : Maximum

The maximum

Returns: ValueRange

A MinMaxValueRange

Exceptions.ValueRangeMinLargerThanMaxException When min > max

minMultipleOf incr min

Full Usage: minMultipleOf incr min

Parameters:
Returns: Minimum

Create a Minimum that is a multiple of incr.

Note that the resulting min is always inclusive and greater than or equal to the original min.

incr : Increment

The increment

min : Minimum

The minimum

Returns: Minimum
Example

 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram)
 let min = Minimum.create false ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 min |> minMultipleOf incr // returns Minimum.MinIncl (ValueUnit ([|4N|], Mass (Gram 1N)))
val incr: obj
val min: obj

minSTEmax max min

Full Usage: minSTEmax max min

Parameters:
Returns: bool

Checks whether Minimum min <= Maximum max

Note that inclusivity or exclusivity of a minimum and maximum must be accounted for.

max : Maximum

The maximum

min : Minimum

The minimum

Returns: bool
Example

 let min = Minimum.create false ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 let max = Maximum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 min |> minSTEmax max // returns false
val min: obj
val max: obj

nonZeroAndPositive vr

Full Usage: nonZeroAndPositive vr

Parameters:
Returns: ValueRange The resulting (more restrictive) non zero and non negative ValueRange

Make a ValueRange non zero and non negative. I.e., with at least a minimum that excludes zero.

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) non zero and non negative ValueRange

nonZeroPositive

Full Usage: nonZeroPositive

Returns: ValueRange

A ValueRange that contains only non-zero, positive values.

Returns: ValueRange

pickIndices indices vr

Full Usage: pickIndices indices vr

Parameters:
Returns: ValueRange

Pick the values at the given indices from a ValueRange vr.

indices : int array
vr : ValueRange
Returns: ValueRange

print exact isNonZero min incr max vs

Full Usage: print exact isNonZero min incr max vs

Parameters:
Returns: string

Create a string (to print) representation of a ValueRange by supplying the optional min, incr and max of the ValueRange. Exact true prints exact BigRationals, when false print as floating numbers

exact : bool
isNonZero : bool
min : Minimum option
incr : Increment option
max : Maximum option
vs : ValueSet option
Returns: string

prune steps incr n

Full Usage: prune steps incr n

Parameters:
Returns: ValueRange -> ValueRange

Prune, limit the number of values, in a ValueRange.

Only a ValueSet can be pruned. The other ValueRanges are left untouched.

steps : ValueUnit list
incr : ValueUnit option
n : int
Returns: ValueRange -> ValueRange

setIncr newIncr vr

Full Usage: setIncr newIncr vr

Parameters:
Returns: ValueRange The resulting (more restrictive) ValueRange

Apply a new newIncr to a ValueRange vr.

The resulting increment is the least common multiple of the new and the previous increment, so it holds only the values that lie on both. The resulting ValueRange will be equal or more restrictive than the original.

newIncr : Increment

The new increment

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) ValueRange

Example

 let min = Minimum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let vr = create true min incr None None
 // a value range with a minimum = 4 and an increment = 2
 let newIncr = Increment.create ( [| 3N |] |> ValueUnit.create Units.Mass.gram)
 vr |> setIncr newIncr
 // returns [6..6..>, i.e. a ValueRange with a Minimum = 6 and
 // an increment = 6, the least common multiple of 2 and 3
val min: obj option
union case Option.Some: Value: 'T -> Option<'T>
val incr: obj option
val vr: obj
union case Option.None: Option<'T>
val newIncr: obj

setMax newMax vr

Full Usage: setMax newMax vr

Parameters:
Returns: ValueRange The resulting (more restrictive) ValueRange

Apply a new Maximum newMax to a ValueRange vr.

If maximum cannot be set the original ValueRange is returned. So it always returns an equal or more restrictive, ValueRange.

newMax : Maximum

The new Maximum

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) ValueRange

Example

 let max = Maximum.create true ( [| 5N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let vr = create true None None max None
 // a value range with a maximum = 5
 let newMax = Maximum.create true ( [| 4N |] |> ValueUnit.create Units.Mass.gram)
 vr |> setMax newMax
 // returns a ValueRange with a Maximum = 4
val max: obj option
union case Option.Some: Value: 'T -> Option<'T>
val vr: obj
union case Option.None: Option<'T>
val newMax: obj

setMaxValue vr

Full Usage: setMaxValue vr

Parameters:
Returns: ValueRange

Set the maximum value of a ValueRange to a ValueSet with only the maximum value.

vr : ValueRange
Returns: ValueRange

setMedianValue vr

Full Usage: setMedianValue vr

Parameters:
Returns: ValueRange

Set the median value of a ValueRange to a ValueSet with only the median value.

vr : ValueRange
Returns: ValueRange

setMin newMin vr

Full Usage: setMin newMin vr

Parameters:
Returns: ValueRange The resulting (more restrictive) ValueRange

Apply a new Minimum newMin to a ValueRange vr.

A new minimum can only be set if it is larger than the previous minimum. Also, when an increment is set, the new minimum must be a multiple of the increment. When a new minimum cannot be set, the original ValueRange is returned.

newMin : Minimum

The new Minimum

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) ValueRange

Example

 let min = Minimum.create true ( [| 3N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let incr = Increment.create ( [| 2N |] |> ValueUnit.create Units.Mass.gram) |> Some
 let vr = create true min incr None None
 // a value range with a minimum = 4 and an increment = 2
 let newMin = Minimum.create true ( [| 5N |] |> ValueUnit.create Units.Mass.gram)
 vr |> setMin newMin
 // returns [6..2..>, i.e. a ValueRange with a Minimum = 6 and
 // and increment = 2
val min: obj option
union case Option.Some: Value: 'T -> Option<'T>
val incr: obj option
val vr: obj
union case Option.None: Option<'T>
val newMin: obj

setMinValue vr

Full Usage: setMinValue vr

Parameters:
Returns: ValueRange

Set the minimum value of a ValueRange to a ValueSet with only the minimum value.

vr : ValueRange
Returns: ValueRange

setUnit unt vr

Full Usage: setUnit unt vr

Parameters:
Returns: ValueRange The ValueRange with the new unit

Set the unit of a ValueRange to unt.

unt : Unit

The unit to set

vr : ValueRange

The ValueRange

Returns: ValueRange

The ValueRange with the new unit

setValueSet newVs vr

Full Usage: setValueSet newVs vr

Parameters:
Returns: ValueRange The resulting (more restrictive) ValueRange

Apply a new ValueSet newVs to a ValueRange vr.

The resulting ValueRange will be equal or more restrictive than the original. This means that if the new ValueSet is empty, the original ValueRange is returned. If the new ValueSet contains values the result will be an intersection of the original ValueRange and the new ValueSet.

newVs : ValueSet

The new ValueSet

vr : ValueRange

The ValueRange

Returns: ValueRange

The resulting (more restrictive) ValueRange

Example

 let vs = [| 1N..1N..10N |] |> ValueUnit.create Units.Mass.gram |> ValueSet.create
 let vr = create true None None None (Some vs)
 let newVs = [| 6N..2N..16N |] |> ValueUnit.create Units.Mass.gram |> ValueSet.create
 vr |> setValueSet newVs
 // returns a ValueRange with a values 6, 8 and 10
val vs: obj
val vr: obj
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val newVs: obj

toMarkdown prec vr

Full Usage: toMarkdown prec vr

Parameters:
Returns: string

Convert a ValueRange to a markdown string.

prec : int
vr : ValueRange
Returns: string

toProperties vr

Full Usage: toProperties vr

Parameters:
Returns: Set<Property>

Create a set of Properties from a ValueRange.

vr : ValueRange

Returns: Set<Property>
Example

 let min = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Minimum.create true
 let incr = 2N |> ValueUnit.singleWithUnit Units.Count.times |> Increment.create
 let max = 8N |> ValueUnit.singleWithUnit Units.Count.times |> Maximum.create false
 let vr = create true (Some min) (Some incr) (Some max) None
 vr |> toProperties
 // returns
 //     set
 //       [MinProp (MinIncl (ValueUnit ([|2N|], Count (Times 1N))));
 //        MaxProp (MaxIncl (ValueUnit ([|6N|], Count (Times 1N))));
 //        IncrProp (Increment (ValueUnit ([|2N|], Count (Times 1N))))]
val min: obj
val incr: obj
val max: obj
val vr: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>

toString exact vr

Full Usage: toString exact vr

Parameters:
Returns: string

Convert a ValueRange to a string.

exact : bool
vr : ValueRange
Returns: string

tryToValueSet maxCount vr

Full Usage: tryToValueSet maxCount vr

Parameters:
Returns: ValueSet option

The values of a range as one list, when it is a list, or a min, increment and max of fewer than maxCount values.

maxCount : int
vr : ValueRange
Returns: ValueSet option

unrestricted

Full Usage: unrestricted

Returns: ValueRange

An Unrestricted ValueRange.

Returns: ValueRange

valueSetIsSubsetOf vr2 vr1

Full Usage: valueSetIsSubsetOf vr2 vr1

Parameters:
Returns: bool

Checks whether a ValueRange vr1 is a subset of ValueRange vr2.

Only checks whether the ValueSet of vr1 is a subset of the ValueSet of vr2.

vr2 : ValueRange

The second ValueRange

vr1 : ValueRange

The first ValueRange

Returns: bool
Example

 let vs1 = [| 1N; 2N; 3N |] |> ValueUnit.withUnit Units.Count.times |> ValueSet.create
 let vs2 = [| 2N; 3N |] |> ValueUnit.withUnit Units.Count.times |> ValueSet.create
 let vr1 = create true None None None (Some vs1)
 let vr2 = create true None None None (Some vs2)
 vr1 |> isSubSetOf vr2 // returns false
 vr2 |> isSubSetOf vr1 // returns true
val vs1: obj
val vs2: obj
val vr1: obj
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val vr2: obj

Type something to start searching.