Skip to content

Instantly share code, notes, and snippets.

@cmd-ntrf
Created December 6, 2013 00:27
Show Gist options
  • Save cmd-ntrf/7816665 to your computer and use it in GitHub Desktop.
Save cmd-ntrf/7816665 to your computer and use it in GitHub Desktop.
import networkx
from metric import measure_A, measure_B, measure_C, measure_D
def evaluate(individual):
matrix = numpy.zeros((n,n))
index = 0
for i in range(n-1):
for j in range(i+1, n):
matrix[i,j] = matrix[j,i] = individual[index]
index += 1
graph = networkx.from_numpy_matrix(matrix)
return measure_A(graph), measure_B(graph), measure_C(graph), measure_D(graph)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment