code: def heuristic(events,
                slots,
                objective_function=None,
                algorithm=heu.hill_climber,
                initial_solution=None,
                initial_solution_algorithm_kwargs={},
                objective_function_algorithm_kwargs={},
                **kwargs):
      
      def count_violations(array):
          return len(list(val.array_violations(array, events, slots)))
  
      if initial_solution is None:
          X = heu.get_initial_array(events=events, slots=slots)
          X = algorithm(initial_array=X,
                        objective_function=count_violations,
                        lower_bound=0,
                        **initial_solution_algorithm_kwargs)
      else:
          X = initial_solution
  
      if objective_function is not None:
  
          kwargs["beta"] = float('inf')
          def func(array):
              return objective_function(
                  events=events, slots=slots, X=array, **kwargs)
  
          X = algorithm(initial_array=X,
                        objective_function=func,
                        acceptance_criteria=count_violations,
                        **objective_function_algorithm_kwargs)
  
      return list(zip(*np.nonzero(X)))
docs: Compute a schedule using a heuristic
  
      Parameters
      ----------
      events : list or tuple
          of :py:class:`resources.Event` instances
      slots : list or tuple
          of :py:class:`resources.Slot` instances
      algorithm : callable
         a heuristic algorithm from conference_scheduler.heuristics
      initial_solution_algorithm_kwargs : dict
         kwargs for the heuristic algorithm for the initial solution
      objective_function_algorithm_kwargs : dict
         kwargs for the heuristic algorithm for the objective function (if
         necessary.
      objective_function: callable
          from lp_problem.objective_functions
      kwargs : keyword arguments
          arguments for the objective function
  
      Returns
      -------
      list
          A list of tuples giving the event and slot index (for the given
          events and slots lists) for all scheduled items.
  
      Example
      -------
      For a solution where
  
          * event 0 is scheduled in slot 1
          * event 1 is scheduled in slot 4
          * event 2 is scheduled in slot 5
  
      the resulting list would be::
  
          [(0, 1), (1, 4), (2, 5)]