Skip to content

Commit

Permalink
doc upadte
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserfarouk committed Nov 27, 2023
1 parent 482670c commit a4d89e2
Show file tree
Hide file tree
Showing 26 changed files with 454 additions and 349 deletions.
36 changes: 16 additions & 20 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@
# NON_RTD_THEME = "groundwork"
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if on_rtd:
import sphinx_rtd_theme
import sphinx_rtd_theme

THEME_NAME = "sphinx_rtd_theme"
THEME_PATH = None
else:
import sphinx_rtd_theme

THEME_NAME = "sphinx_rtd_theme"
THEME_PATH = [sphinx_rtd_theme.get_html_theme_path()]
THEME_NAME = "sphinx_rtd_theme"
THEME_PATH = [sphinx_rtd_theme.get_html_theme_path()]
# if on_rtd:
# # THEME_PATH = None

# typing.get_type_hints = lambda obj, *unused: obj

Expand Down Expand Up @@ -133,22 +129,22 @@
html_static_path = ["_static"]


if on_rtd: # only set the theme if we're building docs locally
if not on_rtd: # only set the theme if we're building docs locally
html_context = {
"css_files": [
"_static/theme_overrides.css"
] # override wide tables in RTD theme
}
# theme options for sphinx_rtd_theme
html_theme_options = {
"collapse_navigation": False,
"sticky_navigation": True,
"navigation_depth": 4,
"includehidden": True,
"display_version": True,
"prev_next_buttons_location": "bottom",
"titles_only": False,
}
# theme options for sphinx_rtd_theme
html_theme_options = {
"collapse_navigation": False,
"sticky_navigation": True,
"navigation_depth": 4,
"includehidden": True,
"display_version": True,
"prev_next_buttons_location": "bottom",
"titles_only": False,
}
html_theme = THEME_NAME
if THEME_PATH:
html_theme_path = THEME_PATH
Expand Down
57 changes: 3 additions & 54 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ concurrently running negotiations (or on expectations of future
negotiations). NegMAS provides two ways to support this case shown in
the following figure:

.. figure:: figs/controllers.jpg
.. figure:: figs/controllers.png
:alt: controllers

controllers
Expand Down Expand Up @@ -422,7 +422,7 @@ You can pick random valid or invalid values for the issue:
.. parsed-literal::
[['to be', '20231110H001622435924jJTGt6qBto be20231110H001622435941XtRgNy0I'],
[['to be', '20231127H095041904848jJTGt6qBto be20231127H095041904865XtRgNy0I'],
[6, 10],
[0.6118970848141451, 1.928063278403899]]
Expand Down Expand Up @@ -2181,7 +2181,7 @@ state from the real world) and manages creation and destruction of
``AgentWorldInterface``\ s (AWI) and connecting them to ``Agent``\ s.

``Agent``\ s can join and leave worlds using the ``join`` and ``leave``
methods and can interact with it through their AWI.
methods and can interact with it through their AWIs.

To create a new world type, you need to override a single method
(``simulation_step``) in the base ``World`` class to define your
Expand All @@ -2190,54 +2190,3 @@ inherited class that is capable of interacting with this world and a
corresponding ``AgentWorldInterface``.

You can see an example of a world simulation in the tutorials.


.. code:: ipython3
# define the protocol as a single function
def sao(negotiators, *, n_steps: int):
offer = None
n_acceptances, n_negotiators = 1, len(negotiators)
for i in range(n_steps):
for current in negotiators:
response = current(offer)
# None means accept
if response is None:
n_acceptances += 1
if n_acceptances >= n_negotiators:
return offer
# an empty tuple means END
if not response:
return None
offer = response
n_acceptances = 1
return None
# a negotiator as a single function
from random import choice
def limited_outcomes_negotiator(offer,*, acceptable):
# accept if in acceptables
if offer in acceptable:
return None
# otherwise offer a random acceptable offer
return choice(acceptable)
.. code:: ipython3
# run a simple negotiation
from functools import partial
sao(
[
partial(limited_outcomes_negotiator, acceptable=[(2,), (3,), (5,)]),
partial(limited_outcomes_negotiator, acceptable=[(1,), (4,), (3,)]),
],
n_steps=10)
.. parsed-literal::
(3,)
78 changes: 39 additions & 39 deletions docs/tutorials/01.running_simple_negotiation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ to run negotiations as follows:
<span style="color: #808000; text-decoration-color: #808000">waiting</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
<span style="color: #808000; text-decoration-color: #808000">started</span>=<span style="color: #00ff00; text-decoration-color: #00ff00; font-style: italic">True</span>,
<span style="color: #808000; text-decoration-color: #808000">step</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.00042062499960593414</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.0019867499941028655</span>,
<span style="color: #808000; text-decoration-color: #808000">relative_time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.019801980198019802</span>,
<span style="color: #808000; text-decoration-color: #808000">broken</span>=<span style="color: #00ff00; text-decoration-color: #00ff00; font-style: italic">True</span>,
<span style="color: #808000; text-decoration-color: #808000">timedout</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
Expand Down Expand Up @@ -197,7 +197,7 @@ This can be modeled in the following negotiation:
<span style="color: #808000; text-decoration-color: #808000">waiting</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
<span style="color: #808000; text-decoration-color: #808000">started</span>=<span style="color: #00ff00; text-decoration-color: #00ff00; font-style: italic">True</span>,
<span style="color: #808000; text-decoration-color: #808000">step</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">18</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.004511832999924081</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.00982054098858498</span>,
<span style="color: #808000; text-decoration-color: #808000">relative_time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.9047619047619048</span>,
<span style="color: #808000; text-decoration-color: #808000">broken</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
<span style="color: #808000; text-decoration-color: #808000">timedout</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
Expand All @@ -209,7 +209,7 @@ This can be modeled in the following negotiation:
<span style="color: #808000; text-decoration-color: #808000">threads</span>=<span style="font-weight: bold">{}</span>,
<span style="color: #808000; text-decoration-color: #808000">last_thread</span>=<span style="color: #008000; text-decoration-color: #008000">''</span>,
<span style="color: #808000; text-decoration-color: #808000">current_offer</span>=<span style="font-weight: bold">(</span><span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">9</span>, <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0</span><span style="font-weight: bold">)</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer</span>=<span style="color: #008000; text-decoration-color: #008000">'seller-f65b7720-0602-4c41-8735-e08551285758'</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer</span>=<span style="color: #008000; text-decoration-color: #008000">'seller-8a22855f-6488-4269-8389-4226fcaabef2'</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer_agent</span>=<span style="color: #800080; text-decoration-color: #800080; font-style: italic">None</span>,
<span style="color: #808000; text-decoration-color: #808000">n_acceptances</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2</span>,
<span style="color: #808000; text-decoration-color: #808000">new_offers</span>=<span style="font-weight: bold">[]</span>,
Expand Down Expand Up @@ -238,40 +238,40 @@ s tep of the negotiation:
.. parsed-literal::
[(0, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(0, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(1, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(1, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(2, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(2, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(3, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(3, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(4, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(4, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(5, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 9)),
(5, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 0)),
(6, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 10, 9)),
(6, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 10, 0)),
(7, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 9, 9)),
(7, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 9, 0)),
(8, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 8, 9)),
(8, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 8, 0)),
(9, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 11, 8)),
(9, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 11, 1)),
(10, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 9, 8)),
(10, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 4, 0)),
(11, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 1, 9)),
(11, 'seller-f65b7720-0602-4c41-8735-e08551285758', (8, 6, 0)),
(12, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 2, 8)),
(12, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 7, 2)),
(13, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (2, 2, 9)),
(13, 'seller-f65b7720-0602-4c41-8735-e08551285758', (9, 7, 3)),
(14, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (0, 10, 4)),
(14, 'seller-f65b7720-0602-4c41-8735-e08551285758', (4, 10, 0)),
(15, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (1, 8, 4)),
(15, 'seller-f65b7720-0602-4c41-8735-e08551285758', (8, 3, 4)),
(16, 'buyer-7e314af4-74a8-4b8b-b23b-c325d18fc0b8', (6, 9, 7)),
(16, 'seller-f65b7720-0602-4c41-8735-e08551285758', (1, 9, 0))]
[(0, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(0, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(1, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(1, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(2, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(2, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(3, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(3, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(4, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(4, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(5, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 9)),
(5, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 0)),
(6, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 10, 9)),
(6, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 10, 0)),
(7, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 9, 9)),
(7, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 9, 0)),
(8, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 8, 9)),
(8, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 8, 0)),
(9, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 11, 8)),
(9, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 11, 1)),
(10, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 9, 8)),
(10, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 4, 0)),
(11, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 1, 9)),
(11, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (8, 6, 0)),
(12, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 2, 8)),
(12, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 7, 2)),
(13, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (2, 2, 9)),
(13, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (9, 7, 3)),
(14, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (0, 10, 4)),
(14, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (4, 10, 0)),
(15, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (1, 8, 4)),
(15, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (8, 3, 4)),
(16, 'buyer-7aa76320-6f35-43ce-a964-ed36db1eda7c', (6, 9, 7)),
(16, 'seller-8a22855f-6488-4269-8389-4226fcaabef2', (1, 9, 0))]
Expand Down Expand Up @@ -324,7 +324,7 @@ the delivery time and price to go down. Let’s see what happens:
<span style="color: #808000; text-decoration-color: #808000">waiting</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
<span style="color: #808000; text-decoration-color: #808000">started</span>=<span style="color: #00ff00; text-decoration-color: #00ff00; font-style: italic">True</span>,
<span style="color: #808000; text-decoration-color: #808000">step</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">41</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.007744999998976709</span>,
<span style="color: #808000; text-decoration-color: #808000">time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.0068522910005413</span>,
<span style="color: #808000; text-decoration-color: #808000">relative_time</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0.8235294117647058</span>,
<span style="color: #808000; text-decoration-color: #808000">broken</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
<span style="color: #808000; text-decoration-color: #808000">timedout</span>=<span style="color: #ff0000; text-decoration-color: #ff0000; font-style: italic">False</span>,
Expand All @@ -336,7 +336,7 @@ the delivery time and price to go down. Let’s see what happens:
<span style="color: #808000; text-decoration-color: #808000">threads</span>=<span style="font-weight: bold">{}</span>,
<span style="color: #808000; text-decoration-color: #808000">last_thread</span>=<span style="color: #008000; text-decoration-color: #008000">''</span>,
<span style="color: #808000; text-decoration-color: #808000">current_offer</span>=<span style="font-weight: bold">(</span><span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">10</span>, <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3</span><span style="font-weight: bold">)</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer</span>=<span style="color: #008000; text-decoration-color: #008000">'seller-c99292a8-ed54-41a5-8192-a4b81b63bb73'</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer</span>=<span style="color: #008000; text-decoration-color: #008000">'seller-189109b6-e48c-4af6-bc09-894c9fef067a'</span>,
<span style="color: #808000; text-decoration-color: #808000">current_proposer_agent</span>=<span style="color: #800080; text-decoration-color: #800080; font-style: italic">None</span>,
<span style="color: #808000; text-decoration-color: #808000">n_acceptances</span>=<span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2</span>,
<span style="color: #808000; text-decoration-color: #808000">new_offers</span>=<span style="font-weight: bold">[]</span>,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a4d89e2

Please sign in to comment.