pydcop solve

pydcop solve solves a static DCOP by running locally a set of agents.

Synopsis

pydcop solve --algo <algo> [--algo_params <params>]
             [--distribution <distribution>]
             [--mode <mode>]
             [--collect_on <collect_mode>]
             [--period <p>]
             [--run_metrics <file>]
             [--end_metrics <file>]
             [--delay <delay>]
             [--uiport <port>]
             <dcop_files>

Description

The solve command is a shorthand for the agent and orchestrator commands. It solves a DCOP on the local machine, automatically creating all the agents as specified in the dcop definitions and the orchestrator (required for bootstrapping and collecting metrics and results).

When using solve all agents run on the same machine. Depending on the --mode parameter, agents will be created as threads (lightweight) or as process (heavier, but better parallelism on a multi-core cpu). Using --mode thread (the default) agents communicate in memory (without network), which scales easily to more than 100 agents.

Notes

Depending on the DCOP algorithm, the solve process may or may not stop automatically. For example, DPOP has a clear termination condition and the command will return once this condition is reached. On the other hand, some other algorithm like MaxSum have no clear termination condition.

Some algorithm have an optional termination condition, which can be passed as an argument to the algorithm. With MGM for example, you can use --algo_params stop_cycle:<cycle_count>

pydcop solve --algo mgm --algo_params stop_cycle:20 \
             --collect_on cycle_change --run_metric ./metrics.csv \
             graph_coloring_50.yaml

For algorithms with no termination condition, you should use the global --timeout option. Note that the --timeout is used as a timeout for the solve process only. Bootstrapping the system and gathering metrics take additional time, which is not accounted for in the timeout. This means that the solve command may take more time to return than the time set with the global --timeout option.

You can always stop the process manually with CTRL+C. Here again, the system may take a few seconds to stop.

Output

This commands outputs the end results of the solve process. A detailed description of this output is described in the Analysing results tutorial.

Options

--algo <dcop_algorithm> / -a <dcop_algorithm>

Name of the dcop algorithm, e.g. ‘maxsum’, ‘dpop’, ‘dsa’, etc.

--algo_params <params> / -p <params>

Optional parameter for the DCOP algorithm, given as string name:value. This option may be used multiple times to set several parameters. Available parameters depend on the algorithm, check algorithms documentation.

--distribution <distribution> / -d <distribution>

Either a distribution algorithm (oneagent, adhoc, ilp_fgdp, etc.) or the path to a yaml file containing the distribution. (see yaml format.) If not given, oneagent is used.

--mode <mode> / -m

Indicated if agents must be run as threads (default) or processes. either thread or process

--collect_on <collect_mode> / -c

Metric collection mode, one of value_change, cycle_change, period. See Analysing results for details.

--period <p>

When using --collect_on period, the period in second for metrics collection. See Analysing results for details.

--run_metrics <file>

Path to a file or file name. Run-time metrics will be written to that file (csv format). If the value is a path, the directory will be created if it does not exist. Otherwise the file will be created in the current directory.

--end_metrics <file>

Path to a file or file name. Result’s metrics will be appended to that file (csv format). If the value is a path, the directory will be created if it does not exist. Otherwise the file will be created in the current directory.

--delay <delay>

An optional delay between message delivery, in second. This delay only applies to algorithm’s messages and is useful when you want to observe (for example with the GUI) the behavior of the algorithm at runtime.

--uiport

The port on which the ui-server will be listening. This port is used for the orchestrator and incremented for each following agent. If not given, no ui-server will be started for any agent.

<dcop_files>

One or several paths to the files containing the dcop. If several paths are given, their content is concatenated as used a the yaml definition for the DCOP.

Examples

The simplest form is to simply specify an algorithm and a dcop yaml file. Beware that, depending on the algorithm, this command may never return and need to be stopped with CTRL+C:

pydcop solve --algo maxsum  graph_coloring1.yaml
pydcop -t 5 solve --algo maxsum  graph_coloring1.yaml

Solving with MGM, with two algorithm parameter and a log configuration file:

pydcop --log log.conf solve --algo mgm --algo_params stop_cycle:20 \
                            --algo_params break_mode:random  \
                            graph_coloring.yaml \