Skip to content

Commit 09cf3ab

Browse files
committed
docs: update CLI documentation for negmas and negotiate commands
- Add missing commands: docs, docs-setup, eval, combine-results - Document all negotiate CLI options organized by category - Add usage examples for negotiate command - Fix typos and improve formatting
1 parent 301330b commit 09cf3ab

1 file changed

Lines changed: 258 additions & 38 deletions

File tree

docs/scripts.rst

Lines changed: 258 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,67 @@
11
NegMAS CLI
22
==========
33

4-
When installing NegMAS through the pip command, you get two command line tool that can be used to
5-
aid your development and testing.
4+
When installing NegMAS through the pip command, you get two command line tools that can be used to
5+
aid your development and testing:
66

7-
This section describes the `negmas` CLI which provides a unified interface to all negmas commands.
7+
1. ``negmas`` - A unified interface to all negmas commands (genius setup, tournaments, docs, etc.)
8+
2. ``negotiate`` - A simple way to run negotiations, plot results, and save statistics
9+
10+
negmas Command
11+
--------------
12+
13+
This section describes the ``negmas`` CLI which provides a unified interface to all negmas commands.
814

915
The set of supported commands are:
1016

1117
=============== ===================================================================
1218
Command Meaning
1319
=============== ===================================================================
14-
genius-setup Downloads the genius bridge and updates your settings.
15-
genius Run a Genius Bridge. This bridge allows you to use GeniusNegotiator
16-
agents. Please notice that this command by-default runs in the
17-
foreground preventing further input to the terminal.\
20+
docs Opens negmas docs in the browser (requires docs-setup first)
21+
docs-setup Downloads and installs docs to ~/negmas/docs
22+
genius Start the bridge to genius (to use GeniusNegotiator)
23+
genius-setup Downloads the genius bridge and updates your settings
1824
tournament Runs a tournament
1925
version Prints NegMAS version
2026
=============== ===================================================================
2127

22-
The commands `genius-steup` have no parameters and will download genius for later use by the `genius` command.
28+
You can also run ``negmas --gui`` to enable GUI mode for supported commands.
29+
30+
Documentation Commands
31+
~~~~~~~~~~~~~~~~~~~~~~
32+
33+
**docs-setup**
34+
35+
Downloads and installs the NegMAS documentation to ``~/negmas/docs``. Run this once before using
36+
the ``docs`` command.
37+
38+
.. code-block:: console
39+
40+
$ negmas docs-setup
41+
42+
**docs**
43+
44+
Opens the NegMAS documentation in your default web browser. Make sure to run ``docs-setup`` first.
45+
46+
.. code-block:: console
47+
48+
$ negmas docs
2349
2450
Genius Bridge (negmas genius)
25-
-----------------------------
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2652

27-
The command ``genius`` can be used to start a JVM running the Genius_ platform allowing `GeniusNegotiator` objects
28-
to interact with existing GENIUS agents (Thanks for Tim Baarslag Lead Developer of GENIUS for allowing us
53+
The command ``genius`` can be used to start a JVM running the Genius_ platform allowing ``GeniusNegotiator`` objects
54+
to interact with existing GENIUS agents (Thanks to Tim Baarslag, Lead Developer of GENIUS, for allowing us
2955
to ship it within NegMAS).
3056

3157
.. _Genius: http://ii.tudelft.nl/genius/
3258

59+
Before using the genius command, you need to set it up:
60+
61+
.. code-block:: console
62+
63+
$ negmas genius-setup
64+
3365
You can get help on this tool by running:
3466

3567
.. code-block:: console
@@ -51,9 +83,9 @@ This tool supports the following *optional* arguments:
5183

5284

5385
Tournament Command (negmas tournament)
54-
--------------------------------------
86+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5587

56-
The Tournament command (`tournament`) allows you to run a tournament between different agents in some world and
88+
The Tournament command (``tournament``) allows you to run a tournament between different agents in some world and
5789
compare their relative performance. The tool is general enough to support several world types.
5890

5991

@@ -63,21 +95,22 @@ You can get help on this tool by running:
6395
6496
$ negmas tournament --help
6597
66-
The `tournament` command has a set of sub-commands for creating, running, and combining tournament results as follows:
98+
The ``tournament`` command has a set of sub-commands for creating, running, and combining tournament results as follows:
6799

68-
======== ================================================
69-
Command Action
70-
======== ================================================
71-
combine Finds winners of an arbitrary set of tournaments
72-
create Creates a tournament
73-
run Runs/continues a tournament
74-
winners Finds winners of a tournament or a set of
75-
tournaments sharing
76-
======== ================================================
100+
================ ====================================================
101+
Command Action
102+
================ ====================================================
103+
combine Combine multiple tournaments at given base path(s)
104+
combine-results Combine results from multiple tournaments
105+
create Creates a tournament
106+
eval Evaluates a tournament and returns the results
107+
run Runs/continues a tournament
108+
winners Finds winners of a tournament or a set of tournaments
109+
================ ====================================================
77110

78111

79112
Creating a tournament
80-
~~~~~~~~~~~~~~~~~~~~~
113+
^^^^^^^^^^^^^^^^^^^^^
81114

82115
These are the *optional* arguments of this tool:
83116

@@ -161,9 +194,9 @@ These are the *optional* arguments of this tool:
161194

162195

163196
Running a tournament
164-
~~~~~~~~~~~~~~~~~~~~
197+
^^^^^^^^^^^^^^^^^^^^
165198

166-
After creating a tournament using the `tournament create` command, it can be run using the `tournament run` command.
199+
After creating a tournament using the ``tournament create`` command, it can be run using the ``tournament run`` command.
167200
The parameters for this command are:
168201

169202
========================================== ==============================================================
@@ -200,7 +233,7 @@ The parameters for this command are:
200233

201234

202235
Upon completion, a complete log and several statistics are saved in a new folder under the `log folder` location
203-
specified by the `--log` argument (default is negmas/logs/tournaments under the HOME directory). To avoid over-writing
236+
specified by the ``--log`` argument (default is negmas/logs/tournaments under the HOME directory). To avoid over-writing
204237
earlier results, a new folder will be created for each run named by the current date and time. The
205238
folder will contain the following files:
206239

@@ -227,10 +260,19 @@ Other than these files, a folder with the same number as the corresponding confi
227260
statistics/log of every world *but only if --debug is specified* (see the `World Runner` section for the contents of
228261
this folder.
229262

263+
Evaluating a tournament
264+
^^^^^^^^^^^^^^^^^^^^^^^
265+
266+
To evaluate a tournament and get results, use the ``tournament eval`` command:
267+
268+
.. code-block:: console
269+
270+
$ negmas tournament eval --help
271+
230272
Combining tournament results
231-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232274

233-
Can be used to combine the results of multiple tournaments runs using tournament `combine`.
275+
Can be used to combine the results of multiple tournaments runs using ``tournament combine``.
234276
The parameters of this command are:
235277

236278
====================== =======================================================
@@ -243,11 +285,17 @@ The parameters of this command are:
243285
--config FILE Read configuration from FILE.
244286
====================== =======================================================
245287

288+
To combine results from multiple tournaments, use ``tournament combine-results``:
289+
290+
.. code-block:: console
291+
292+
$ negmas tournament combine-results --help
293+
246294
247295
Finding the winners of a tournament
248-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249297

250-
To report the winners of a tournament, you can use tournament `winners` . The parameters of this command are:
298+
To report the winners of a tournament, you can use ``tournament winners``. The parameters of this command are:
251299

252300
============================== =======================================================
253301
Argument Meaning
@@ -267,18 +315,190 @@ To report the winners of a tournament, you can use tournament `winners` . The pa
267315

268316

269317

270-
Negotiate CLI
271-
=============
318+
negotiate Command
319+
-----------------
272320

273-
When installing NegMAS through the pip command, you get two command line tool that can be used to
274-
aid your development and testing.
321+
The ``negotiate`` CLI provides a simple way for running negotiations, plotting them, and saving their statistics.
275322

276-
This section describes the `negotiate` CLI which provides a simple way for running negotiations,
277-
plotting them, saving their statistics, etc.
323+
Basic Usage
324+
~~~~~~~~~~~
278325

326+
Run a simple negotiation with default settings:
279327

280-
You can find out about all the available options by running
328+
.. code-block:: console
329+
330+
$ negotiate
331+
332+
Run with a specific scenario:
333+
334+
.. code-block:: console
335+
336+
$ negotiate --scenario path/to/scenario.yml
337+
338+
You can find out about all the available options by running:
281339

282340
.. code-block:: console
283341
284342
$ negotiate --help
343+
344+
Command Options
345+
~~~~~~~~~~~~~~~
346+
347+
The ``negotiate`` command supports many options organized into several categories:
348+
349+
**Basic Options**
350+
351+
================================ =================================================================
352+
Option Description
353+
================================ =================================================================
354+
--scenario PATH The scenario to negotiate about [default: Generate A new Scenario]
355+
-p, -m, --protocol, --mechanism The protocol (Mechanism) to use [default: SAO]
356+
-n, -a, --agent, --negotiator Negotiator (agent) type. Use adapter/negotiator format for
357+
adapters (e.g. TAUAdapter/AspirationNegotiator)
358+
[default: AspirationNegotiator, NaiveTitForTatNegotiator]
359+
-E, --extend-negotiators Extend the negotiator list to cover all ufuns
360+
-T, --truncate-ufuns Use only the first n negotiator ufuns
361+
--params TEXT Mechanism initialization parameters as comma-separated
362+
``key=value`` pairs
363+
--share-ufuns/--no-share-ufuns Share partner ufuns using private-data [default: no-share-ufuns]
364+
--share-reserved-values Share partner reserved-values using private-data
365+
================================ =================================================================
366+
367+
**Deadline Options**
368+
369+
=================== =================================================================
370+
Option Description
371+
=================== =================================================================
372+
-s, --steps Number of steps allowed in the negotiation [default: None]
373+
-t, --time Number of seconds allowed in the negotiation [default: None]
374+
=================== =================================================================
375+
376+
**Scenario Overrides**
377+
378+
========================= =================================================================
379+
Option Description
380+
========================= =================================================================
381+
-r, --reserved Reserved values to override the ones in the scenario
382+
-f, --fraction Rational fractions for generating reserved values
383+
-d/--discount, -D Load/skip discount factor [default: discount]
384+
--normalize/-N Normalize ufuns to range (0-1) [default: True]
385+
========================= =================================================================
386+
387+
**Generated Scenario Options**
388+
389+
When no scenario is provided, these options control scenario generation:
390+
391+
================================ =================================================================
392+
Option Description
393+
================================ =================================================================
394+
-i, --issues Number of issues [default: None]
395+
--values-min Minimum n. values per issue [default: 2]
396+
--values-max Maximum n. values per issue [default: 50]
397+
-z, --size Sizes of issues in order (overrides values-min/max)
398+
--reserved-values-min Min allowed reserved value [default: 0.0]
399+
--reserved-values-max Max allowed reserved value [default: 1.0]
400+
-R/--rational, -I/--irrational-ok Guarantee some rational outcomes [default: rational]
401+
-F, --rational-fraction Reservation fractions [default: None]
402+
--reservation-selector Reservation value selector: min|max|first|last [default: min]
403+
--issue-name Issue names [default: None]
404+
--os-name Outcome space name [default: None]
405+
--ufun-names Names of ufuns [default: None]
406+
--numeric/--no-numeric Numeric issues [default: no-numeric]
407+
--linear/--non-linear Linear ufuns [default: linear]
408+
--pareto-generator Pareto generator method(s)
409+
================================ =================================================================
410+
411+
**Output Control**
412+
413+
================================ =================================================================
414+
Option Description
415+
================================ =================================================================
416+
-v, --verbose Make verbose
417+
--verbosity INTEGER Verbosity level (higher=more verbose) [default: 0]
418+
--progress/--no-progress Show progress bar [default: progress]
419+
--history/--no-history Print history [default: no-history]
420+
--stats/--no-stats Generate statistics [default: stats]
421+
--rank-stats/--no-rank-stats Generate rank statistics [default: no-rank-stats]
422+
-c/--compact-stats, -C Show/hide distances [default: compact-stats]
423+
================================ =================================================================
424+
425+
**Plotting Options**
426+
427+
================================ =================================================================
428+
Option Description
429+
================================ =================================================================
430+
--plot/--no-plot Generate plot [default: plot]
431+
-2/--only2d, -0/--with-offers Only 2D plot vs with offers [default: with-offers]
432+
--plot-backend TEXT Backend used for plotting (see matplotlib backends)
433+
--plot-interactive Make the plot interactive [default: plot-interactive]
434+
--plot-show/--no-plot-show Show the plot [default: plot-show]
435+
--simple-offers-view Simple offers view [default: no-simple-offers-view]
436+
--annotations/--no-annotations Show annotations [default: no-annotations]
437+
--agreement/--no-agreement Show agreement [default: no-agreement]
438+
--pareto-dist/--no-pareto-dist Show Pareto distance [default: pareto-dist]
439+
--nash-dist/--no-nash-dist Show Nash distance [default: nash-dist]
440+
--kalai-dist/--no-kalai-dist Show Kalai distance [default: kalai-dist]
441+
--max-welfare-dist Show max welfare distance [default: max-welfare-dist]
442+
--max-rel-welfare-dist Show max relative welfare distance [default: no]
443+
--end-reason/--no-end-reason Show end reason [default: end-reason]
444+
--show-reserved/--no-show-reserved Show reserved value lines [default: show-reserved]
445+
--total-time/--no-total-time Show time limit [default: total-time]
446+
--relative-time/--no-relative-time Show relative time [default: relative-time]
447+
--show-n-steps/--no-show-n-steps Show n. steps [default: show-n-steps]
448+
--plot-path PATH Path to save the plot to [default: None]
449+
================================ =================================================================
450+
451+
**Saving to Disk**
452+
453+
================================ =================================================================
454+
Option Description
455+
================================ =================================================================
456+
--save-path PATH Path to save results to [default: Do not Save]
457+
--save-history/--no-save-history Save negotiation history [default: save-history]
458+
--save-stats/--no-save-stats Save statistics [default: save-stats]
459+
--save-type TEXT Scenario format: yml|xml [default: yml]
460+
--save-compact/--no-save-compact Compact file [default: save-compact]
461+
================================ =================================================================
462+
463+
**Advanced Options**
464+
465+
================================ =================================================================
466+
Option Description
467+
================================ =================================================================
468+
--fast/--no-fast Avoid slow operations [default: no-fast]
469+
--path PATH Extra paths to look for negotiator and mechanism classes
470+
--raise-exceptions Raise exceptions on failure [default: no-raise-exceptions]
471+
================================ =================================================================
472+
473+
Examples
474+
~~~~~~~~
475+
476+
Run a negotiation with 3 issues and 100 steps:
477+
478+
.. code-block:: console
479+
480+
$ negotiate -i 3 -s 100
481+
482+
Run with specific negotiators:
483+
484+
.. code-block:: console
485+
486+
$ negotiate -n AspirationNegotiator -n TitForTatNegotiator
487+
488+
Run without plotting:
489+
490+
.. code-block:: console
491+
492+
$ negotiate --no-plot
493+
494+
Save results to a specific path:
495+
496+
.. code-block:: console
497+
498+
$ negotiate --save-path ./results
499+
500+
Run with a time limit of 60 seconds:
501+
502+
.. code-block:: console
503+
504+
$ negotiate -t 60

0 commit comments

Comments
 (0)