MCPcopy Create free account
hub / github.com/DEAP/deap / sort

Method sort

examples/ga/sortingnetwork.py:59–64  ·  view source on GitHub ↗

Sort the values in-place based on the connectors in the network.

(self, values)

Source from the content-addressed store, hash-verified

57 return True
58
59 def sort(self, values):
60 """Sort the values in-place based on the connectors in the network."""
61 for level in self:
62 for wire1, wire2 in level:
63 if values[wire1] > values[wire2]:
64 values[wire1], values[wire2] = values[wire2], values[wire1]
65
66 def assess(self, cases=None):
67 """Try to sort the **cases** using the network, return the number of

Callers 2

assessMethod · 0.95
mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected