Question: Problem 5 ( 1 0 pts ) . In this problem, we compare efficiency of various pivot rules on randomly generated linear optimization problems. For

Problem 5(10 pts). In this problem, we compare efficiency of various pivot rules on randomly
generated linear optimization problems. For your submission, include your code for parts (a)-(c),
the histograms from (c), and your written response for (d).
(a) Write modified simplex algorithms pivots_LC and pivots_B that only output the number
of pivots used when following the largest coefficient rule or Bland's rule. One way of doing
this is to start with t=0, add 1 to t each time a pivot is performed, and return t at the
end of the algorithm.
(b) The largest increase rule selects an entering variable that increases the objective function
the most during the pivot. One (inefficient) way of implementing this rule that does not
require modifying our earlier code is shown below, and you are free to use this.n = len(T[-1,:])-1 #total num of variablesr = pivot_row(T,index) #corresponding pivot rowfor j in range(index +1,n): r = pivot_row(T,j) #find corresponding pivot row return j #case of infinite increase increase =-T[-1,j]*T[r,-1]/T[r,j] #when j is pivot column max_increase = increase #overwrite previous bestreturn index #outputs index for maximum increaseRepeat part (a) by writing an algorithm pivots_LI that counts the number of pivots needed
when using this rule.
(c) The code below generates 1000 problems where AinR5050 and b,cinR50 consist of integers
between 0 and 200, solves them using the simplex algorithm with largest coefficient rule,
records the number of pivots needed in data_LC, and plots the resulting data in a histogram.data_LC = numpy.zeros(1000)
for i in range(1000):T[0:50,0:50]= numpy.random.randint (0,201,(50,50))T[50,0:50]=-1*numpy.random.randint (0,201,50)plt.hist(data_LC,bins=range(0,51))Adapt the above code to generate histograms for the number of iterations needed when
using Bland's rule or the largest increase rule. Then produce the three histograms, one for
each rule.
(d) Which of the three pivot rules appears to be most efficient? Why do you think this rule
usually performs better than the others?
 Problem 5(10 pts). In this problem, we compare efficiency of various

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!