Optimization: principles and algorithms, by Michel Bierlaire
pivoting.m
Go to the documentation of this file.
1 %> \file
2 %> Algorithm 16.3: Pivoting of the simplex tableau. Implementation of algorithm 16.3 of \cite Bier15-book
3 %>
4 %> @note Tested with \ref run1612pivoting.m
5 %> @note Called by \ref simplexTableau
6 %> @note Called by \ref twoPhasesSimplex
7 %>
8 %> @author Michel Bierlaire
9 %> @date Sun Mar 22 12:43:21 2015
10 %> @ingroup Algorithms
11 %> @ingroup chap16
12 
13 %> Pivot the tableau
14 %> @param tab the simplex tableau
15 %> @param l the row of the pivot
16 %> @param j the column of the pivot
17 %> @return newtab the pivoted tableau
18 function newtab = pivoting(tab,l,j)
19  [mtab,ntab] = size(tab) ;
20  if (l > mtab)
21  error("The row of the pivot exceeds the size of the tableau") ;
22  endif
23  if (j > ntab)
24  error("The column of the pivot exceeds the size of the tableau") ;
25  endif
26  thepivot = tab(l,j) ;
27  if (abs(thepivot) < realmin)
28  error("The pivot is too close to zero") ;
29  endif
30 
31  thepivotrow = tab(l,:) ;
32  newtab = tab ;
33  for i=1:mtab
34  if (i == l)
35  newtab(l,:) = newtab(l,:) / thepivot ;
36  else
37  mult = -newtab(i,j) / thepivot ;
38  newtab(i,:) = newtab(i,:) + mult * thepivotrow ;
39  endif
40  endfor
41 endfunction
function twoPhasesSimplex(in A, in b, in c)
Solve a linear optimization problem in standard form using the tableau simplex with two phases subje...
function simplexTableau(in tab, in rowindex)
Solve a linear optimization problem in standard form using the tableau simplex.
function pivoting(in tab, in l, in j)
Pivot the tableau.
function simplex(in A, in b, in c, in basis)
Applies the simplex method to solve subject to and , where , , and .
Copyright 2015-2018 Michel Bierlaire