Logo GenPRES

Solver Module

Solves a list of product and sum equations, solving again every equation that holds a changed variable until no variable changes. Returns the equations with the errors when solving fails.

Functions and values

Function or value Description

contains eq eqs

Full Usage: contains eq eqs

Parameters:
    eq : 'a - The Equation to check for
    eqs : 'a list - The list of Equation to check in

Returns: bool
Type parameters: 'a (requires equality)

Checks whether a list of Equation eqs contains an Equation eq

eq : 'a

The Equation to check for

eqs : 'a list

The list of Equation to check in

Returns: bool

printEqs exact pf eqs

Full Usage: printEqs exact pf eqs

Parameters:
    exact : bool - Whether to print the exact value
    pf : string -> unit - The print function
    eqs : Equation list - The equations to print

Returns: Equation list

Format a set of equations to print. Using f to allow additional processing of the string.

exact : bool

Whether to print the exact value

pf : string -> unit

The print function

eqs : Equation list

The equations to print

Returns: Equation list

replace vars eqs

Full Usage: replace vars eqs

Parameters:
    vars : Variable list - The list of Variable to replace
    eqs : Equation list - The list of Equation to replace in

Returns: Equation list * Equation list

Replace a list of Variable vs in a list of Equation es, return a list of replaced Equation and a list of unchanged Equation

vars : Variable list

The list of Variable to replace

eqs : Equation list

The list of Equation to replace in

Returns: Equation list * Equation list

solve onlyMinIncrMax log sortQue var eqs

Full Usage: solve onlyMinIncrMax log sortQue var eqs

Parameters:
    onlyMinIncrMax : bool - Whether to only use min, incr and max
    log : Logger - The log function
    sortQue : bool -> Equation list -> (int * Equation) list - The sort function for the que
    var : Variable option - An option variable to solve for
    eqs : Equation list - The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

Solve a set of equations.

onlyMinIncrMax : bool

Whether to only use min, incr and max

log : Logger

The log function

sortQue : bool -> Equation list -> (int * Equation) list

The sort function for the que

var : Variable option

An option variable to solve for

eqs : Equation list

The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

solveAll onlyMinIncrMax log eqs

Full Usage: solveAll onlyMinIncrMax log eqs

Parameters:
    onlyMinIncrMax : bool - Whether to only use min, incr and max
    log : Logger - The log function
    eqs : Equation list - The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

Solve a set of equations for all variables.

onlyMinIncrMax : bool

Whether to only use min, incr and max

log : Logger

The log function

eqs : Equation list

The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

solveVariable onlyMinIncrMax log sortQue vr eqs

Full Usage: solveVariable onlyMinIncrMax log sortQue vr eqs

Parameters:
    onlyMinIncrMax : bool - Whether to only use min, incr and max
    log : Logger - The log function
    sortQue : bool -> Equation list -> (int * Equation) list - The sort function for the que
    vr : Variable - The variable to solve for
    eqs : Equation list - The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

Solve a set of equations for a specific variable.

onlyMinIncrMax : bool

Whether to only use min, incr and max

log : Logger

The log function

sortQue : bool -> Equation list -> (int * Equation) list

The sort function for the que

vr : Variable

The variable to solve for

eqs : Equation list

The equations to solve

Returns: Result<Equation list, (Equation list * Message list)>

sortByName eqs

Full Usage: sortByName eqs

Parameters:
    eqs : Equation list - The list of Equations

Returns: Equation list

Sort a list of equations by the name of the first variable in the equation.

eqs : Equation list

The list of Equations

Returns: Equation list

sortQue onlyMinMax eqs

Full Usage: sortQue onlyMinMax eqs

Parameters:
    onlyMinMax : bool - Whether only min incr max is calculated
    eqs : Equation list - The list of Equations

Returns: (int * Equation) list

Sort a list of equations by the number of total values in the equation.

onlyMinMax : bool

Whether only min incr max is calculated

eqs : Equation list

The list of Equations

Returns: (int * Equation) list

Type something to start searching.