kthohr / optim

OptimLib: a lightweight C++ library of numerical optimization methods for nonlinear functions

Home Page:https://optimlib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boundaries do not work

poggo96 opened this issue · comments

I have a number of initial parameters. For each one I have specified an upper and lower boundary.When the algorithm is complete some results are outside the boundaries.

` optim::algo_settings_t settings;

arma::vec lb = {-1,-1, -2,-2,-2,  -2,-2,-2};
arma::vec ub = {1,1,    2,2,2,     2,2,2, };
settings.pso_initial_lb = lb;
settings.pso_initial_ub = ub;
settings.pso_n_gen = 1000;

bool success = optim::pso(x, optimF,&optim_data,settings);`

Same when i use "de"

initial_lb and initial_ub define the lower and upper bounds, respectively, when sampling initial values -- they are not used to define box constraints on the inputs.