Quality-based Learning for Planning