Skip to content

Commit

Permalink
Deploying to gh-pages from @ 1cc95ad 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
umutucak committed Jan 30, 2024
1 parent 7b5eaed commit f76086a
Show file tree
Hide file tree
Showing 32 changed files with 68 additions and 33 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="/genindex/" /><link rel="search" title="Search" href="/search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>404 - Page Not Found - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="/_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="/_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../genindex/" /><link rel="search" title="Search" href="../search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>Overview: module code - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?v=135e06be" />
Expand Down
37 changes: 36 additions & 1 deletion _modules/momaland/utils/aec_wrappers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../../genindex/" /><link rel="search" title="Search" href="../../../../search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>momaland.utils.aec_wrappers - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../../../_static/styles/furo.css?v=135e06be" />
Expand Down Expand Up @@ -228,12 +228,47 @@
<article role="main">
<h1>Source code for momaland.utils.aec_wrappers</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;Various wrappers for AEC MO environments.&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Optional</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">gymnasium.wrappers.normalize</span> <span class="kn">import</span> <span class="n">RunningMeanStd</span>
<span class="kn">from</span> <span class="nn">pettingzoo.utils.wrappers.base</span> <span class="kn">import</span> <span class="n">BaseWrapper</span>


<span class="k">class</span> <span class="nc">RecordEpisodeStatistics</span><span class="p">(</span><span class="n">BaseWrapper</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;This wrapper will record episode statistics and print them at the end of each episode.&quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;This wrapper will record episode statistics and print them at the end of each episode.</span>

<span class="sd"> Args:</span>
<span class="sd"> env (env): The environment to apply the wrapper</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">BaseWrapper</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_rewards</span> <span class="o">=</span> <span class="p">{</span><span class="n">agent</span><span class="p">:</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">agent</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">possible_agents</span><span class="p">}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_lengths</span> <span class="o">=</span> <span class="p">{</span><span class="n">agent</span><span class="p">:</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">agent</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">possible_agents</span><span class="p">}</span>

<span class="k">def</span> <span class="nf">last</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">observe</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Receives the latest observation from the environment, recording episode statistics.&quot;&quot;&quot;</span>
<span class="n">obs</span><span class="p">,</span> <span class="n">rews</span><span class="p">,</span> <span class="n">terminated</span><span class="p">,</span> <span class="n">truncated</span><span class="p">,</span> <span class="n">infos</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">last</span><span class="p">(</span><span class="n">observe</span><span class="o">=</span><span class="n">observe</span><span class="p">)</span>
<span class="k">for</span> <span class="n">agent</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">possible_agents</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_rewards</span><span class="p">[</span><span class="n">agent</span><span class="p">]</span> <span class="o">+=</span> <span class="n">rews</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_lengths</span><span class="p">[</span><span class="n">agent</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">if</span> <span class="n">terminated</span> <span class="ow">or</span> <span class="n">truncated</span><span class="p">:</span>
<span class="n">infos</span><span class="p">[</span><span class="s2">&quot;episode&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;r&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">episode_rewards</span><span class="p">,</span>
<span class="s2">&quot;l&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">episode_lengths</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">obs</span><span class="p">,</span> <span class="n">rews</span><span class="p">,</span> <span class="n">terminated</span><span class="p">,</span> <span class="n">truncated</span><span class="p">,</span> <span class="n">infos</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="w"> </span><span class="sd">&quot;&quot;&quot;Resets the environment and the episode statistics.&quot;&quot;&quot;</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">reset</span><span class="p">(</span><span class="n">seed</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span>
<span class="k">for</span> <span class="n">agent</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">possible_agents</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_rewards</span><span class="p">[</span><span class="n">agent</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_lengths</span><span class="p">[</span><span class="n">agent</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>


<div class="viewcode-block" id="LinearizeReward">
<a class="viewcode-back" href="../../../../api/wrappers/#momaland.utils.aec_wrappers.LinearizeReward">[docs]</a>
<span class="k">class</span> <span class="nc">LinearizeReward</span><span class="p">(</span><span class="n">BaseWrapper</span><span class="p">):</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/momaland/utils/conversions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../../genindex/" /><link rel="search" title="Search" href="../../../../search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>momaland.utils.conversions - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/momaland/utils/env/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../../genindex/" /><link rel="search" title="Search" href="../../../../search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>momaland.utils.env - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../../../_static/styles/furo.css?v=135e06be" />
Expand Down
4 changes: 2 additions & 2 deletions _modules/momaland/utils/parallel_wrappers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../../genindex/" /><link rel="search" title="Search" href="../../../../search/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>momaland.utils.parallel_wrappers - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../../../_static/styles/furo.css?v=135e06be" />
Expand Down Expand Up @@ -264,7 +264,7 @@ <h1>Source code for momaland.utils.parallel_wrappers</h1><div class="highlight">
<span class="k">return</span> <span class="n">obs</span><span class="p">,</span> <span class="n">rews</span><span class="p">,</span> <span class="n">terminateds</span><span class="p">,</span> <span class="n">truncateds</span><span class="p">,</span> <span class="n">infos</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="w"> </span><span class="sd">&quot;&quot;&quot;Resets the environment, recording episode statistics.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Resets the environment and the episode statistics.&quot;&quot;&quot;</span>
<span class="n">obs</span><span class="p">,</span> <span class="n">info</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">reset</span><span class="p">(</span><span class="n">seed</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span>
<span class="k">for</span> <span class="n">agent</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">possible_agents</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episode_rewards</span><span class="p">[</span><span class="n">agent</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
Expand Down
2 changes: 1 addition & 1 deletion _static/scripts/furo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _static/styles/furo.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/aec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="Parallel" href="../parallel/" /><link rel="prev" title="Install" href="../../introduction/install/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>AEC - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion api/parallel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="Wrappers and Utils" href="../wrappers/" /><link rel="prev" title="AEC" href="../aec/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>Parallel - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion api/wrappers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="All Environments" href="../../environments/all-envs/" /><link rel="prev" title="Parallel" href="../parallel/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>Wrappers and Utils - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/all-envs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="Catch" href="../catch/" /><link rel="prev" title="Wrappers and Utils" href="../../api/wrappers/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>All Environments - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/catch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="Escort" href="../escort/" /><link rel="prev" title="All Environments" href="../all-envs/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>Catch - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/escort/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="MO-Beach" href="../mobeach/" /><link rel="prev" title="Catch" href="../catch/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>Escort - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/mobeach/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="MO-Breakthrough" href="../mobreakthrough/" /><link rel="prev" title="Escort" href="../escort/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>MO-Beach - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/mobreakthrough/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="MO-Congestion" href="../mocongestion/" /><link rel="prev" title="MO-Beach" href="../mobeach/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>MO-Breakthrough - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
2 changes: 1 addition & 1 deletion environments/mocongestion/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="MO-Connect4" href="../moconnect4/" /><link rel="prev" title="MO-Breakthrough" href="../mobreakthrough/" />

<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<title>MO-Congestion - MOMAland Documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=135e06be" />
Expand Down
Loading

0 comments on commit f76086a

Please sign in to comment.