Created
April 3, 2016 17:13
-
-
Save maxkarelov/dcf2d689b046b2d68dc1a140559e7e52 to your computer and use it in GitHub Desktop.
AI task 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def com(A, B): | |
result = [[[] for j in range(0, 4)] for i in range(0, 4)] | |
for i in range(0, 4): | |
T = [] | |
for j in range(0, 4): | |
for k in range(0, 4): | |
result[i][j].append(min(A[i][k], B[k][j])) | |
return result | |
if __name__ == '__main__': | |
A = [[0.9, 0.2, 0.6, 0.4], | |
[0.2, 0.6, 0.3, 0.4], | |
[0.2, 0.4, 0.6, 0.3], | |
[0.3, 0.9, 0.6, 0.1]] | |
B = [[0.6, 0.2, 0.4, 0.3], | |
[0.3, 0.6, 0.6, 0.4], | |
[0.9, 0.2, 0.1, 0.2], | |
[0.6, 0.6, 0.4, 0.2]] | |
raw = com(A, B) | |
print [[max(raw[i][j]) for j in range(0, 4)] for i in range(0, 4)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment