Algorithm::Simplex - An implementation of the Simplex Algorithm.


Algorithm-Simplex documentation  | view source Contained in the Algorithm-Simplex distribution.

Index


Name

Top

Algorithm::Simplex - An implementation of the Simplex Algorithm.

Synopsis

Top

Given a linear program formulated as a Tucker tableau, a 2D matrix or ArrayRef[ArrayRef] in Perl, seek an optimal solution.

    use Algorithm::Simplex::Rational;
    my $matrix = [
        [ 5,  2,  30],
        [ 3,  4,  20],
        [10,  8,   0],
    ];
    my $tableau = Algorithm::Simplex::Rational->new( tableau => $matrix );
    $tableau->solve;
    my ($primal_solution, $dual_solution) = $tableau->current_solution;

Methods

Top

_build_number_of_rows

Set the number of rows

_build_number_of_columns

Set the number of columns given the tableau matrix

_build_x_variables

Set x variable names for the given tableau.

get_bland_number_for

Given a column number (which represents a u variable) build the bland number from the generic variable name.

determine_bland_pivot_column_number

Find the pivot column using Bland ordering technique to prevent cycles.

determine_bland_pivot_row_number

Find the pivot row using Bland ordering technique to prevent cycles.

min_index

Determine the index of the element with minimal value. Used when finding bland pivots.

exchange_pivot_variables

Exchange the variables when the a pivot is done. The method pivot does the algrebra while this method does the variable swapping (and thus tracking).

get_row_and_column_numbers

Get the dimensions of the tableau.

determine_bland_pivot_row_and_column_numbers

Higher level function that uses others to return the (bland) pivot point.

Authors

Top

Mateu X. Hunter hunter@missoula.org

Strong design influence by George McRae at the University of Montana.

#moose for solid assistance in the refactor: particularly _build_* approach and PDL + Moose namespace management, 'inner'.

Copyright

Top

License

Top

You may distribute this code under the same terms as Perl itself.

Description

Top

Base class for the Simplex model using Tucker tableaus. It defines some of the methods concretely, and others such as:

are implemented in one of the three model types:

Variables

Top

We have implicit variable names: x1, x2 ... , y1, y2, ... , u1, u2 ... , v1, v2 ...

Our variables are represented by:

    x, y, u, and v 

as found in Nering and Tuckers' book.

x and y are for the primal LP while u and v belong to the dual LP.

These variable names are set during BUILD of the tableau object.

Limitations

Top

The API is stabilizing, but still subject to change.

The algorithm requires that the initial tableau be a feasible solution.

Development

Top

http://github.com/mateu/Algorithm-Simplex


Algorithm-Simplex documentation  | view source Contained in the Algorithm-Simplex distribution.