Minimizing conflicts: a heuristic repair method for constraint satisfaction and scheduling problems