criteria = {'C1', 'C2', 'C3'};
best_index = input('Enter the index of the best criterion (1-3): ');
Error using input
Support for user input is required, which is not available on this platform.
worst_index = input('Enter the index of the worst criterion (1-3): ');
B(i, :) = input(['Enter triangular fuzzy preference of best criterion over ', criteria{i}, ' as [low mid high]: ']);
if B(i, 1) <= B(i, 2) && B(i, 2) <= B(i, 3)
disp('Error: Ensure low <= mid <= high. Please re-enter.');
W(i, :) = input(['Enter triangular fuzzy preference of ', criteria{i}, ' over worst criterion as [low mid high]: ']);
if W(i, 1) <= W(i, 2) && W(i, 2) <= W(i, 3)
disp('Error: Ensure low <= mid <= high. Please re-enter.');
variable w(n, 3) nonnegative
w(best_index, 1) - B(i, 1) * w(i, 1) <= k* w(i, 1);
w(best_index, 1) - B(i, 1) * w(i, 1) >= -k* w(i, 1);
w(best_index, 2) - B(i, 2) * w(i, 2) <= k* w(i, 2);
w(best_index, 2) - B(i, 2) * w(i, 2) >= -k* w(i, 2);
w(best_index, 3) - B(i, 3) * w(i, 3) <= k* w(i, 3);
w(best_index, 3) - B(i, 3) * w(i, 3) >= -k* w(i, 3);
w(i, 1) - W(i, 1) * w(worst_index, 1) <= k* w(worst_index, 1);
w(i, 1) - W(i, 1) * w(worst_index, 1) >= -k* w(worst_index, 1);
w(i, 2) - W(i, 2) * w(worst_index, 2) <= k * w(worst_index, 2);
w(i, 2) - W(i, 2) * w(worst_index, 2) >= -k * w(worst_index, 2);
w(i, 3) - W(i, 3) * w(worst_index, 3) <= k* w(worst_index, 3);
w(i, 3) - W(i, 3) * w(worst_index, 3) >= -k* w(worst_index, 3);
(w(1, 1)+ w(2, 1)+ w(3, 1))+ 4*(w(1, 2)+ w(2, 2)+ w(3, 2))+ (w(1, 3)+ w(2, 3)+ w(3, 3))/6 == 1
disp('Optimal Triangular Fuzzy Weights for Criteria:');
disp('Consistency Value (Slack Variable):');
w(best_index, 1) - B(i, 1) * w(i, 1) <= k;
w(best_index, 1) - B(i, 1) * w(i, 1) >= -k;
w(best_index, 2) - B(i, 2) * w(i, 2) <= k;
w(best_index, 2) - B(i, 2) * w(i, 2) >= -k;
w(best_index, 3) - B(i, 3) * w(i, 3) <= k;
w(best_index, 3) - B(i, 3) * w(i, 3) >= -k;
w(i, 1) - W(i, 1) * w(worst_index, 1) <= k;
w(i, 1) - W(i, 1) * w(worst_index, 1) >= -k;
w(i, 2) - W(i, 2) * w(worst_index, 2) <= k ;
w(i, 2) - W(i, 2) * w(worst_index, 2) >= -k;
w(i, 3) - W(i, 3) * w(worst_index, 3) <= k;
w(i, 3) - W(i, 3) * w(worst_index, 3) >= -k;