def deep_q_learning(current_state_vector, action_index, object_index, reward,
                    next_state_vector, terminal):
    """Updates the weights of the DQN for a given transition

    Args:
        current_state_vector (torch.FloatTensor): vector representation of current state
        action_index (int): index of the current action
        object_index (int): index of the current object
        reward (float): the immediate reward the agent recieves from playing current command
        next_state_vector (torch.FloatTensor): vector representation of next state
        terminal (bool): True if this epsiode is over

    Returns:
        None
    """
    with torch.no_grad():
        q_values_action_next, q_values_object_next = model(next_state_vector)
    maxq_next = 1 / 2 * (q_values_action_next.max()
                         + q_values_object_next.max())

    q_value_cur_state = model(current_state_vector)
    Q_val_cur = 1/2 * (q_value_cur_state[0][action_index] + q_value_cur_state[1][object_index]) # Current Q value 

    maxQ = 0.0 if terminal else maxq_next
    y = reward + GAMMA*maxQ # Target

    loss = 1/2 * (y - Q_val_cur)**2

    optimizer.zero_grad()
    loss.backward()
    optimizer.step()