Coder Social home page Coder Social logo

pictureelement / approximate-cvt Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 359 KB

Calculation of the generator points for the approximate centroidal Voronoi tessellation in C++.

License: MIT License

C++ 67.11% HTML 32.89%
c-plus-plus voronoi-tessellation voronoi-diagram voronoi-algorithm approximation

approximate-cvt's Introduction

Status

COMPLETED

Description

The PSO performance is greatly affected by the starting positions of the particles. A common starting configuration is to randomly initialize each particle's position with a uniformly distributed random value. However, this configuration does not guarantee that the particles are evenly distributed throughout the search-space and is often the cause of variable performance.

A more suitable starting configuration is based on centroidal Voronoi tessellations(CVT), and ensures that the particle's initial positions are more evenly distributed throughout the search-space.

voronoi voronoi

The Voronoi diagram, shows a 10 point centroidal Voronoi tessellation. The circles represent both the generating points of the Voronoi tesselation and the centroids of the Voronoi cells. Note that the generator points of the centroidal Voronoi tessellation are evenly distributed on the plain.

Ofcourse, the computation of CVT is computationally expensive, but fortunately for the problem of swarm initialization we don't need much accuracy - a reasonable approximation will do.

Algorithm

The algorithm computes the generator points for the CVT and was developed by Ju, Du, and Gunzburger.

pseudocode pseudocode

Execution

2 Dimensions:

terminal2D terminal2D

graph2D graph2D

3 Dimensions:

terminal3D terminal3D

graph3D graph3D

More info

Compilation:

g++ main.cpp cvt.cpp -std=c++11

2D scatter plot:

gnuplot> plot "points.txt" with points pointtype 7

3D scatter plot:

gnuplot> splot "points.txt" with points pointtype 7

Notes:

The number of sampling points(q) should scale with the number of generators.

For q=1, a1=b2=1, and a2=b1=0 this method reduces to MacQueen's probabilistic method.

Reference:

Lili Ju, Qiang Du, and Max Gunzburger. 2002. Probabilistic methods for centroidal Voronoi tessellations and their parallel implementations. Parallel Comput. 28, 10 (October 2002), 1477-1500. DOI=http://dx.doi.org/10.1016/S0167-8191(02)00151-5

approximate-cvt's People

Contributors

pictureelement avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.