original_docstring: Solves given problem using backtracking logic.
          
          :param problem: The problem to solver
          :param stats: The search statistics to update
          :type problem: Problem
          :type stats: SearchStatistics
          :return: True if problem has been solved, False otherwise
          :rtype: bool
          
docstring: Solves given problem using backtracking logic.
docstring_tokens: Solves given problem using backtracking logic .
code: def _solve_recursive(self, problem, stats):
          """Solves given problem using backtracking logic.
          
          :param problem: The problem to solver
          :param stats: The search statistics to update
          :type problem: Problem
          :type stats: SearchStatistics
          :return: True if problem has been solved, False otherwise
          :rtype: bool
          """
          # checking if problem is solved
          if problem.is_solved():
              stats.explored += 1
              return True
          
          # choosing next variable to instantiate
          var = self.var_ordering.next_var()
          
          if var is None:  # if all variables are already instantiated
              stats.explored += 1
              return False
          
          # for each possible value of var
          dom = var.ordered_domain()
          for value in dom:
  
              # push state for backtracking
              for v in problem.variables:
                  v.push_state()
                  
              try:
                  # instantiate var = value and propagate
                  var.instantiate_to(value)
              except ContradictionException:
                  # backtrack and try next value
                  self._backtrack(var, value, stats, problem.variables)
                  continue
              
              # recursive search
              solved = self._solve_recursive(problem, stats)
              
              if solved:
                  return True
              
              self._backtrack(var, value, stats, problem.variables)
          
          # if no value of var leads to a solution, fail
          return False
code_tokens: def _solve_recursive ( self , problem , stats ) : if problem . is_solved ( ) : stats . explored += 1 return True var = self . var_ordering . next_var ( ) if var is None : stats . explored += 1 return False dom = var . ordered_domain ( ) for value in dom : for v in problem . variables : v . push_state ( ) try : var . instantiate_to ( value ) except ContradictionException : self . _backtrack ( var , value , stats , problem . variables ) continue solved = self . _solve_recursive ( problem , stats ) if solved : return True self . _backtrack ( var , value , stats , problem . variables ) return False
short_docstring: Solves given problem using backtracking logic.
short_docstring_tokens: Solves given problem using backtracking logic .
comment: """Solves given problem using backtracking logic.
          
          :param problem: The problem to solver
          :param stats: The search statistics to update
          :type problem: Problem
          :type stats: SearchStatistics
          :return: True if problem has been solved, False otherwise
          :rtype: bool
          """$SEP$# checking if problem is solved
  $SEP$# choosing next variable to instantiate
  $SEP$# if all variables are already instantiated
  $SEP$# for each possible value of var
  $SEP$# push state for backtracking
  $SEP$# instantiate var = value and propagate
  $SEP$# backtrack and try next value
  $SEP$# recursive search
  $SEP$# if no value of var leads to a solution, fail
  