def TTD_MWDW_idx_rule(M):
    """
    Index is (window, tour type, week).

    :param M: Model
    :return: Constraint index rule
    """

    index_list = []
    for t in M.activeTT:
        n_patterns = M.num_mwdw_patterns[t]
        if n_patterns > 0:
            for i in M.WINDOWS:
                if (i, t) in M.okTourType:
                    for w in M.WEEKS:
                        index_list.append((i, t, w))
    return index_list