Optimization: principles and algorithms, by Michel Bierlaire
run1607simplex.m
Go to the documentation of this file.
1 %> \file
2 %> Runs example 16.4 illustrating the simplex method
3 %>
4 %> @note Calls \ref simplex
5 %>
6 %> @ingroup Running
7 %> @ingroup chap16
8 %> @author Michel Bierlaire
9 %> @date Sun Mar 22 11:09:14 2015
10 A = [1 2 2 1 0 0 ; 2 1 2 0 1 0 ; 2 2 1 0 0 1] ;
11 b = [20 ; 20 ; 20 ] ;
12 c = [-10 ; -12 ; -12 ; 0 ; 0 ; 0 ] ;
13 basis = [4 5 6] ;
14 [optimalbasis,unbounded] = simplex(A,b,c,basis) ;
15 if (unbounded == 0)
16  B = A(:,optimalbasis) ;
17  xb = B \ b ;
18  xfull = zeros(size(c));
19  xfull(optimalbasis) = xb ;
20  xfull
21  printf("Objective function: %e\n",c'*xfull)
22 else
23  printf("Unbounded problem\n") ;
24 endif
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