(self, m)
Calculate new step sizes.
        Args:
            m: Condition
Calculate new step sizes.
        Args:
            m: Condition
Calculate new step sizes . Args : m : Condition
def _stepadjust(self, m):
        """
        Calculate new step sizes.
        Args:
            m: Condition
        """
        # Compute values under Laplace approximation. This is the policy
        # that the previous samples were actually drawn from under the
        # dynamics that were estimated from the previous samples.
        previous_laplace_obj = self.traj_opt.estimate_cost(
            self.prev[m].traj_distr, self.prev[m].traj_info
        )
        # This is the policy that we just used under the dynamics that
        # were estimated from the previous samples (so this is the cost
        # we thought we would have).
        new_predicted_laplace_obj = self.traj_opt.estimate_cost(
            self.cur[m].traj_distr, self.prev[m].traj_info
        )

        # This is the actual cost we have under the current trajectory
        # based on the latest samples.
        new_actual_laplace_obj = self.traj_opt.estimate_cost(
            self.cur[m].traj_distr, self.cur[m].traj_info
        )

        # Measure the entropy of the current trajectory (for printout).
        ent = self._measure_ent(m)

        # Compute actual objective values based on the samples.
        previous_mc_obj = np.mean(np.sum(self.prev[m].cs, axis=1), axis=0)
        new_mc_obj = np.mean(np.sum(self.cur[m].cs, axis=1), axis=0)

        LOGGER.debug('Trajectory step: ent: %f cost: %f -> %f',
                     ent, previous_mc_obj, new_mc_obj)

        # Compute predicted and actual improvement.
        predicted_impr = np.sum(previous_laplace_obj) - \
                np.sum(new_predicted_laplace_obj)
        actual_impr = np.sum(previous_laplace_obj) - \
                np.sum(new_actual_laplace_obj)

        # Print improvement details.
        LOGGER.debug('Previous cost: Laplace: %f MC: %f',
                     np.sum(previous_laplace_obj), previous_mc_obj)
        LOGGER.debug('Predicted new cost: Laplace: %f MC: %f',
                     np.sum(new_predicted_laplace_obj), new_mc_obj)
        LOGGER.debug('Actual new cost: Laplace: %f MC: %f',
                     np.sum(new_actual_laplace_obj), new_mc_obj)
        LOGGER.debug('Predicted/actual improvement: %f / %f',
                     predicted_impr, actual_impr)

        self._set_new_mult(predicted_impr, actual_impr, m)
def _stepadjust ( self , m ) : # Compute values under Laplace approximation. This is the policy # that the previous samples were actually drawn from under the # dynamics that were estimated from the previous samples. previous_laplace_obj = self . traj_opt . estimate_cost ( self . prev [ m ] . traj_distr , self . prev [ m ] . traj_info ) # This is the policy that we just used under the dynamics that # were estimated from the previous samples (so this is the cost # we thought we would have). new_predicted_laplace_obj = self . traj_opt . estimate_cost ( self . cur [ m ] . traj_distr , self . prev [ m ] . traj_info ) # This is the actual cost we have under the current trajectory # based on the latest samples. new_actual_laplace_obj = self . traj_opt . estimate_cost ( self . cur [ m ] . traj_distr , self . cur [ m ] . traj_info ) # Measure the entropy of the current trajectory (for printout). ent = self . _measure_ent ( m ) # Compute actual objective values based on the samples. previous_mc_obj = np . mean ( np . sum ( self . prev [ m ] . cs , axis = 1 ) , axis = 0 ) new_mc_obj = np . mean ( np . sum ( self . cur [ m ] . cs , axis = 1 ) , axis = 0 ) LOGGER . debug ( 'Trajectory step: ent: %f cost: %f -> %f' , ent , previous_mc_obj , new_mc_obj ) # Compute predicted and actual improvement. predicted_impr = np . sum ( previous_laplace_obj ) - np . sum ( new_predicted_laplace_obj ) actual_impr = np . sum ( previous_laplace_obj ) - np . sum ( new_actual_laplace_obj ) # Print improvement details. LOGGER . debug ( 'Previous cost: Laplace: %f MC: %f' , np . sum ( previous_laplace_obj ) , previous_mc_obj ) LOGGER . debug ( 'Predicted new cost: Laplace: %f MC: %f' , np . sum ( new_predicted_laplace_obj ) , new_mc_obj ) LOGGER . debug ( 'Actual new cost: Laplace: %f MC: %f' , np . sum ( new_actual_laplace_obj ) , new_mc_obj ) LOGGER . debug ( 'Predicted/actual improvement: %f / %f' , predicted_impr , actual_impr ) self . _set_new_mult ( predicted_impr , actual_impr , m )