Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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 end 
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 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

8. Providing support during instruction.

Answered: 1 week ago