Skip to main content

Python package for Polarized Consensus Based Optimization

Project description

:snowflake: Polarized Consensus-Based Optimization and Sampling

PolarGIF

This code produces the examples for the paper "Polarized consensus-based dynamics for optimization and sampling": https://arxiv.org/abs/2211.05238

@online{bungert2022polarized,
    author = {Bungert, Leon and Roith, Tim and Wacker, Philipp},
    title = {Polarized consensus-based dynamics for optimization and sampling},
    year = {2022},
    eprint={2211.05238},
    archivePrefix={arXiv},
    primaryClass={math.OC}
}

💡 What is PolarCBO/CBS?

Polarized consensus-based dynamics allow to apply consensus-based optimization (CBO) and sampling (CBS) for objective functions with several global minima or distributions with many modes, respectively. Here we have

  • particles ${x^{(i)}}\in\mathbb{R}^d$ which explore the space,
  • the objective $V:\mathbb{R}^d\to\mathbb{R}$ which we want to optimize.

For optimizing $V$ the position of the particles are updated via the stochastic ODE

$$ \begin{align} \boxed{% d x^{(i)} = -(x^{(i)} - m(x^{(i)})) d t + \sigma |x^{(i)} - m(x^{(i)})| d W^{(i)} } \end{align} $$

where

  • $m(x^{(i)})$ is a weighted empirical mean associated with the point $x^{(i)}$,
  • $W^{(i)}$ are independent Brownian motions,
  • $\sigma$ scales the influence of the noise term.

For sampling from $\exp(-V)$ the position of the particles are updated via the stochastic ODE

$$ \begin{align} \boxed{% d x^{(i)} = -(x^{(i)} - m(x^{(i)})) d t + \sqrt{2\lambda^{-1}C(x^{(i)})} d W^{(i)} } \end{align} $$

where $C(x^{(i)})$ is a weighted empirical covariance matrix associated with the point $x^{(i)}$.

The choice of the functions $m(\dot)$ and $C(\cdot)$ are at the heart of our polarized methods. Given a similarity measure $\mathsf k(\cdot,\cdot)$ and an inverse temperature parameter $\beta>0$ we define

$$ \begin{align} m(x) &:= \frac{\sum_{i}\mathsf k(x,x^{(i)})x^{(i)}\exp(-\beta V(x^{(i)}))}{\sum_{i}\mathsf k(x,x^{(i)})\exp(-\beta V(x^{(i)}))}, \ C(x) &:= \frac{\sum_{i}\mathsf k(x,x^{(i)})(x^{(i)}-m(x))\otimes(x^{(i)}-m(x))\exp(-\beta V(x^{(i)}))}{\sum_{i}\mathsf k(x,x^{(i)})\exp(-\beta V(x^{(i)}))}. \end{align} $$

Note that these weighted mean and covariance give more influence to particles which are close to $x$ and have a small value of $V$. If $\mathsf k(\cdot,\cdot)=1$ one recovers standard CBO and CBS.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polarcbo-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

File details

Details for the file polarcbo-0.1.1.tar.gz.

File metadata

  • Download URL: polarcbo-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for polarcbo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4e10ba17977473b8f3feeeaa24fb9c8142fda21fb4e5b23a87929e660c78014
MD5 77fa48c811f62f322323cf890e0564d0
BLAKE2b-256 14bff32dc3a2944e1bdf50b8bfc9a00ab2e96b4e820ed146c1e78aa7748f391b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page