Cody

# Problem 44509. Determine if input is a valid AHP evaluation matrix

Solution 1582792

Submitted on 13 Jul 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = [1 1 1 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test1 (line 4) assert(isequal(isValidAHP(x),y_correct))

2   Fail
x = [1 2 1/2 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test2 (line 4) assert(isequal(isValidAHP(x),y_correct))

3   Fail
k = randi([2 9]); x = [1 k 1/k 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test3 (line 5) assert(isequal(isValidAHP(x),y_correct))

4   Fail
k = randi([2 9]); x = [1 k 1/k k]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test4 (line 5) assert(isequal(isValidAHP(x),y_correct))

5   Fail
x = [1 5 1/5 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test5 (line 4) assert(isequal(isValidAHP(x),y_correct))

6   Fail
x = [1 4 1/4 2]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test6 (line 4) assert(isequal(isValidAHP(x),y_correct))

7   Fail
x = [1 1 1 1 1 1 1 1 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test7 (line 5) assert(isequal(isValidAHP(x),y_correct))

8   Fail
x = [1 2 3 1/2 1 4 1/3 1/4 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test8 (line 5) assert(isequal(isValidAHP(x),y_correct))

9   Fail
x = [1 2 3 1/2 0 4 1/3 1/4 1]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test9 (line 5) assert(isequal(isValidAHP(x),y_correct))

10   Fail
x = [1 1 1 1 1 1 1 1 0.5]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test10 (line 5) assert(isequal(isValidAHP(x),y_correct))

11   Fail
x = [1 1 95 1 1 1 1 1 1]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test11 (line 5) assert(isequal(isValidAHP(x),y_correct))

12   Fail
x = [1 2 2 1/2 1 2 1/2 1/2 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test12 (line 5) assert(isequal(isValidAHP(x),y_correct))

13   Fail
m = randi([2 5]); x = [1 m m 1/m 1 m 1/m 1/m 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test13 (line 6) assert(isequal(isValidAHP(x),y_correct))

14   Fail
x = [1 2 3 4 1/2 1 5 6 1/3 1/5 1 7 1/4 1/6 1/7 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test14 (line 6) assert(isequal(isValidAHP(x),y_correct))

15   Fail
x = [0 2 3 4 1/2 0 5 6 1/3 1/5 0 7 1/4 1/6 1/7 0]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test15 (line 6) assert(isequal(isValidAHP(x),y_correct))

16   Fail
x = [1 1 1 1 1 1 1 1 1 1 1 1 ]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test16 (line 5) assert(isequal(isValidAHP(x),y_correct))

17   Fail
x = [1 1 1 1 1 1 1 1 1 1 1 1 ]; y_correct = 0; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test17 (line 6) assert(isequal(isValidAHP(x),y_correct))

18   Fail
x = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test18 (line 7) assert(isequal(isValidAHP(x),y_correct))

19   Fail
x = [1 0.125 0.125 0.111 0.125 0.125; 8 1 1 0.143 0.143 0.2; 8 1 1 0.111 0.111 0.143; 9 7 9 1 5 7; 8 7 9 0.2 1 0.333; 8 5 7 0.143 3 1]; y_correct = 1; assert(isequal(isValidAHP(x),y_correct))

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test19 (line 8) assert(isequal(isValidAHP(x),y_correct))

20   Fail
for idx = 1:20 x = ones(randi([1 20])); y_correct = 1; assert(isequal(isValidAHP(x),y_correct)) end

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test20 (line 4) assert(isequal(isValidAHP(x),y_correct))

21   Fail
for idx = 1:20 x = zeros(randi([1 20])); y_correct = 0; assert(isequal(isValidAHP(x),y_correct)) end

Error: File: isValidAHP.m Line: 7 Column: 3 A BREAK statement appeared outside of a loop. Use RETURN instead. Error in Test21 (line 4) assert(isequal(isValidAHP(x),y_correct))