thegamecat / gekko-trading-stuff

A dumping ground for my files I use with this awesome crypto currency trading platform https://github.com/askmike/gekko
GNU General Public License v3.0
109 stars 27 forks source link

Gene selection and mutation problem #1

Closed osarrouy closed 7 years ago

osarrouy commented 7 years ago

Hi,

I've been trying for your algorithm and it seems there's a bug in this portion of the code :

while (new_population.length < population_amt * (1 - variation)) {
        var a, b;
        var selected_prob = randomExt.float(1, 0);
        for (var k = 0; k < population_amt; k++) {
            selected_prob -= selection_prob[k];
            if (selected_prob <= 0) {
                a = population[k];
                break;
            }
        }
        selected_prob = randomExt.float(1, 0);
        for (k = 0; k < population_amt; k++) {
            selected_prob -= selection_prob[k];
            if (selected_prob <= 0) {
                b = population[k];
                break;
            }
        }
}

It seems that a and b are let undefined (the selected+prob <= 0 condition is unverified) so that you try to mutate an undefined gene.

I'm not sure to fully understand that part of the code. What's the point of this ? Do you see an issue ?

Thanks for sharing your code whatsoever. That's super cool :)

Cheers.

osarrouy commented 7 years ago

Hi again,

Nevermind. This was a communication problem due to the Gekko API which returned no report.

You can close this issue. Sorry for speaking too fast !

thegamecat commented 7 years ago

Can you let me know how you get on, how you use it etc?