Skip to content
Multi-Agent Optimization in Python
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Multi-Agent Optimization in Python (maopy)

*Library of distributed convex optimization algorithms implemented in Python using MPI.


Welcome to maopy, the multi_agent_optimization module. The module contains several distributed optimization algorithms and distributed averaging (consensus) algorithms:

  • Subgradient Push (optimization)
  • Extra Push (optimization)
  • Push DIGing (optimization)
  • Push Sum Averaging (consensus)
  • Asynchronous Subgradient Push (optimization)


Examples (demos) of each algorithm are provided in the main method at the bottom of each respective class. To run any of the demos, depending on your MPI distribution, execute one of the following command line instructions from the directory containing the maopy module,

mpirun -np $(num_processes) python -m maopy.$(algorithm_name)


mpiexec -n $(num_processes) python -m maopy.$(algorithm_name)

For example, to run the push-sum consensus demo in the push_sum_gossip_averaging file over a 5-agent network (with architecture specified in the demo), one would type

mpiexec -n 5 python -m maopy.push_sum_gossip_averaging

Notice that we did not include the file suffix ('.py') in the command, since the path is already defined relative to the module.


To get started, install the message passing library mpi4py,

conda install -c anaconda mpi4py

Now just clone this repo and you're good to go!


You can’t perform that action at this time.