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

Sampling without replacement in jDE #113

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Sampling without replacement in jDE #113

wants to merge 4 commits into from

Conversation

neduard
Copy link

@neduard neduard commented Mar 8, 2015

Inspired from #95 (comment)
When taking population samples in jDE, if the population size (NP) is small enough, we apply a sampling without replacement algorithm, otherwise we revert to previous behaviour.

Testing was done by make tests and a custom test bench:
https://github.com/neduard/pagmo/blob/development/my_tutorials/myjdedev.cpp

This patch addresses issue #95

/* Endless loop for NP < 8 !!! */
r7 = p_idx();
} while ((r7==i) || (r7==r1) || (r7==r2) || (r7==r3) || (r7==r4) || (r7==r5) || (r7==r6));
if (NP < 21) {
Copy link
Author

Choose a reason for hiding this comment

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

Currently we include everything in the evolve() method. Would it be a good idea to separate the sampling algorithm (both for small and large NP) into a separate function?

@krzysztof
Copy link

@neduard Putting it into an external function is not necessary as it's so far the only place we use sampling wo replacement. Otherwise it would go in pagmo::util. Patch is fine as it is for now.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling 255ba78 on neduard:issue95_sampling_without_replacement_jde into 6ec99bc 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