• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python environments.EpisodicTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pybrain.rl.environments.EpisodicTask的典型用法代码示例。如果您正苦于以下问题:Python EpisodicTask类的具体用法?Python EpisodicTask怎么用?Python EpisodicTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了EpisodicTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, environment):
     EpisodicTask.__init__(self, environment)
     self.reward_history = []
     self.count = 0 
     # normalize to (-1, 1)
     self.sensor_limits = [(-pi, pi), (-20, 20)]
     self.actor_limits = [(-1, 1)]
开发者ID:ZachPhillipsGary,项目名称:CS200-NLP-ANNsProject,代码行数:7,代码来源:acrobot.py


示例2: performAction

    def performAction(self, action):
        action = self.action_from_joint_angles(action)

        # Carry out the action based on angular velocities
        EpisodicTask.performAction(self, action)

        return
开发者ID:evansneath,项目名称:surgicalsim,代码行数:7,代码来源:task.py


示例3: reset

 def reset(self):
     self.reward[0] = 0.0
     self.rawReward = 0.0
     self.env.reset()
     self.action = [self.env.dists[0]] * self.outDim
     self.epiStep = 0
     EpisodicTask.reset(self)
开发者ID:DanSGraham,项目名称:code,代码行数:7,代码来源:tasks.py


示例4: performAction

 def performAction(self, action):
     """ POMDP tasks, as they have discrete actions, can me used by providing either an index,
     or an array with a 1-in-n coding (which can be stochastic). """
     if type(action) == ndarray:
         action = drawIndex(action, tolerant = True)
     self.steps += 1
     EpisodicTask.performAction(self, action)
开发者ID:ZachPhillipsGary,项目名称:CS200-NLP-ANNsProject,代码行数:7,代码来源:pomdp.py


示例5: __init__

    def __init__(self, env=None, maxsteps=1000, desiredValue=0, location="Portland, OR"):
        """
        :key env: (optional) an instance of a CartPoleEnvironment (or a subclass thereof)
        :key maxsteps: maximal number of steps (default: 1000)
        """
        self.location = location
        self.airport_code = weather.airport(location)
        self.desiredValue = desiredValue
        if env is None:
            env = CartPoleEnvironment()
        EpisodicTask.__init__(self, env)
        self.N = maxsteps
        self.t = 0

        # scale position and angle, don't scale velocities (unknown maximum)
        self.sensor_limits = [(-3, 3)]
        for i in range(1, self.outdim):
            if isinstance(self.env, NonMarkovPoleEnvironment) and i % 2 == 0:
                self.sensor_limits.append(None)
            else:
                self.sensor_limits.append((-np.pi, np.pi))

        # self.sensor_limits = [None] * 4
        # actor between -10 and 10 Newton
        self.actor_limits = [(-50, 50)]
开发者ID:nvaller,项目名称:pug-ann,代码行数:25,代码来源:example.py


示例6: performAction

 def performAction(self, action):
     #Filtered mapping towards performAction of the underlying environment
     #The standard Johnnie task uses a PID controller to controll directly angles instead of forces
     #This makes most tasks much simpler to learn
     isJoints=self.env.getSensorByName('JointSensor') #The joint angles
     isSpeeds=self.env.getSensorByName('JointVelocitySensor') #The joint angular velocitys
     act=(action+1.0)/2.0*(self.env.cHighList-self.env.cLowList)+self.env.cLowList #norm output to action intervall
     action=tanh((act-isJoints-isSpeeds)*16.0)*self.maxPower*self.env.tourqueList #simple PID
     EpisodicTask.performAction(self, action)
开发者ID:DanSGraham,项目名称:code,代码行数:9,代码来源:johnnie.py


示例7: __init__

	def __init__(self,environment, maxSteps, goalTolerance):
		EpisodicTask.__init__(self,environment)
		self.env = environment
		self.count = 0
		self.atGoal = False
		self.MAX_STEPS = maxSteps
		self.GOAL_TOLERANCE = goalTolerance
		self.oldDist = 0
		self.reward = 0
开发者ID:krylenko,项目名称:python,代码行数:9,代码来源:INFOMAX__mazeTask.py


示例8: performAction

 def performAction(self, action):
     """ a filtered mapping towards performAction of the underlying environment. """
     # scaling
     self.incStep()
     action = (action + 1.0) / 2.0 * self.dif + self.env.fraktMin * self.env.dists[0]
     #Clipping the maximal change in actions (max force clipping)
     action = clip(action, self.action - self.maxSpeed, self.action + self.maxSpeed)
     EpisodicTask.performAction(self, action)
     self.action = action.copy()
开发者ID:DanSGraham,项目名称:code,代码行数:9,代码来源:tasks.py


示例9: __init__

    def __init__(self, environment=None, batchSize=1):
        self.batchSize = batchSize
        if environment is None:
            self.env = Lander()
        else:
            self.env = environment
        EpisodicTask.__init__(self, self.env)

        self.sensor_limits = [(0.0, 200.0), (0.0, 35.0), (0.0, 4.0),
                              (-6.0, 6.0), (-0.4, 0.4),
                              (-0.15, 0.15), (0.0, 200.0)]
开发者ID:andschwa,项目名称:uidaho-cs470-moonlander,代码行数:11,代码来源:tasks.py


示例10: performAction

 def performAction(self, action):
     #Filtered mapping towards performAction of the underlying environment
     #The standard Tetra2 task uses a PID controller to control directly angles instead of forces
     #This makes most tasks much simpler to learn
     isJoints=self.env.getSensorByName('JointSensor') #The joint angles
     #print "Pos:", [int(i*10) for i in isJoints]
     isSpeeds=self.env.getSensorByName('JointVelocitySensor') #The joint angular velocitys
     #print "Speeds:", [int(i*10) for i in isSpeeds]
     #print "Action", action, "cHighList",self.env.cHighList , self.env.cLowList
     #act=(action+1.0)/2.0*(self.env.cHighList-self.env.cLowList)+self.env.cLowList #norm output to action intervall
     #action=tanh(act-isJoints-isSpeeds)*self.maxPower*self.env.tourqueList #simple PID
     #print "Action", act[:5]
     EpisodicTask.performAction(self, action *self.maxPower*self.env.tourqueList)
开发者ID:gcobos,项目名称:leggedbot,代码行数:13,代码来源:tetra_tasks.py


示例11: performAction

 def performAction(self, action):
     #Filtered mapping towards performAction of the underlying environment
     #The standard CCRL task uses a PID controller to controll directly angles instead of forces
     #This makes most tasks much simpler to learn
     self.oldAction = action
     #Grasping as reflex depending on the distance to target - comment in for more easy grasping
     if abs(abs(self.dist[:3]).sum())<2.0: action[15]=1.0 #self.grepRew=action[15]*.01
     else: action[15]=-1.0 #self.grepRew=action[15]*-.03
     isJoints=array(self.env.getSensorByName('JointSensor')) #The joint angles
     isSpeeds=array(self.env.getSensorByName('JointVelocitySensor')) #The joint angular velocitys
     act=(action+1.0)/2.0*(self.env.cHighList-self.env.cLowList)+self.env.cLowList #norm output to action intervall
     action=tanh((act-isJoints-0.9*isSpeeds*self.env.tourqueList)*16.0)*self.maxPower*self.env.tourqueList #simple PID
     EpisodicTask.performAction(self, action)
开发者ID:Boblogic07,项目名称:pybrain,代码行数:13,代码来源:ccrl.py


示例12: __init__

 def __init__(self, env = None, maxsteps = 1000):
     if env == None:
         env = CarEnvironment()
     EpisodicTask.__init__(self, env)
     self.N = maxsteps
     self.t = 0
     # (vel, deg, dist_to_goal, dir_of_goal, direction_diff)
     self.sensor_limits = [(-30.0, 100.0),
                           (0.0, 360.0),
                           (0.0, variables.grid_size*2),
                           (-180.0, 180.0),
                           (-180.0, 180.0)]
     self.actor_limits = [(-1.0, +4.5), (-90.0, +90.0)]
     self.rewardscale = 100.0 / env.distance_to_goal
     self.total_reward = 0.0
开发者ID:atkaiser,项目名称:animats,代码行数:15,代码来源:GoToGoalTask.py


示例13: __init__

    def __init__(self, env=None, maxsteps=1000, desiredValue = 0, tolorance = 0.3):
        """
        :key env: (optional) an instance of a CartPoleEnvironment (or a subclass thereof)
        :key maxsteps: maximal number of steps (default: 1000)
        """
        self.desiredValue = desiredValue
        EpisodicTask.__init__(self, env)
        self.N = maxsteps
        self.t = 0
        self.tolorance = tolorance


        # self.sensor_limits = [None] * 4
        # actor between -10 and 10 Newton
        self.actor_limits = [(-15, 15)]
开发者ID:akansal1,项目名称:einstein,代码行数:15,代码来源:robot_tasks.py


示例14: __init__

	def __init__(self, env=None, maxsteps=1000):
		"""
		:key env: (optional) an instance of a ChemotaxisEnv (or a subclass thereof)
		:key maxsteps: maximal number of steps (default: 1000)
		"""
		if env == None:
			env = ChemotaxisEnv()
		self.env = env
		
		EpisodicTask.__init__(self, env)
		self.N = maxsteps
		self.t = 0
		
		#self.actor_limits = [(0,1), (0,1)] # scale (-1,1) to motor neurons
		self.sensor_limits = [(0,1), (0,1)] # scale sensor neurons to (-1,1)
开发者ID:desophos,项目名称:chemotaxis,代码行数:15,代码来源:EpisodicChemotaxisTask.py


示例15: __init__

    def __init__(self, env=None, maxsteps=1000):
        """
        :key env: (optional) an instance of a CartPoleEnvironment (or a subclass thereof)
        :key maxsteps: maximal number of steps (default: 1000)
        """
        if env == None:
            env = CartPoleEnvironment()
        EpisodicTask.__init__(self, env)
        self.N = maxsteps
        self.t = 0

        # no scaling of sensors
        self.sensor_limits = [None] * 2

        # scale actor
        self.actor_limits = [(-50, 50)]
开发者ID:Boblogic07,项目名称:pybrain,代码行数:16,代码来源:balancetask.py


示例16: __init__

 def __init__(self, env):
     EpisodicTask.__init__(self, env)
     self.step = 0
     self.epiStep = 0
     self.reward = [0.0]
     self.rawReward = 0.0
     self.obsSensors = ["EdgesReal"]
     self.rewardSensor = [""]
     self.oldReward = 0.0
     self.plotString = ["World Interactions", "Reward", "Reward on NoReward Task"]
     self.inDim = len(self.getObservation())
     self.outDim = self.env.actLen
     self.dif = (self.env.fraktMax - self.env.fraktMin) * self.env.dists[0]
     self.maxSpeed = self.dif / 30.0
     self.picCount = 0
     self.epiLen = 1
开发者ID:DanSGraham,项目名称:code,代码行数:16,代码来源:tasks.py


示例17: __init__

    def __init__(
        self, environment, sort_beliefs=True, do_decay_beliefs=True, uniform_initial_beliefs=True, max_steps=30
    ):
        EpisodicTask.__init__(self, environment)
        self.verbose = False
        self.listActions = False

        self.env = environment

        self.uniform_initial_beliefs = uniform_initial_beliefs
        self.max_steps = max_steps
        self.rewardscale = 1.0  # /self.max_steps

        self.state_ids = {"init": 0, "grasped": 1, "lifted": 2, "placed": 3}

        self.initialize()
开发者ID:ZhengYi0310,项目名称:ua-ros-pkg,代码行数:16,代码来源:tasks.py


示例18: __init__

    def __init__(self, env):
        EpisodicTask.__init__(self, env)

        self.pause = False

        # Holds all rewards given in each episode
        self.reward_history = []

        # The current timestep counter
        self.count = 0

        # The number of timesteps in the episode
        self.epiLen = 1500

        # Counts the task resets for incremental learning
        self.incLearn = 0

        # Sensor limit values can be used to normalize the sensors from
        # (low, high) to (-1.0, 1.0) given the low and high values. We want to
        # maintain all units by keeping the results unnormalized for now.
        # Keeping the values of these lists at None skips the normalization.
        self.sensor_limits = None
        self.actor_limits = None

        # Create all current joint observation attributes
        self.joint_angles = []         # [rad]
        self.joint_velocities = []     # [rad/s]

        # Create the attribute for current tooltip position (x, y, z) [m]
        self.tooltip_position = []     # [m]

        # Create all joint angle [rad] limit attributes
        self.joint_max_angles = []
        self.joint_min_angles = []

        # Create all joint velocity [rad/s] and torque [N*m] limit attributes
        self.joint_max_velocities = []
        self.joint_max_torques = []

        # Call the setter function for the joint limit attributes
        self.set_joint_angle_limits()
        self.set_joint_velocity_limits()
        self.set_joint_torque_limits()

        return
开发者ID:evansneath,项目名称:surgicalsim,代码行数:45,代码来源:task.py


示例19: __init__

    def __init__(self, env=None, maxsteps=1000):
        """
        :key env: (optional) an instance of a ShipSteeringEnvironment (or a subclass thereof)
        :key maxsteps: maximal number of steps (default: 1000)
        """
        if env == None:
            env = ShipSteeringEnvironment(render=False)
        EpisodicTask.__init__(self, env)
        self.N = maxsteps
        self.t = 0

        # scale sensors
        #                          [h,              hdot,           v]
        self.sensor_limits = [(-180.0, +180.0), (-180.0, +180.0), (-10.0, +40.0)]

        # actions:              thrust,       rudder
        self.actor_limits = [(-1.0, +2.0), (-90.0, +90.0)]
        # scale reward over episode, such that max. return = 100
        self.rewardscale = 100. / maxsteps / self.sensor_limits[2][1]
开发者ID:Boblogic07,项目名称:pybrain,代码行数:19,代码来源:northwardtask.py


示例20: __init__

    def __init__(self, env):
        EpisodicTask.__init__(self, env)
        self.maxPower = 100.0 #Overall maximal tourque - is multiplied with relative max tourque for individual joint to get individual max tourque
        self.reward_history = []
        self.count = 0 #timestep counter
        self.epiLen = 500 #suggestet episodic length for normal Johnnie tasks
        self.incLearn = 0 #counts the task resets for incrementall learning
        self.env.FricMu = 20.0 #We need higher friction for Johnnie
        self.env.dt = 0.01 #We also need more timly resolution

        # normalize standard sensors to (-1, 1)
        self.sensor_limits = []
        #Angle sensors
        for i in range(self.env.actLen):
            self.sensor_limits.append((self.env.cLowList[i], self.env.cHighList[i]))            
        # Joint velocity sensors
        for i in range(self.env.actLen):
            self.sensor_limits.append((-20, 20))
        #Norm all actor dimensions to (-1, 1)
        self.actor_limits = [(-1, 1)] * env.actLen
开发者ID:ZachPhillipsGary,项目名称:CS200-NLP-ANNsProject,代码行数:20,代码来源:johnnie.py



注:本文中的pybrain.rl.environments.EpisodicTask类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python episodic.EpisodicTask类代码示例发布时间:2022-05-25
下一篇:
Python agents.LearningAgent类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap