code: def solution_to_array(solution, events, slots):
      
      array = np.zeros((len(events), len(slots)), dtype=np.int8)
      for item in solution:
          array[item[0], item[1]] = 1
      return array
docs: Convert a schedule from solution to array form
  
      Parameters
      ----------
      solution : list or tuple
          of tuples of event index and slot index for each scheduled item
      events : list or tuple
          of :py:class:`resources.Event` instances
      slots : list or tuple
          of :py:class:`resources.Slot` instances
  
      Returns
      -------
      np.array
          An E by S array (X) where E is the number of events and S the
          number of slots. Xij is 1 if event i is scheduled in slot j and
          zero otherwise
  
      Example
      -------
      For For 3 events, 7 slots and the solution::
  
          [(0, 1), (1, 4), (2, 5)]
  
      The resulting array would be::
  
          [[0, 1, 0, 0, 0, 0, 0],
           [0, 0, 0, 0, 1, 0, 0],
           [0, 0, 0, 0, 0, 1, 0]]