Write a MATLAB function that performs the reduce-by-dominance method. The functi
ID: 3538385 • Letter: W
Question
Write a MATLAB function that performs the reduce-by-dominance method. The function takes a payoff matrix of any size as an input, performs the method, and results a reduced payoff matrix as an output if the input is reducible. For instance, if the payoff matrix is 3x3, the function should compare the 1st row to 2nd and 3rd, 2nd to 3rd, 1st column to 2nd and 3rd, and 2nd to 3rd. This will be repeated until there is no either a row or column that dominates another. (Note: You should use loops.)
Definition of Reduction by Dominance One row dominates another if every element in the row is greater than or equal to the corresponding element in the other. In other words, one row dominates another if it is always at least as good for the row player. One column dominated another if every element in the column is less than or equal to the corresponding element in the other. In other words, one column dominates another if it is always at least as good for the column player.
Explanation / Answer
%payoff_matrix should be give as input by you, for example if payoff matrix is the 3x3 matrix like this
1 2 3
4 5 6
7 8 9
then you can store it by using the following line of code:
payoff_matrix = [ 1 2 3; 4 5 6; 7 8 9;];
% the actual code starts below....
function [result_matrix] = reduce_by_dominance(payoff_matrix)
%payoff_matrix -> input
%result_matrix -> reduced matrix
%first store the size of the matrix
rows = size(payoff_matrix,1);
cols = size(payoff_matrix,2);
%Now check for dominant rows
for i=1:rows,
for j=i:rows,
if(payoff_matrix(i,:)>payoff_matrix(j,:)
%delete the dominated row
payoff_matrix(j,:) = [];
end;
end;
end;
%Now check for dominant columns
for i=1:cols,
for j=i:cols,
if(payoff_matrix(:,i)<payoff_matrix(:,j)
%delete the dominated column
payoff_matrix(:,j) = [];
end;
end;
end;
result_matrix = payoff_matrix;
%Hope you like my awesome code! :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.