import torch


def q_learning_confidence(lambda_, t, q=torch.tensor(0.008), e=torch.tensor(0.001)):
    """
    :param q: the convergence rate of q-learning
    :param e: the error of q-learning
    :param lambda_: lambda_ > 0
    :return: confidence bound of q-learning
    """
    confidence_q = torch.tensor(2) * (q + e) * (torch.tensor(1) - torch.pow((q + e), t)) \
                   / (torch.sqrt(lambda_) * (torch.tensor(1) - (q + e)))
    return confidence_q