Heuristics for Optimization and Learning