Optimization in temporal qualitative constraint networks