Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Add hexagonal topology to pso #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add hexagonal topology to pso #148

wants to merge 1 commit into from

Conversation

sriki18
Copy link

@sriki18 sriki18 commented Apr 16, 2015

This will add a hexagonal topology to pso. (I've fixed things that were wrong or missing in the previous PR)

@@ -177,6 +177,7 @@ void pso::evolve(population &pop) const
switch( m_neighb_type ){
case 1: initialize_topology__gbest( pop, best_neighb, best_fit, neighb ); break;
case 3: initialize_topology__von( neighb ); break;
case 5: initialize_topology__hexagonal(neighb);break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not the index order (1,3,4,5) ?
Two spaces after colon

@krzysztof
Copy link

I can't judge just by the code whether it's implemented correctly (do you have a reference implementation?). This needs some tests (ideally both C++ and Python) to verify that it works as reported in the literature. Do you have any data on it ?

Update Python docstring:
https://github.com/esa/pagmo/blob/master/PyGMO/algorithm/__init__.py#L264-L268

void pso::initialize_topology__hexagonal( std::vector< std::vector<int> > &neighb ) const
{
int swarm_size = neighb.size();
int cols, rows; // lattice structure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case there's no reason to align variable names in the column with multiple spaces, use a single space.

In this method you're using 8 spaces for indentation. We try to stick with tabs for C++ and 4 spaces for Python code.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling 607d523 on sriki18:master into 3d4c309 on esa:master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants