unittest/python/crocoddyl/box_ddp.py
def forwardPass(self, stepLength, warning='ignore'):
        """ Run the forward-pass of the DDP algorithm.

        The forward-pass basically applies a new policy and then rollout the
        system. After this rollouts, it's checked if this policy provides a
        reasonable improvement. For that we use Armijo condition to evaluated the
        chosen step length.
        :param stepLength: step length
        """
        # Argument b is introduce for debug purpose.
        # Argument warning is also introduce for debug: by default, it masks the numpy warnings
        #    that can be reactivated during debug.
        uu = self.uu
        ul = self.ul
        xs, us = self.xs, self.us
        xtry = [self.problem.initialState] + [np.nan] * self.problem.T
        utry = [np.nan] * self.problem.T
        ctry = 0
        for t, (m, d) in enumerate(zip(self.problem.runningModels, self.problem.runningDatas)):
            utry[t] = us[t] - self.k[t] * stepLength - np.dot(self.K[t], m.State.diff(xs[t], xtry[t]))

            # Clamp the utry within the lower and upper limits.
            utry[t] = np.minimum(np.maximum(utry[t], ul), uu)

            with np.warnings.catch_warnings():
                np.warnings.simplefilter(warning)
                xnext, cost = m.calc(d, xtry[t], utry[t])
            xtry[t + 1] = xnext.copy()  # not sure copy helpful here.
            ctry += cost
            raiseIfNan([ctry, cost], ArithmeticError('forward error'))
            raiseIfNan(xtry[t + 1], ArithmeticError('forward error'))
        with np.warnings.catch_warnings():
            np.warnings.simplefilter(warning)
            ctry += self.problem.terminalModel.calc(self.problem.terminalData, xtry[-1])[1]
        raiseIfNan(ctry, ArithmeticError('forward error'))
        self.xs_try = xtry
        self.us_try = utry
        self.cost_try = ctry
        return xtry, utry, ctry
 Run the forward-pass of the DDP algorithm.

        The forward-pass basically applies a new policy and then rollout the
        system. After this rollouts, it's checked if this policy provides a
        reasonable improvement. For that we use Armijo condition to evaluated the
        chosen step length.
        :param stepLength: step length
        
Run the forward-pass of the DDP algorithm.
The forward-pass basically applies a new policy and then rollout the
system. After this rollouts, it's checked if this policy provides a
reasonable improvement. For that we use Armijo condition to evaluated the
chosen step length.
Run the forward - pass of the DDP algorithm . The forward - pass basically applies a new policy and then rollout the system . After this rollouts it ' s checked if this policy provides a reasonable improvement . For that we use Armijo condition to evaluated the chosen step length .
def forwardPass(self, stepLength, warning='ignore'):
        uu = self.uu
        ul = self.ul
        xs, us = self.xs, self.us
        xtry = [self.problem.initialState] + [np.nan] * self.problem.T
        utry = [np.nan] * self.problem.T
        ctry = 0
        for t, (m, d) in enumerate(zip(self.problem.runningModels, self.problem.runningDatas)):
            utry[t] = us[t] - self.k[t] * stepLength - np.dot(self.K[t], m.State.diff(xs[t], xtry[t]))
            utry[t] = np.minimum(np.maximum(utry[t], ul), uu)
            with np.warnings.catch_warnings():
                np.warnings.simplefilter(warning)
                xnext, cost = m.calc(d, xtry[t], utry[t])
            xtry[t + 1] = xnext.copy()  
            ctry += cost
            raiseIfNan([ctry, cost], ArithmeticError('forward error'))
            raiseIfNan(xtry[t + 1], ArithmeticError('forward error'))
        with np.warnings.catch_warnings():
            np.warnings.simplefilter(warning)
            ctry += self.problem.terminalModel.calc(self.problem.terminalData, xtry[-1])[1]
        raiseIfNan(ctry, ArithmeticError('forward error'))
        self.xs_try = xtry
        self.us_try = utry
        self.cost_try = ctry
        return xtry, utry, ctry
def forwardPass ( self , stepLength , warning = 'ignore' ) : uu = self . uu ul = self . ul xs , us = self . xs , self . us xtry = [ self . problem . initialState ] + [ np . nan ] * self . problem . T utry = [ np . nan ] * self . problem . T ctry = 0 for t , ( m , d ) in enumerate ( zip ( self . problem . runningModels , self . problem . runningDatas ) ) : utry [ t ] = us [ t ] - self . k [ t ] * stepLength - np . dot ( self . K [ t ] , m . State . diff ( xs [ t ] , xtry [ t ] ) ) utry [ t ] = np . minimum ( np . maximum ( utry [ t ] , ul ) , uu ) with np . warnings . catch_warnings ( ) : np . warnings . simplefilter ( warning ) xnext , cost = m . calc ( d , xtry [ t ] , utry [ t ] ) xtry [ t + 1 ] = xnext . copy ( ) ctry += cost raiseIfNan ( [ ctry , cost ] , ArithmeticError ( 'forward error' ) ) raiseIfNan ( xtry [ t + 1 ] , ArithmeticError ( 'forward error' ) ) with np . warnings . catch_warnings ( ) : np . warnings . simplefilter ( warning ) ctry += self . problem . terminalModel . calc ( self . problem . terminalData , xtry [ - 1 ] ) [ 1 ] raiseIfNan ( ctry , ArithmeticError ( 'forward error' ) ) self . xs_try = xtry self . us_try = utry self . cost_try = ctry return xtry , utry , ctry
Run the forward-pass of the DDP algorithm.
Run the forward - pass of the DDP algorithm .
""" Run the forward-pass of the DDP algorithm.

        The forward-pass basically applies a new policy and then rollout the
        system. After this rollouts, it's checked if this policy provides a
        reasonable improvement. For that we use Armijo condition to evaluated the
        chosen step length.
        :param stepLength: step length
        """ # Argument b is introduce for debug purpose. # Argument warning is also introduce for debug: by default, it masks the numpy warnings #    that can be reactivated during debug. # Clamp the utry within the lower and upper limits. # not sure copy helpful here.
self
stepLength
None
warning