lq/policy_iteration.py
def ql(self, K0, N, T, explore_mag=1.0):
        '''
        Q learning loop to iterate over policy iteration and policy improvement
        :param K0: The initial policy gain
        :param N: Number of iterations
        :param T: Trajectory length
        :param explore_mag: The amount of randomness in Q learning
        :return: The kernel of the value function P and the controller gain K
        '''
        self.K = K0
        for k in range(N):

            # If the controller is stable, do an iteration
            if self.dyn.is_stable(self.K):

                # Policy evaluaion
                G = self.q_evaluation(T, explore_mag)

                # Policy improvement
                self.K = self.q_improvement(G)
                P = GtoP(G, self.K)

            # If the controller is not stable, return some unstable values for P and K
            else:
                P, self.K = self.unstable_P_and_K()

        return P, self.K

        Q learning loop to iterate over policy iteration and policy improvement
        :param K0: The initial policy gain
        :param N: Number of iterations
        :param T: Trajectory length
        :param explore_mag: The amount of randomness in Q learning
        :return: The kernel of the value function P and the controller gain K
        
Q learning loop to iterate over policy iteration and policy improvement
Q learning loop to iterate over policy iteration and policy improvement
def ql(self, K0, N, T, explore_mag=1.0):
        self.K = K0
        for k in range(N):
            if self.dyn.is_stable(self.K):
                G = self.q_evaluation(T, explore_mag)
                self.K = self.q_improvement(G)
                P = GtoP(G, self.K)
            else:
                P, self.K = self.unstable_P_and_K()
        return P, self.K
def ql ( self , K0 , N , T , explore_mag = 1.0 ) : self . K = K0 for k in range ( N ) : if self . dyn . is_stable ( self . K ) : G = self . q_evaluation ( T , explore_mag ) self . K = self . q_improvement ( G ) P = GtoP ( G , self . K ) else : P , self . K = self . unstable_P_and_K ( ) return P , self . K
Q learning loop to iterate over policy iteration and policy improvement
Q learning loop to iterate over policy iteration and policy improvement
'''
        Q learning loop to iterate over policy iteration and policy improvement
        :param K0: The initial policy gain
        :param N: Number of iterations
        :param T: Trajectory length
        :param explore_mag: The amount of randomness in Q learning
        :return: The kernel of the value function P and the controller gain K
        ''' # If the controller is stable, do an iteration # Policy evaluaion # Policy improvement # If the controller is not stable, return some unstable values for P and K
The kernel of the value function P and the controller gain K
The kernel of the value function P and the controller gain K
self
K0
The initial policy gain
The initial policy gain
N
Number of iterations
Number of iterations
T
None
explore_mag
The amount of randomness in Q learning
The amount of randomness in Q learning