# CBXPy: Consensus Based Particle Dynamics in Python#

CBXPy is a python package implementing consensus based particle schemes. Originally designed for optimization problems

the scheme was introduced as CBO (Consensus Based Optimization) in [1]. Given an ensemble of points \(x = (x_1, \ldots, x_N)\), the update reads

where \(\xi_i\) are i.i.d. standard normal random variables. The core element is the consensus point

with a parameter \(\alpha>0\). The scheme can be extended to sampling problems known as CBS, clustering problems and opinion dynamics, which motivates the acronym
**CBX**, indicating the flexibility of the scheme.

## Installation#

The package can be installed via `pip`

```
pip install cbx
```

## Simple Usage Example#

The following example shows how to minimize a function using CBXPy

```
from cbx.dynamics import CBO
f = lambda x: x[0]**2 + x[1]**2
dyn = CBO(f, d=2)
x = dyn.optimize()
```

## More Examples#

## Documentation#

The functionality of the package is documented in the user guide. For a specifics about the implementation, we refer to the API.