interface(quiet=true): with(linalg): die := rand(0..10000): alleins := transpose(array([[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]])): antibiotics := [AMP,AM,CEC,CTX,ZOX,CXM,CRO, AMC,CAZ,CTT,SAM,CPR,CPD,TZP,FEP]: labels2 := [ [0,0,0,0],[1,0,0,0],[0,1,0,0],[0,0,1,0], [0,0,0,1],[1,1,0,0],[1,0,1,0],[1,0,0,1], [0,1,1,0],[0,1,0,1],[0,0,1,1],[1,1,1,0], [1,1,0,1],[1,0,1,1],[0,1,1,1],[1,1,1,1]]: Data := [[0.001850833,0.001570000,0.002024167,0.001948333,0.002081667,0.002185833,0.000050800,0.002165000,0.002032500,0.002197500,0.002434167,0.000087500,0.002321667,0.000082500,0.000034200,0.002820833],[0.001777500,0.001720000,0.001448333,0.002041667,0.001781667,0.001556667,0.001799167,0.002008333,0.001184167,0.001544167,0.001751667,0.001767500,0.002246667,0.002005000,0.000062500,0.002046667],[0.002258333,0.000234167,0.002395833,0.002150833,0.001995833,0.002150000,0.002241667,0.000171667,0.002230000,0.001845833,0.002647500,0.002640000,0.000095000,0.000093300,0.000214167,0.000515833],[0.000160000,0.000185000,0.001653333,0.001935833,0.000085000,0.000225000,0.001969167,0.000140000,0.002295000,0.000137500,0.002347500,0.000119167,0.000091700,0.000203333,0.002269167,0.002411667],[0.000993333,0.001105833,0.001697500,0.002069167,0.000805000,0.001115833,0.001894167,0.001170833,0.002137500,0.002010000,0.002682500,0.001103333,0.001105000,0.000680833,0.002688333,0.002590833],[0.001747500,0.000422500,0.002940000,0.002070000,0.001700000,0.002024167,0.001910833,0.001578333,0.002918333,0.002173333,0.001937500,0.001590833,0.001677500,0.002754167,0.003271667,0.002923333],[0.001091667,0.000830000,0.002880000,0.002554167,0.000286667,0.001406667,0.003172500,0.000540000,0.002731667,0.000655833,0.003041667,0.002740000,0.000750833,0.001152500,0.000435833,0.003226667],[0.001435000,0.001416667,0.001671667,0.001060833,0.001573333,0.001376667,0.001537500,0.001350833,0.000073300,0.001625000,0.001456667,0.001306667,0.001914167,0.001590000,0.000067500,0.001727500],[0.002134167,0.000288333,0.002041667,0.002618333,0.002655833,0.002630000,0.001604167,0.000575833,0.002924167,0.002755833,0.002687500,0.002893333,0.002676667,0.001378333,0.000250833,0.002562500],[0.002125000,0.003238333,0.003290833,0.002804167,0.001921667,0.000545833,0.002882500,0.002965833,0.003081667,0.002887500,0.000587500,0.003192500,0.003180833,0.000890000,0.003507500,0.002543333],[0.001879167,0.002197500,0.002455833,0.000133333,0.002532500,0.002504167,0.002308333,0.002570000,0.000083300,0.002436667,0.000094200,0.002528333,0.003001667,0.002885833,0.000094200,0.003453333],[0.001743333,0.001553333,0.002017500,0.001762500,0.001661667,0.000222500,0.000165000,0.000255833,0.002041667,0.002050000,0.001785000,0.001810833,0.000239167,0.000220833,0.000217500,0.000288333],[0.000595000,0.000431667,0.001760833,0.002604167,0.000245000,0.000637500,0.002650833,0.000388333,0.002910000,0.001470833,0.003042500,0.000962500,0.000985833,0.001102500,0.003095833,0.003268333],[0.002679167,0.002709167,0.003037500,0.002426667,0.002905833,0.002453333,0.000171667,0.002500000,0.002527500,0.003309167,0.000140833,0.000609167,0.002739167,0.000093300,0.000142500,0.000170833],[0.002590000,0.002066667,0.002440000,0.002393333,0.002571667,0.002735000,0.002956667,0.002445833,0.002651667,0.002807500,0.002831667,0.002795833,0.002863333,0.002632500,0.000610833,0.003202500]]: lprint(labels2); cubegraph := {}: for i from 1 to 16 do for j from 1 to 16 do agree := 0: for k from 1 to 4 do if (labels2[i][k] = labels2[j][k]) then agree := agree+1: fi: od: if (agree = 3) then cubegraph := cubegraph union {{i,j}}: fi: od:od: for i from 1 to 15 do F := []: for j from 1 to 16 do F := [F[],die()]: od: Data := [Data[],F]: od: T := []: for antibiotic from 1 to 15 do print(antibiotic); fitness := Data[antibiotic]; #lprint(fitness); outdeg := []: allcount := 0: for i from 1 to 16 do count := 0: for j from 1 to 16 do if ((member({i,j},cubegraph)) and (fitness[i] < fitness[j])) then # NEW count := count+fitness[j]-fitness[i]: fi: od: allcount := allcount+count: outdeg := [outdeg[],count]: od: M := []: for i from 1 to 16 do M := [M[],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]: od: for i from 1 to 16 do if (outdeg[i] = 0) then M[i][i] := 1: else for j from 1 to 16 do if ((member({i,j},cubegraph)) and (fitness[i] < fitness[j])) then # NEW M[i][j] := (fitness[j]-fitness[i])/outdeg[i]: # M[i][j] := 1/outdeg[i]: fi: od: fi: od: T := [T[],M]: for k from 1 to 16 do lprint(M[k],`,`); od: od: quit