class Solve::Solver

def backtrack(unbound_variable)

def backtrack(unbound_variable)
  previous_variable = variable_table.before(unbound_variable.artifact)
  if previous_variable.nil?
    trace("Cannot backtrack any further")
    raise Errors::NoSolutionError
  end
  trace("Unbinding #{previous_variable.artifact}")
  source = previous_variable.value
  removed_variables = variable_table.remove_all_with_only_this_source!(source)
  removed_variables.each do |removed_variable|
    possible_values[removed_variable.artifact] = nil
    trace("Removed variable #{removed_variable.artifact}")
  end
  removed_constraints = constraint_table.remove_constraints_from_source!(source)
  removed_constraints.each do |removed_constraint|
    trace("Removed constraint #{removed_constraint.name} #{removed_constraint.constraint}")
  end
  previous_variable.unbind
  variable_table.all_after(previous_variable.artifact).each do |variable| 
    new_possibles = reset_possible_values_for(variable)
  end
end