class_docstr: Sorting network class.
  
  From Wikipedia : A sorting network is an abstract mathematical model
  of a network of wires and comparator modules that is used to sort a
  sequence of numbers. Each comparator connects two wires and sort the
  values by outputting the smaller value to one wire, and a larger
  value to the other.
class_docstr_tok: ["Sorting","network","class",".","From","Wikipedia",":","A","sorting","network","is","an","abstract","mathematical","model","of","a","network","of","wires","and","comparator","modules","that","is","used","to","sort","a","sequence","of","numbers",".","Each","comparator","connects","two","wires","and","sort","the","values","by","outputting","the","smaller","value","to","one","wire",",","and","a","larger","value","to","the","other","."]
docstr: Try to sort the **cases** using the network, return the number of
  misses. If **cases** is None, test all possible cases according to
  the network dimensionality.
docstr_tok: ["Try","to","sort","the","*","*","cases","*","*","using","the","network",",","return","the","number","of","misses",".","If","*","*","cases","*","*","is","None",",","test","all","possible","cases","according","to","the","network","dimensionality","."]
code: def assess(self, cases=None):
      """Try to sort the **cases** using the network, return the number of
      misses. If **cases** is None, test all possible cases according to
      the network dimensionality.
      """
      if cases is None:
          cases = product((0, 1), repeat=self.dimension)
  
      misses = 0
      ordered = [
          [0] * (self.dimension - i) + [1] * i
          for i in range(self.dimension + 1)
      ]
      for sequence in cases:
          sequence = list(sequence)
          self.sort(sequence)
          misses += sequence != ordered[sum(sequence)]
      return misses
  
file_path: deap/examples/ga/sortingnetwork.py
imports: from itertools import product
label_desc: Use image node_id 5 for calling the SortingNetwork obj's underlying member method code with example usage: obj.assess(cases) and returns: misses