def get_q_experiment(case, minor=1):
    """ Returns an experiment that uses Q-learning.
    """
    gen = case.generators

    profile = array([1.0])
    maxSteps = len(profile)

    if minor == 1:
        alpha = 0.3 # Learning rate.
        gamma = 0.99 # Discount factor
        # The closer epsilon gets to 0, the more greedy and less explorative.
        epsilon = 0.9
        decay = 0.97

        tau = 150.0 # Boltzmann temperature.
        qlambda = 0.9
    elif minor == 2:
        alpha = 0.1 # Learning rate.
        gamma = 0.99 # Discount factor
        # The closer epsilon gets to 0, the more greedy and less explorative.
        epsilon = 0.9
        decay = 0.99

        tau = 150.0 # Boltzmann temperature.
        qlambda = 0.9
    else:
        raise ValueError

    market = pyreto.SmartMarket(case, priceCap=cap, decommit=decommit,
                                auctionType=auctionType)

    experiment = pyreto.continuous.MarketExperiment([], [], market, profile)

    for g in gen[0:2]:
        learner = Q(alpha, gamma)
    #    learner = QLambda(alpha, gamma, qlambda)
    #    learner = SARSA(alpha, gamma)

        learner.explorer.epsilon = epsilon
        learner.explorer.decay = decay
#        learner.explorer = BoltzmannExplorer(tau, decay)

        task, agent = get_discrete_task_agent([g], market, nStates, nOffer,
            markups, withholds, maxSteps, learner)

        experiment.tasks.append(task)
        experiment.agents.append(agent)

    # Passive agent.
    task, agent = get_zero_task_agent(gen[2:3], market, nOffer, maxSteps)
    experiment.tasks.append(task)
    experiment.agents.append(agent)

    return experiment
Returns an experiment that uses Q-learning.