Algorithm-Simplex
view release on metacpan or search on metacpan
Name
Algorithm::Simplex - Simplex Algorithm Implementation using Tucker
Tableaux
Synopsis
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
_build_number_of_rows
Set the number of rows. This number represent the number of rows of the
coefficient matrix. It is one less than the full tableau.
_build_number_of_columns
Set the number of columns given the tableau matrix. This number
represent the number of columns of the coefficient matrix.
_build_x_variables
Set x variable names for the given tableau, x1, x2 ... xn These are the
decision variables of the maximization problem. The maximization problem
is read horizontally in a Tucker tableau.
_build_y_variables
Set y variable names for the given tableau. These are the slack
variables of the maximization problem.
_build_u_variables
Set u variable names for the given tableau. These are the slack
variables of the minimization problem.
_build_v_variables
Set v variable names for the given tableau: v1, v2 ... vm These are the
decision variables for the minimization problem. The minimization
problem is read horizontally in a Tucker 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 a pivot is done. The method pivot() does the
algrebra while this method does the variable swapping, and thus tracking
of what variables take on non-zero values. This is needed to accurately
report an optimal solution.
get_row_and_column_numbers
( run in 1.517 second using v1.01-cache-2.11-cpan-0068ddc7af1 )