GenSolver


Variable

Namespace: Informedica.GenSolver.Lib

Contains functions and types to represent a Variable in an Equation:

Nested types and modules

TypeDescription
Variable

Represents a variable in an Equation. The variable is identified by Name and has a Values that are either Unrestricted or restricted by a ValueSet or a Range.

ModuleDescription
Name

Funcions and type to handle Name that represents the name of a Variable.

ValueRange

Functions and types to handle ValueRange.

Functions and values

Function or valueDescription
apply f var
Signature: f:(Variable -> '?6776) -> var:Variable -> '?6776
Type parameters: '?6776

Apply f to Variable var.

calc op (v1, v2)
Signature: op:(ValueRange -> ValueRange -> ValueRange) -> (v1:Variable * v2:Variable) -> Variable

Apply the operator op to v1 and v2 return an intermediate result Variable.

count v
Signature: v:Variable -> int

Get the number of distinct values

create succ n vs
Signature: succ:(Variable -> '?6772) -> n:Name -> vs:ValueRange -> '?6772
Type parameters: '?6772

Create a Variable and passes the result to succ

createRes
Signature: ValueRange -> Variable

Helper create function to store the result of a Variable calculation before applying to the actual result Variable.

createSucc
Signature: Name -> ValueRange -> Variable

Create a Variable and directly return the result.

eqName v1 v2
Signature: v1:Variable -> v2:Variable -> bool

Checks whether v1 and v2 have the same Name

get
Signature: Variable -> Variable

Helper function for type inference

getName v
Signature: v:Variable -> Name

Get the Name of a Variable.

getValueRange v
Signature: v:Variable -> ValueRange

Get the ValueRange of aVariable`.

isSolvable
Signature: Variable -> bool

Checks whether a Variable is solvable i.e. can be further restricted to one value (or no values at all)

isSolved v
Signature: v:Variable -> bool

Checks whether a Variable v is solved, i.e. there is but one possible value or there are no possible values left.

isUnrestricted
Signature: Variable -> bool

Checks whether there are no restrictions to possible values a Variable can contain

setName n v
Signature: n:Name -> v:Variable -> Variable

Change Name to n.

setNonZeroOrNegative v
Signature: v:Variable -> Variable

Set the values to a ValueRange that prevents zero or negative values.

setValueRange v vr
Signature: v:Variable -> vr:ValueRange -> Variable

Apply a ValueRange vr to Variable v.

Fork me on GitHub