Logo GenPRES

ValueSet Module

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

apply f arg2

Full Usage: apply f arg2

Parameters:
Returns: 'a
Type parameters: 'a
f : ValueUnit -> 'a
arg1 : ValueSet
Returns: 'a

calc op vs1 vs2

Full Usage: calc op vs1 vs2

Parameters:
Returns: ValueSet

Apply a binary operator to two ValueSets.

op : ValueUnit -> ValueUnit -> ValueUnit

The operator to apply

vs1 : ValueSet

The first ValueSet

vs2 : ValueSet

The second ValueSet

Returns: ValueSet

contains v arg2

Full Usage: contains v arg2

Parameters:
Returns: bool

Check if a ValueSet contains a value.

Uses ValueUnit equality, so 1000 milligram equals 1 gram.

v : ValueUnit

The value to check

arg1 : ValueSet
Returns: bool

count arg1

Full Usage: count arg1

Parameters:
Returns: int

Count the number of values in a ValueSet.

arg0 : ValueSet
Returns: int

create vu

Full Usage: create vu

Parameters:
Returns: ValueSet A ValueSet

Create a ValueSet from a ValueUnit.

vu : ValueUnit

The ValueUnit

Returns: ValueSet

A ValueSet

Exceptions.ValueRangeEmptyValueSetException When the ValueSet is empty
Exceptions.ValueSetOverflow When the ValueSet has too many values

eqs arg1 arg2

Full Usage: eqs arg1 arg2

Parameters:
Returns: bool

Check if the first ValueSet is equal to the second ValueSet.

Uses ValueUnit equality, so 1000 milligram equals 1 gram.

arg0 : ValueSet
arg1 : ValueSet
Returns: bool

getIndices vs1 vs2

Full Usage: getIndices vs1 vs2

Parameters:
Returns: int array

Get the indices of the values in the first ValueSet that are also in the second ValueSet.

vs1 : ValueSet
vs2 : ValueSet
Returns: int array

getMax arg1

Full Usage: getMax arg1

Parameters:
Returns: Maximum option

Get the maximum value of a ValueSet.

arg0 : ValueSet
Returns: Maximum option

getMedian

Full Usage: getMedian

Returns: ValueSet -> ValueSet

Get the median value of a ValueSet.

Returns: ValueSet -> ValueSet

getMin arg1

Full Usage: getMin arg1

Parameters:
Returns: Minimum option

Get the minimum value of a ValueSet.

arg0 : ValueSet
Returns: Minimum option

intersect arg1 arg2

Full Usage: intersect arg1 arg2

Parameters:
Returns: ValueSet

Calculate the intersection of two ValueSets.

Returns a 'ValueSet' that contains the values that are in both 'ValueSet's and that has the unit of the first 'ValueSet'.

arg0 : ValueSet
arg1 : ValueSet
Returns: ValueSet

isEmpty arg1

Full Usage: isEmpty arg1

Parameters:
Returns: bool

Check if a ValueSet is empty.

arg0 : ValueSet
Returns: bool

isSolved

Full Usage: isSolved

Returns: ValueSet -> bool

Check if a ValueSet is solved

Returns: ValueSet -> bool

isSubset vs1 vs2

Full Usage: isSubset vs1 vs2

Parameters:
Returns: bool

Check if the first ValueSet is a subset of the second ValueSet.

vs1 : ValueSet
vs2 : ValueSet
Returns: bool

map f arg2

Full Usage: map f arg2

Parameters:
Returns: ValueSet

Map f to the ValueUnit of a ValueSet.

f : ValueUnit -> ValueUnit

The mapping function

arg1 : ValueSet
Returns: ValueSet

minIncrMaxToValueSet min incr max

Full Usage: minIncrMaxToValueSet min incr max

Parameters:
Returns: ValueSet

Create a ValueSet from an Increment, Minimum and a Maximum.

If the increment is the result of a calculation, it is possible that the set will contain more values that would be obtained by the calculation. If you multiply a ValueSet [3;6] with a ValueSet [2;4;6] you get [6;12;18;24;36]. However, if you create a value set using a minimum of 6, an increment of 6 and a maximum of 36, you get [6;12;18;24;30;36]. However, 30 cannot be multiplying [3;6] with [2;4;6].

min : Minimum

The minimum

incr : Increment

The increment

max : Maximum

The maximum

Returns: ValueSet

nonZeroAndPositive

Full Usage: nonZeroAndPositive

Returns: ValueSet -> ValueSet

Filters out the values that are zero or negative.

Will throw an exception if the resulting ValueSet is empty.

Returns: ValueSet -> ValueSet

pickIndices indices _arg1

Full Usage: pickIndices indices _arg1

Parameters:
    indices : int array - The indices of the values to pick
    _arg1 : ValueSet

Returns: ValueSet A ValueSet with the picked values

Pick the values at the given indices from a ValueSet.

indices : int array

The indices of the values to pick

_arg1 : ValueSet
Returns: ValueSet

A ValueSet with the picked values

prune steps incr n

Full Usage: prune steps incr n

Parameters:
Returns: ValueSet -> ValueSet

Prune the ValueUnit of a ValueSet to at most n values on rounded steps.

With an increment, the multiples of the finest step that leaves at most n values are kept. A step counts when it is in the unit group of the values and is a multiple of the increment, compared in the unit of the values. Without a step for the unit group the step is 1, then multiples of 1. When a step leaves more than n values and the next fewer than two, or there is no next step, the multiples of that step times m are kept. The minimum and maximum come back only when fewer than two values remain. Without an increment, n values are kept spread over the set.

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

setUnit u

Full Usage: setUnit u

Parameters:
Returns: ValueSet -> ValueSet

Convert the unit of a ValueSet to u.

u : Unit
Returns: ValueSet -> ValueSet

toMarkdown prec vs

Full Usage: toMarkdown prec vs

Parameters:
    prec : int - The precision to print values with
    vs : ValueSet - The ValueSet

Returns: string

Get a markdown representation of a ValueSet.

prec : int

The precision to print values with

vs : ValueSet

The ValueSet

Returns: string

toString exact vs

Full Usage: toString exact vs

Parameters:
    exact : bool - Whether values should be printed 'exact'
    vs : ValueSet - The ValueSet

Returns: string

Get a string representation of a ValueSet.

exact : bool

Whether values should be printed 'exact'

vs : ValueSet

The ValueSet

Returns: string

toValueUnit arg1

Full Usage: toValueUnit arg1

Parameters:
Returns: ValueUnit

Get the ValueUnit of a ValueSet.

arg0 : ValueSet
Returns: ValueUnit

Type something to start searching.