(self, states, policy=None, actions=None, lyapunov=None,
                      lagrange_multiplier=1.)
return updated_values
Return the value at the current states.

        Parameters
        ----------
        states : ndarray
            The states at which to compute future values.
        policy : callable, optional
            The policy for which to evaluate. Defaults to `self.policy`. This
            argument is ignored if actions is not None.
        actions : array or tensor, optional
            The actions to be taken for the states.
        lyapunov : instance of `Lyapunov`
            A Lyapunov function that acts as a constraint for the optimization.
        lagrange_multiplier: float
            A scaling factor for the `slack` of the optimization problem.

        Returns
        -------
        The expected long term reward when taking an action according to the
        policy and then taking the value of self.value_function.
Return the value at the current states.
Return the value at the current states .
def future_values(self, states, policy=None, actions=None, lyapunov=None,
                      lagrange_multiplier=1.):
        """Return the value at the current states.

        Parameters
        ----------
        states : ndarray
            The states at which to compute future values.
        policy : callable, optional
            The policy for which to evaluate. Defaults to `self.policy`. This
            argument is ignored if actions is not None.
        actions : array or tensor, optional
            The actions to be taken for the states.
        lyapunov : instance of `Lyapunov`
            A Lyapunov function that acts as a constraint for the optimization.
        lagrange_multiplier: float
            A scaling factor for the `slack` of the optimization problem.

        Returns
        -------
        The expected long term reward when taking an action according to the
        policy and then taking the value of self.value_function.
        """
        if actions is None:
            if policy is None:
                policy = self.policy
            actions = policy(states)

        next_states = self.dynamics(states, actions)
        rewards = self.reward_function(states, actions)

        # Only use the mean dynamics
        if isinstance(next_states, tuple):
            next_states, var = next_states

        expected_values = self.value_function(next_states)

        # Perform value update
        updated_values = rewards + self.gamma * expected_values

        # Adjust the cost for the Lyapunov decrease
        if lyapunov is not None:
            decrease = lyapunov.v_decrease_bound(states, (next_states, var))

            # Want to enfore `constraint <= 0`
            constraint = decrease - lyapunov.threshold(states)
            updated_values -= lagrange_multiplier * constraint

        return updated_values
def future_values ( self , states , policy = None , actions = None , lyapunov = None , lagrange_multiplier = 1. ) : if actions is None : if policy is None : policy = self . policy actions = policy ( states ) next_states = self . dynamics ( states , actions ) rewards = self . reward_function ( states , actions ) # Only use the mean dynamics if isinstance ( next_states , tuple ) : next_states , var = next_states expected_values = self . value_function ( next_states ) # Perform value update updated_values = rewards + self . gamma * expected_values # Adjust the cost for the Lyapunov decrease if lyapunov is not None : decrease = lyapunov . v_decrease_bound ( states , ( next_states , var ) ) # Want to enfore `constraint <= 0` constraint = decrease - lyapunov . threshold ( states ) updated_values -= lagrange_multiplier * constraint return updated_values