Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Below is the program that is used in solving the above program % 03/02/2018 % % This function applies the simplex method to the LP
Below is the program that is used in solving the above program % 03/02/2018 % % This function applies the simplex method to the LP % % minimize c^Tx % s.t. Ax = b, x >=0, % % given an initial bfs. % % INPUTS: A - the constraint matrix A % b - the righthand side of the equality constriants % c - the vector of coefficients in the objective % basis_i - the initial choice of indices for the basic variables % % OUTPUTS: x_star - the optimal solution for the LP % obj_value - the obj. value at the optimal solution of the LP % basis_f - the indices of the basic variables at the LP optimal % solution % function [x_star,opt_value, basis_f] ... = SimplexLastnameFirstname(A,b,c,basis_i) % Initialize current basis. basis = basis_i; % Determine number of variables n = length(c); % Simplex Algorithm while 1 % Set up basic and nonbasic matrices. J = setdiff(1:n,basis); B = A(:,basis); N = A(:,J); % Obtain b_bar, the current obj. value, % and the reduced cost coefficients. xB = B\b; w = B'\c(basis); z = c(basis)'*xB; r = N'*w - c(J); % Check if we have reaced an optimal solution. if all(r 0); [~, my_index] = min(xB(I)./yk(I)); Br = basis(I(my_index)); % Update current basis basis = [setdiff(basis,Br),k]; end endExercise 4.3: Write a MATLAB function that uses the Simplex Algorithm to solve minimize cr Ax = b 20 while using the Two-Phase Method to obtain an initial bfs. Assume that both the Phase I and Phase LPs has all non-degenerate bf's. Your function should have the following header: function [x-star , opt-value, basis-f] simplex2LastnameFirstname (A , b , c) where you replace Lastname and Firstname with your own last and first names. For this MATLAB function, the input arguments A, b, and c should be as given by the minimization problem in The output variable x star should be the point that minimizes c over the feasible region, and opt_value should be the value of c"z at x_star. Finally, basis_f should be the indices of the columns of A corresponding to the basic variables at the final bfs. If no minimizer exists due to an unbounded objective or infeasibility, have your function display a message stating so. You may use the attached MATLAB function (a solution to Exercise 3.2) when making your Two-Phase Simplex Algorithm function Exercise 4.3: Write a MATLAB function that uses the Simplex Algorithm to solve minimize cr Ax = b 20 while using the Two-Phase Method to obtain an initial bfs. Assume that both the Phase I and Phase LPs has all non-degenerate bf's. Your function should have the following header: function [x-star , opt-value, basis-f] simplex2LastnameFirstname (A , b , c) where you replace Lastname and Firstname with your own last and first names. For this MATLAB function, the input arguments A, b, and c should be as given by the minimization problem in The output variable x star should be the point that minimizes c over the feasible region, and opt_value should be the value of c"z at x_star. Finally, basis_f should be the indices of the columns of A corresponding to the basic variables at the final bfs. If no minimizer exists due to an unbounded objective or infeasibility, have your function display a message stating so. You may use the attached MATLAB function (a solution to Exercise 3.2) when making your Two-Phase Simplex Algorithm function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started