Logic-based Clustering and Learning for Time-Series Data