The utilities module provides various helper functions for the fxSimplex library.
- Source:
Methods
(inner) trim(x, precision) → {number}
- Source:
Helps to avoid floating point errors.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The number to trim. |
precision |
number | The number of digits to return - optional. Default: 7. |
Returns:
The trimmed number.
- Type
- number
(inner) testVariable(variable, prefixes) → {boolean}
- Source:
Tests a variable against an array of prefixes to determine if the variable starts with the prefix.
Parameters:
Name | Type | Description |
---|---|---|
variable |
string | A variable in the form of x1 y2, z3, etc. |
prefixes |
Array | An array (of strings) of prefixes (e.g., ['a','e'] ) against which to see if the variable matches. |
Returns:
Whether the variable matches one of the supplied prefixes.
- Type
- boolean
(inner) testRegex(input, testRegex, type)
- Source:
- Since:
- v2.0.0
Tests the result of a regex match to ensure that the input is of the proper formatting and that no reserved variables (e.g., s1, e1, a1) have been used.
Parameters:
Name | Type | Description |
---|---|---|
input |
string | The original string matched by the regex. |
testRegex |
string | The regex to test for matches - if this returns null the statement is improperly formatted. |
type |
string | The type of input ['constraint' | 'objective']. |
(inner) multipleSolutionTest(model, variables, basicVariables, nonBasicVariables) → {boolean}
- Source:
Tests whether the computed model has multiple solutions
Parameters:
Name | Type | Description |
---|---|---|
model |
Array | The simplex tableau. |
variables |
Array | An array of variable names (strings) corresponding to the tableau. |
basicVariables |
Array | An array of variable names (strings) of those variables corresponding to the basis. |
nonBasicVariables |
Array | An array of variable names (strings) of those variables corresponding to those not in the basis. |
Returns:
Returns true if the there are multiple solutions, false otherwise.
- Type
- boolean