HC-Search: Learning Heuristics and Cost Functions for Structured Prediction