simplex

The simplex module provides the entry point for fxSimplex.

Source:

Methods

(inner) buildSolution(model, basicVariables, nonBasicVariables, result) → {Object}

Source:

Formats the final solution for return back to the simplex function.

Parameters:
Name Type Description
model Array

A two-dimensional array of numbers representing the current simplex tableau.

basicVariables Array

An array of strings representing the basic variables of the tableau.

nonBasicVariables Array

An array of strings representing the non-basic variables of the tableau.

result string

The result of the final tableau pivot. One of ['solved', 'multiple solutions', 'unbounded']

Returns:

Key-value pairs representing the solution (a two-dimensional array of variable (string) and coefficient (number) pairs), and the result (string).

Type
Object

(inner) executeSimplex(model, basicVariables, nonBasicVariables, type) → {Array}

Source:

Iteratively executes the simplex method for either one-phase or two-phase models until a solution is found or the model is determined to be unbounded.

Parameters:
Name Type Description
model Array

A two-dimensional array of numbers representing the current simplex tableau.

basicVariables Array

An array of strings representing the basic variables of the tableau.

nonBasicVariables Array

An array of strings representing the non-basic variables of the tableau.

type string

The type of optimization ['min' | 'max'].

Returns:

An array containing the final tableau (two-dimensional array of numbers) and and object containing key-value pairs representing the final pivot row and column indices.

Type
Array

(inner) simplex(objective) → {Object}

Source:

The simplex function is the entry point for fxSimplex and is the only object exposed by the library.

Parameters:
Name Type Description
objective string

The objective function in the form of 'Maximize Z = 1x + 5y'.

Returns:

An object with the solution (an array of key value pairs for the basic variables and their coefficients in the form of [['y', 10],['x', 10], ['Z', 20],...]) and a result: a string in the form of ['solved' | 'infeasible' | 'unbounded' | 'multiple solutions']. If the optimization is successful, the result will be either solved or multiple solutions, and the solution will contain optimal coefficients. If the result returns infeasible or unbounded, the optimization has failed and the coefficients returned in the solution will reflect the final tableau reached and not be optimal.

Type
Object