首页 > 其他分享 >Start OpenAI gym on arbitrary initial state

Start OpenAI gym on arbitrary initial state

时间:2024-08-27 13:57:42浏览次数:5  
标签:reset do Gym initial self Start state OpenAI gym

题意:“在任意初始状态下启动 OpenAI Gym”

问题背景:

Anybody knows any OpenAI Gym environments where we can set the initial state of the game? For example, I found the MountainCarContinuous-v0 can do such thing so that we can select at which point the car starts. However, I am looking for another more complex environment. Thanks in advance for your help!

“有人知道可以设置游戏初始状态的 OpenAI Gym 环境吗?例如,我发现 MountainCarContinuous-v0 可以做到这一点,这样我们可以选择汽车从哪个点开始。但是,我正在寻找另一个更复杂的环境。提前感谢您的帮助!”

问题解决:

You have to redefine the reset function of the class (for example, this). You may want to define it such that it gets as input your desired state, something like

“你需要重新定义这个类的 reset 函数(例如,this)。你可能希望将其定义为接受你所需状态作为输入的形式,类似于这样”

def reset(self, state):
    self.state = state
    return np.array(self.state)

This should work for all OpenAI gym environments. If you want to do it for other simulators, things may be different. For instance, MuJoCo allows to do something like

“这应该适用于所有 OpenAI Gym 环境。如果你想在其他模拟器中实现这一点,情况可能会有所不同。例如,MuJoCo 允许你做类似的事情。”

saved_state = env.sim.get_state()
env.sim.set_state(saved_state)

标签:reset,do,Gym,initial,self,Start,state,OpenAI,gym
From: https://blog.csdn.net/suiusoar/article/details/141601045

相关文章

  • 定制ISO时在kickstart脚本中利用%pre预先检查硬件环境
    自己定制ISO使用ks.cfg实现自动安装时,有时需要预先检查硬件环境是否满足安装要求,比如cpu和内存数量,硬件环境不满足时直接停止安装,此时可以利用%pre配合--erroronfail参数来达到目的。%pre段是在安装前执行的,--erroronfail表示出现错误后停止安装。以检查cpu为例,可以这么写:%pre......
  • C# start thread include Thread,Task,Async/Await,BackgroundWorker,ThreadPool,Time
    usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Linq;usingSystem.Text;usingSystem.Threading;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;using......
  • 【JavaScript】字符串01 - padStart() 和 padEnd()
    在JavaScript中,我们可以使用padStart()和padEnd()方法来完成字符串补全。下面给大家介绍一下这两个方法的使用。padStart()方法用于在当前字符串的前面填充指定的字符,直到字符串的长度达到指定的长度。padEnd()方法用于在当前字符串的后面填充指定的字符,直到字符串的长......
  • 【内网渗透】最保姆级的春秋云镜initial打靶笔记
    目录flag1flag2flag3 flag1外网thinkphp服务 随便找个工具梭连蚁剑读/root目录要提权suid没有可利用的提权命令,打sudo提权sudo-lmysql的sudo提权 Linux提权之Sudo70种提权方法-简单安全 查看文件名带flag的文件sudomysql-e'\!find/-typef-n......
  • Android T don't abort background activity starts
    log:2024-08-2015:45:12.457581-1128ActivityTaskManagersystem_processISTARTu0{act=android.intent.action.MAINcat=[android.intent.category.LAUNCHER]flg=0x10000000pkg=acr.browser.lightningcmp=acr.browser.lightning/.Ma......
  • 【OCPP】ocpp1.6协议第5.11章节Remote Start Transaction的介绍及翻译
    目录5.11RemoteStartTransaction-概述1.目的2.消息类型2.1RemoteStartTransaction.req2.2RemoteStartTransaction.conf3.流程描述4.状态和值域5.特殊情况5.11远程启动交易RemoteStartTransaction-原文译文5.11RemoteStartTransaction-概述在OCPP......
  • Windows Sandbox failed to initialize. Error 0x80370106
    #报错提示之前都好好的突然打开WindowsSandbox出现上面提示,经过网上搜索,我的版本是24H2(OSBuild26120.1252) #尝试更新到最新版本  ......
  • js 字符操作 padStart padEnd 使用教程
    padStart和padEnd是JavaScript中字符串方法,用于在字符串的开头或结尾添加填充字符,直到达到指定的长度。padStart(targetLength,padString)targetLength:目标字符串长度。padString:用于填充的字符串。用法:conststr="hello";//在字符串开头添加空格,直到长度为......
  • js 字符操作startswidth 方法使用
    startswidth用于检查字符串是否以指定的子字符串开头。startsWith(searchString,position)searchString:要搜索的子字符串。position:可选参数,指定搜索开始的位置(默认值为0)。用法:conststr="helloworld";//检查字符串是否以"hello"开头conststartsWithHello......
  • gym创建环境、自定义gym环境
    环境:half_cheetah.pyfromosimportpathimportnumpyasnpfromgymnasiumimportutilsfromgymnasium.envs.mujocoimportMujocoEnvfromgymnasium.spacesimportBoxDEFAULT_CAMERA_CONFIG={"distance":4.0,}classMOHalfCheetahEnv(Mujoc......