Skip to content

Commit

Permalink
Deploying to gh-pages from @ 88e02a1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts committed Nov 11, 2024
1 parent 2e192f8 commit 484f9f1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: df84eedae45938955c6298173be652d3
config: 4fe7d5568ffb88fafbd431a32ff4ff59
tags: d77d1c0d9ca2f4c8421862c7c5a0d620
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion main/introduction/create_custom_env/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ <h2>Constructing Observations<a class="headerlink" href="#constructing-observati
</section>
<section id="reset-function">
<h2>Reset function<a class="headerlink" href="#reset-function" title="Link to this heading"></a></h2>
<p>As the purpose of <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a> is to initiate a new episode for an environment and has two parameters: <code class="docutils literal notranslate"><span class="pre">seed</span></code> and <code class="docutils literal notranslate"><span class="pre">options</span></code>. The seed can be used to initialize the random number generator to a deterministic state and options can be used to specify values used within reset. On the first line of the reset, you need to call <code class="docutils literal notranslate"><span class="pre">super().reset(seed=seed)</span></code> which will initialize the random number generate (<a class="reference internal" href="../../api/env/#gymnasium.Env.np_random" title="gymnasium.Env.np_random"><code class="xref py py-attr docutils literal notranslate"><span class="pre">np_random</span></code></a>) to use through the rest of the <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a>.</p>
<p>The purpose of <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a> is to initiate a new episode for an environment and has two parameters: <code class="docutils literal notranslate"><span class="pre">seed</span></code> and <code class="docutils literal notranslate"><span class="pre">options</span></code>. The seed can be used to initialize the random number generator to a deterministic state and options can be used to specify values used within reset. On the first line of the reset, you need to call <code class="docutils literal notranslate"><span class="pre">super().reset(seed=seed)</span></code> which will initialize the random number generate (<a class="reference internal" href="../../api/env/#gymnasium.Env.np_random" title="gymnasium.Env.np_random"><code class="xref py py-attr docutils literal notranslate"><span class="pre">np_random</span></code></a>) to use through the rest of the <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a>.</p>
<p>Within our custom environment, the <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a> needs to randomly choose the agent and target’s positions (we repeat this if they have the same position). The return type of <a class="reference internal" href="../../api/env/#gymnasium.Env.reset" title="gymnasium.Env.reset"><code class="xref py py-meth docutils literal notranslate"><span class="pre">reset()</span></code></a> is a tuple of the initial observation and any auxiliary information. Therefore, we can use the methods <code class="docutils literal notranslate"><span class="pre">_get_obs</span></code> and <code class="docutils literal notranslate"><span class="pre">_get_info</span></code> that we implemented earlier for that:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">seed</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="c1"># We need the following line to seed self.np_random</span>
Expand Down

0 comments on commit 484f9f1

Please sign in to comment.