TMSS-259: change logic for sunrise/sunset/twilight constraints, add logic for min_distance constraint