Orange-OpenSource / pyDcop

Library for research on Distributed Constraints Optimization Problems
https://pydcop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
36 stars 24 forks source link

Not enough agents for one agent for each computation when run maxim #8

Closed luptior closed 5 years ago

luptior commented 5 years ago

pydcop solve --algo maxsum simulation/graph_coloring.yaml

Traceback (most recent call last): File "/anaconda3/bin/dcop_cli.py", line 196, in main() File "/anaconda3/bin/dcop_cli.py", line 124, in main args.func(args) File "/anaconda3/lib/python3.7/site-packages/pydcop/commands/solve.py", line 488, in run_cmd communication_load=algo_module.communication_load, File "/anaconda3/lib/python3.7/site-packages/pydcop/distribution/oneagent.py", line 129, in distribute .format(len(agents),len(computation_graph.nodes))) pydcop.distribution.objects.ImpossibleDistributionException: Not enough agents for one agent for each computation : 5 < 8

PierreRustOrange commented 5 years ago

Hi, could you give the content of your graph_coloring file ?

When you don't ask for a specific distribution method, pyDcop attempts to put a single computation on each agent (which is the most common hypothesis in the literature). Here it seems there is not enough agents in your system to host all the computations. Beware, when using maxsum you have one computation for each variable and one each constraint!

luptior commented 5 years ago

I was trying to use the graph_coloring file in the tutorial to test it out. https://pydcop.readthedocs.io/en/latest/tutorials/getting_started.html

I also tried directly adding more agents to the file, i.e. change last line in the mentioned file to be agents: [a1, a2, a3, a4, a5, a6, a7, a8, a9]. then it seems take forever to run, is it normal for maxsum?

PierreRustOrange commented 5 years ago

Using this file from the tutorial, the distribution is indeed impossible with 5 agents : the problem has 3 variables and 5 constraints and hence 8 computations : you need at least 8 agents (or use another distribution method).

MaxSum has no clear termination condition (it might not converge, and even convergence is not obvious to define) sio yes, it will run forever. For such algorithm I would recommend using --timeout argument:

pydcop --timeout 10 solve --algo maxsum simulation/graph_coloring.yaml

For other algorithms, like DSA or MGM, you might want to stop after a prdefined number of cycle --algo_params stop_cycle:20.

Let me know if you have any question.

luptior commented 5 years ago

Get it. Thank you!