Closed jschueller closed 2 years ago
@darioizzo would you like to take a look at this?
@Sceki as well, since IIRC he is the original author.
I believe that if the memory
parameter is set to false
, then your n_gen_mark
parameter should always be smaller than the gen
size and different than zero. This should throw an exception on C++ (it does on python, see below). I will investigate.
import pygmo as pg
prob = pg.problem(pg.rosenbrock(2))
pop = pg.population(prob,size = 1,seed = 23)
uda = pg.gaco(gen = 3, ker = 1, q = 1.0, oracle = 1e9, acc = 0.01, threshold = 0, n_gen_mark = 7, impstop = 1000, evalstop = 1000, focus = 0.0, memory = False, seed = 23)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/f3/zsqnptzj5wb532m1qfccgbz80000gn/T/ipykernel_6499/554914302.py in <module>
2
3 pop = pg.population(prob,size = 1,seed = 23)
----> 4 uda = pg.gaco(gen = 3, ker = 1, q = 1.0, oracle = 1e9, acc = 0.01, threshold = 0, n_gen_mark = 7, impstop = 1000, evalstop = 1000, focus = 0.0, memory = False, seed = 23)
5
ValueError:
function: gaco
where: /Users/runner/miniforge3/conda-bld/pagmo_1627978948198/work/src/algorithms/gaco.cpp, 78
what: If memory is inactive, the threshold parameter must be either in [1,m_gen] while a value of 0 was detected
I believe that if the
memory
parameter is set tofalse
, then yourn_gen_mark
parameter should always be smaller than thegen
size. This should throw an exception on C++ (it does on python, see below). I will investigate.import pygmo as pg prob = pg.problem(pg.rosenbrock(2)) pop = pg.population(prob,size = 1,seed = 23) uda = pg.gaco(gen = 3, ker = 1, q = 1.0, oracle = 1e9, acc = 0.01, threshold = 0, n_gen_mark = 7, impstop = 1000, evalstop = 1000, focus = 0.0, memory = False, seed = 23) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /var/folders/f3/zsqnptzj5wb532m1qfccgbz80000gn/T/ipykernel_6499/554914302.py in <module> 2 3 pop = pg.population(prob,size = 1,seed = 23) ----> 4 uda = pg.gaco(gen = 3, ker = 1, q = 1.0, oracle = 1e9, acc = 0.01, threshold = 0, n_gen_mark = 7, impstop = 1000, evalstop = 1000, focus = 0.0, memory = False, seed = 23) 5 ValueError: function: gaco where: /Users/runner/miniforge3/conda-bld/pagmo_1627978948198/work/src/algorithms/gaco.cpp, 78 what: If memory is inactive, the threshold parameter must be either in [1,m_gen] while a value of 0 was detected
Thanks!
So, I have tried on C++ as well and I get the correct exception:
function: gaco
where: /Users/runner/miniforge3/conda-bld/pagmo_1627978948198/work/src/algorithms/gaco.cpp, 78
what: If memory is inactive, the threshold parameter must be either in [1,m_gen] while a value of 0 was detected
@jschueller I hence cannot reproduce your error
indeed its not a crash, sorry
Turns out the crash happened with other values to default:
#include <pagmo/algorithms/gaco.hpp>
#include <pagmo/population.hpp>
#include <pagmo/problems/rosenbrock.hpp>
using namespace pagmo;
int main()
{
try {
problem prob{rosenbrock{2u}};
population pop1{prob, 8u, 23u};
gaco user_algo1{10u, 1u};
pop1 = user_algo1.evolve(pop1);
}
catch(const std::exception & exc) {
std::cout << "ex="<<exc.what() <<std::endl;
return 2;
}
return 0;
}
@jschueller You did not paste the log of your error: but I guess it is related to the ker
value: it should be between 2 (included) and the population size (in your case 8). I believe this is indeed a bug as it is not checked and thrown immediately. I will make a PR, thanks for spotting this!
the following sample makes gaco crash:
under gdb:
to reproduce