Skip to content

Commit

Permalink
Update README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbieri committed Nov 4, 2021
2 parents e0b22e2 + 80443e8 commit 3f3bd62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ This package implements the models of [Shelegia and Motta (2021)](resources/shel
![GitHub repo size](https://img.shields.io/github/repo-size/manuelbieri/shelegia_motta_2021)
![GitHub last commit](https://img.shields.io/github/last-commit/manuelbieri/shelegia_motta_2021)
![CI](https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/ci.yml/badge.svg)
![CodeQL](https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/codeql-analysis.yml/badge.svg)
![OSSAR](https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/ossar-analysis.yml/badge.svg)
![GitHub Release Date](https://img.shields.io/github/release-date/manuelbieri/shelegia_motta_2021)
![PyPi](https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/pypi.yml/badge.svg)
![PyPI](https://img.shields.io/pypi/v/Shelegia-Motta-2021)
![PyPI - Status](https://img.shields.io/pypi/status/Shelegia-Motta-2021)
![GitHub Release Date](https://img.shields.io/github/release-date/manuelbieri/shelegia_motta_2021)
![GitHub deployments](https://img.shields.io/github/deployments/manuelbieri/shelegia_motta_2021/github-pages?label=Documentation)

### Installation
Expand Down
4 changes: 3 additions & 1 deletion docs/Shelegia_Motta_2021.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ <h1 class="modulename">
<img src="https://img.shields.io/github/repo-size/manuelbieri/shelegia_motta_2021" alt="GitHub repo size" />
<img src="https://img.shields.io/github/last-commit/manuelbieri/shelegia_motta_2021" alt="GitHub last commit" />
<img src="https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/ci.yml/badge.svg" alt="CI" />
<img src="https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/codeql-analysis.yml/badge.svg" alt="CodeQL" />
<img src="https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/ossar-analysis.yml/badge.svg" alt="OSSAR" />
<img src="https://img.shields.io/github/release-date/manuelbieri/shelegia_motta_2021" alt="GitHub Release Date" />
<img src="https://github.com/manuelbieri/shelegia_motta_2021/actions/workflows/pypi.yml/badge.svg" alt="PyPi" />
<img src="https://img.shields.io/pypi/v/Shelegia-Motta-2021" alt="PyPI" />
<img src="https://img.shields.io/pypi/status/Shelegia-Motta-2021" alt="PyPI - Status" />
<img src="https://img.shields.io/github/release-date/manuelbieri/shelegia_motta_2021" alt="GitHub Release Date" />
<img src="https://img.shields.io/github/deployments/manuelbieri/shelegia_motta_2021/github-pages?label=Documentation" alt="GitHub deployments" /></p>

<h3 id="installation">Installation</h3>
Expand Down
13 changes: 8 additions & 5 deletions docs/Shelegia_Motta_2021/Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ <h1 class="modulename">
<span class="nb">super</span><span class="p">(</span><span class="n">UnobservableModel</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">u</span><span class="o">=</span><span class="n">u</span><span class="p">,</span> <span class="n">B</span><span class="o">=</span><span class="n">B</span><span class="p">,</span> <span class="n">small_delta</span><span class="o">=</span><span class="n">small_delta</span><span class="p">,</span> <span class="n">delta</span><span class="o">=</span><span class="n">delta</span><span class="p">,</span> <span class="n">K</span><span class="o">=</span><span class="n">K</span><span class="p">,</span> <span class="n">beta</span><span class="o">=</span><span class="n">beta</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">plot_incumbent_best_answers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">:</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="n">kwargs</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_create_choice_answer_label</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">entrant</span><span class="p">:</span> <span class="n">Literal</span><span class="p">[</span><span class="s2">&quot;complement&quot;</span><span class="p">,</span> <span class="s2">&quot;substitute&quot;</span><span class="p">,</span> <span class="s2">&quot;indifferent&quot;</span><span class="p">],</span>
<span class="n">incumbent</span><span class="p">:</span> <span class="n">Literal</span><span class="p">[</span><span class="s2">&quot;copy&quot;</span><span class="p">,</span> <span class="s2">&quot;refrain&quot;</span><span class="p">],</span>
Expand Down Expand Up @@ -985,6 +985,7 @@ <h1 class="modulename">

<span class="k">def</span> <span class="nf">get_optimal_choice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">A</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">F</span><span class="p">:</span> <span class="nb">float</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]:</span>
<span class="n">result</span><span class="p">:</span> <span class="n">Dict</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_optimal_choice</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">F</span><span class="p">)</span>
<span class="c1"># adjust the different choices in area three -&gt; since the kill zone does not exist in this model.</span>
<span class="k">if</span> <span class="n">result</span><span class="p">[</span><span class="s2">&quot;entrant&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;complement&quot;</span><span class="p">]:</span>
<span class="n">result</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;entrant&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;substitute&quot;</span><span class="p">],</span> <span class="s2">&quot;incumbent&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">INCUMBENT_CHOICES</span><span class="p">[</span><span class="s2">&quot;copy&quot;</span><span class="p">],</span> <span class="s2">&quot;development&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEVELOPMENT_OUTCOME</span><span class="p">[</span><span class="s2">&quot;failure&quot;</span><span class="p">]}</span>
<span class="k">return</span> <span class="n">result</span>
Expand Down Expand Up @@ -1030,8 +1031,8 @@ <h1 class="modulename">


<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">bargaining_power_model</span> <span class="o">=</span> <span class="n">Shelegia_Motta_2021</span><span class="o">.</span><span class="n">BargainingPowerModel</span><span class="p">(</span><span class="n">beta</span><span class="o">=</span><span class="mf">0.6</span><span class="p">)</span>
<span class="n">bargaining_power_model</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">()</span>
<span class="n">bargaining_power_model</span> <span class="o">=</span> <span class="n">Shelegia_Motta_2021</span><span class="o">.</span><span class="n">UnobservableModel</span><span class="p">(</span><span class="n">beta</span><span class="o">=</span><span class="mf">0.6</span><span class="p">)</span>
<span class="n">bargaining_power_model</span><span class="o">.</span><span class="n">plot_incumbent_best_answers</span><span class="p">(</span><span class="n">options_legend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>

Expand Down Expand Up @@ -2822,7 +2823,7 @@ <h5>Inherited Members</h5>
<span class="nb">super</span><span class="p">(</span><span class="n">UnobservableModel</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">u</span><span class="o">=</span><span class="n">u</span><span class="p">,</span> <span class="n">B</span><span class="o">=</span><span class="n">B</span><span class="p">,</span> <span class="n">small_delta</span><span class="o">=</span><span class="n">small_delta</span><span class="p">,</span> <span class="n">delta</span><span class="o">=</span><span class="n">delta</span><span class="p">,</span> <span class="n">K</span><span class="o">=</span><span class="n">K</span><span class="p">,</span> <span class="n">beta</span><span class="o">=</span><span class="n">beta</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">plot_incumbent_best_answers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">:</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="n">kwargs</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_create_choice_answer_label</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">entrant</span><span class="p">:</span> <span class="n">Literal</span><span class="p">[</span><span class="s2">&quot;complement&quot;</span><span class="p">,</span> <span class="s2">&quot;substitute&quot;</span><span class="p">,</span> <span class="s2">&quot;indifferent&quot;</span><span class="p">],</span>
<span class="n">incumbent</span><span class="p">:</span> <span class="n">Literal</span><span class="p">[</span><span class="s2">&quot;copy&quot;</span><span class="p">,</span> <span class="s2">&quot;refrain&quot;</span><span class="p">],</span>
Expand Down Expand Up @@ -2853,6 +2854,7 @@ <h5>Inherited Members</h5>

<span class="k">def</span> <span class="nf">get_optimal_choice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">A</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">F</span><span class="p">:</span> <span class="nb">float</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]:</span>
<span class="n">result</span><span class="p">:</span> <span class="n">Dict</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_optimal_choice</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">F</span><span class="p">)</span>
<span class="c1"># adjust the different choices in area three -&gt; since the kill zone does not exist in this model.</span>
<span class="k">if</span> <span class="n">result</span><span class="p">[</span><span class="s2">&quot;entrant&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;complement&quot;</span><span class="p">]:</span>
<span class="n">result</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;entrant&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;substitute&quot;</span><span class="p">],</span> <span class="s2">&quot;incumbent&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">INCUMBENT_CHOICES</span><span class="p">[</span><span class="s2">&quot;copy&quot;</span><span class="p">],</span> <span class="s2">&quot;development&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEVELOPMENT_OUTCOME</span><span class="p">[</span><span class="s2">&quot;failure&quot;</span><span class="p">]}</span>
<span class="k">return</span> <span class="n">result</span>
Expand Down Expand Up @@ -2910,7 +2912,7 @@ <h5>Inherited Members</h5>
<details>
<summary>View Source</summary>
<div class="codehilite"><pre><span></span> <span class="k">def</span> <span class="nf">plot_incumbent_best_answers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">:</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">matplotlib</span><span class="o">.</span><span class="n">axes</span><span class="o">.</span><span class="n">Axes</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="n">kwargs</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_equilibrium</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</pre></div>

</details>
Expand Down Expand Up @@ -2950,6 +2952,7 @@ <h6 id="returns">Returns</h6>
<summary>View Source</summary>
<div class="codehilite"><pre><span></span> <span class="k">def</span> <span class="nf">get_optimal_choice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">A</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">F</span><span class="p">:</span> <span class="nb">float</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]:</span>
<span class="n">result</span><span class="p">:</span> <span class="n">Dict</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_optimal_choice</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">F</span><span class="p">)</span>
<span class="c1"># adjust the different choices in area three -&gt; since the kill zone does not exist in this model.</span>
<span class="k">if</span> <span class="n">result</span><span class="p">[</span><span class="s2">&quot;entrant&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;complement&quot;</span><span class="p">]:</span>
<span class="n">result</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;entrant&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENTRANT_CHOICES</span><span class="p">[</span><span class="s2">&quot;substitute&quot;</span><span class="p">],</span> <span class="s2">&quot;incumbent&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">INCUMBENT_CHOICES</span><span class="p">[</span><span class="s2">&quot;copy&quot;</span><span class="p">],</span> <span class="s2">&quot;development&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEVELOPMENT_OUTCOME</span><span class="p">[</span><span class="s2">&quot;failure&quot;</span><span class="p">]}</span>
<span class="k">return</span> <span class="n">result</span>
Expand Down
Loading

0 comments on commit 3f3bd62

Please sign in to comment.