Example #1
0
    def action_bits(self):
        """ Returns the maximum number of bits required to represent an action.
        """

        actions = [util.bits_required(action) for action in self.valid_actions]

        return max(actions)
Example #2
0
    def observation_bits(self):
        """ Returns the maximum number of bits required to represent an observation.
        """

        observations = [
            util.bits_required(obs) for obs in self.valid_observations
        ]

        return max(observations)
Example #3
0
 def action_bits(self):
     """ Returns the maximum number of bits required to represent an action.
     """
     # TODO(DONE): implement
     bits_list = []
     # Check the number of bits required to represent every action
     for action in self.valid_actions:
         bits_list.append(util.bits_required(action))
     # Return the max number of bits required
     return max(bits_list)
Example #4
0
 def reward_bits(self):
     """ Returns the maximum number of bits required to represent a reward.
     """
     # TODO(DONE): implement
     bits_list = []
     # Check the number of bits required to represent every reward
     for reward in self.valid_rewards:
         bits_list.append(util.bits_required(reward))
     # Return the max number of bits required
     return max(bits_list)
Example #5
0
    def action_bits(self):
        """ Returns the maximum number of bits required to represent an action.
            (Called `actionBits` in the C++ version.)
        """

        # Find the largest sized observation.
        maximum_bits = 0
        for action in self.valid_actions:
            bits_for_this_action = util.bits_required(action)
            if bits_for_this_action > maximum_bits:
                maximum_bits = bits_for_this_action
            # end if
        # end for

        return maximum_bits
Example #6
0
    def reward_bits(self):
        """ Returns the maximum number of bits required to represent a reward.
            (Called `rewardBits` in the C++ version)
        """

        # Find the largest sized reward.
        maximum_bits = 0
        for reward in self.valid_rewards:
            bits_for_this_reward = util.bits_required(reward)
            if bits_for_this_reward > maximum_bits:
                maximum_bits = bits_for_this_reward
            # end if
        # end for

        return maximum_bits
Example #7
0
    def action_bits(self):
        """ Returns the maximum number of bits required to represent an action.
            (Called `actionBits` in the C++ version.)
        """

        # Find the largest sized observation.
        maximum_bits = 0
        for action in self.valid_actions:
            bits_for_this_action = util.bits_required(action)
            if bits_for_this_action > maximum_bits:
                maximum_bits = bits_for_this_action
            # end if
        # end for

        return maximum_bits
Example #8
0
    def reward_bits(self):
        """ Returns the maximum number of bits required to represent a reward.
            (Called `rewardBits` in the C++ version)
        """

        # Find the largest sized reward.
        maximum_bits = 0
        for reward in self.valid_rewards:
            bits_for_this_reward = util.bits_required(reward)
            if bits_for_this_reward > maximum_bits:
                maximum_bits = bits_for_this_reward
            # end if
        # end for

        return maximum_bits
Example #9
0
    def reward_bits(self):
        """ Returns the maximum number of bits required to represent a reward.
        """

        return util.bits_required(self.reward)
Example #10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 22 17:05:54 2019

@author: andrewtanggara
"""

from pyaixi import agent, prediction, search, util
from pyaixi.environment import Environment

b = util.bits_required(7)
print(b)