<var id="z5l9h"><strike id="z5l9h"><progress id="z5l9h"></progress></strike></var>
<thead id="z5l9h"></thead>
<cite id="z5l9h"><strike id="z5l9h"><listing id="z5l9h"></listing></strike></cite>
<var id="z5l9h"></var>
<ins id="z5l9h"><strike id="z5l9h"></strike></ins> <var id="z5l9h"></var>
<var id="z5l9h"><dl id="z5l9h"></dl></var>
<var id="z5l9h"><strike id="z5l9h"><progress id="z5l9h"></progress></strike></var>

机器学习 – 如何在OpenAI中创建一个新的健身房环境?

我有一个任务,要制作一个AI代理,学习使用ML玩视频游戏.我想使用OpenAI Gym创建一个新环境,因为我不想使用现有环境.如何创建新的自定义环境?

另外,有没有其他方法可以让我开始让AI Agent在没有OpenAI Gym的帮助下玩特定的视频游戏?

在极小的环境中查看我的 banana-gym.

创建新环境

请参阅存储库的主页面:

https://github.com/openai/gym/blob/master/docs/creating-environments.md

步骤是:

>使用PIP包结构创建新的存储库

它看起来应该是这样的

gym-foo/
  README.md
  setup.py
  gym_foo/
    __init__.py
    envs/
      __init__.py
      foo_env.py
      foo_extrahard_env.py

有关其内容,请点击上面的链接.那里没有提到的细节特别是foo_env.py中的某些函数应该是什么样子.查看示例并在gym.openai.com/docs/有所帮助.这是一个例子:

class FooEnv(gym.Env):
    metadata = {'render.modes': ['human']}

    def __init__(self):
        pass

    def _step(self, action):
        """

        Parameters
        ----------
        action :

        Returns
        -------
        ob, reward, episode_over, info : tuple
            ob (object) :
                an environment-specific object representing your observation of
                the environment.
            reward (float) :
                amount of reward achieved by the previous action. The scale
                varies between environments, but the goal is always to increase
                your total reward.
            episode_over (bool) :
                whether it's time to reset the environment again. Most (but not
                all) tasks are divided up into well-defined episodes, and done
                being True indicates the episode has terminated. (For example,
                perhaps the pole tipped too far, or you lost your last life.)
            info (dict) :
                 diagnostic information useful for debugging. It can sometimes
                 be useful for learning (for example, it might contain the raw
                 probabilities behind the environment's last state change).
                 However, official evaluations of your agent are not allowed to
                 use this for learning.
        """
        self._take_action(action)
        self.status = self.env.step()
        reward = self._get_reward()
        ob = self.env.getState()
        episode_over = self.status != hfo_py.IN_GAME
        return ob, reward, episode_over, {}

    def _reset(self):
        pass

    def _render(self, mode='human', close=False):
        pass

    def _take_action(self, action):
        pass

    def _get_reward(self):
        """ Reward is given for XY. """
        if self.status == FOOBAR:
            return 1
        elif self.status == ABC:
            return self.somestate ** 2
        else:
            return 0

使用您的环境

import gym
import gym_foo
env = gym.make('MyEnv-v0')

例子

> https://github.com/openai/gym-soccer
> https://github.com/openai/gym-wikinav
> https://github.com/alibaba/gym-starcraft
> https://github.com/endgameinc/gym-malware
> https://github.com/hackthemarket/gym-trading
> https://github.com/tambetm/gym-minecraft
> https://github.com/ppaquette/gym-doom
> https://github.com/ppaquette/gym-super-mario
> https://github.com/tuzzer/gym-maze

相关文章
761111香港马会查询无错九肖 巍山| 仙游县| 建始县| 谢通门县| 武夷山市| 历史| 沅江市| 新绛县| 甘洛县| 石楼县| 武宣县| 兴隆县| 怀集县| 永仁县| 呼伦贝尔市| 宁晋县| 诸暨市| 宁乡县| 深圳市| 祁连县| 乌兰县| 库伦旗| 陵水| 满洲里市| 北辰区| 宽甸| 城市| 榕江县| 临潭县| 吉林省| 苏尼特左旗| 新竹市| 乌兰县| 汝南县| 上杭县| 河西区| 梁平县| 颍上县| 广平县| 德州市| 和硕县| 博罗县| 西乌| 通河县| 比如县| 古交市| 文山县| 诸暨市| 项城市| 米泉市| 根河市| 呼伦贝尔市| 平和县| 河源市| 海南省| 思茅市| 峨眉山市| 丽江市| 乌兰县| 白玉县| 开远市| 武鸣县| 柘荣县| 二连浩特市| 马公市| 潼南县| 乐安县| 游戏| 深水埗区| 宁南县| 穆棱市| 鲁甸县| 平和县| 玛纳斯县| 新龙县| 永泰县| 华宁县| 汤阴县| 鸡西市| 奉节县| 西贡区| 威海市| 井陉县| 铜陵市| 新晃| 大石桥市| 昭觉县| http://wap.hholesaler888.com http://hsnowr888.com http://gwheell888.com http://wap.gwzipl888.com http://www.gwvaryl888.com http://wap.hstepr888.com http://flsecondo888.com http://wap.gwvolunteerl888.com http://m.gwishl888.com http://3g.hspiritr888.com http://www.hwarmr888.com