acerbilab / bads

Bayesian Adaptive Direct Search (BADS) optimization algorithm for model fitting in MATLAB
GNU General Public License v3.0
246 stars 38 forks source link

Error when setting bounds equal to X0 #1

Closed gkaguirre closed 7 years ago

gkaguirre commented 7 years ago

I am encountering the following error when running bads_examples.m:

Function 'subsindex' is not defined for values of class 'struct'.

Error in bads>@(x,optimState,state)outputfun(expandvars(x,fixidx,fixedvars),optimState,state) (line 375) outputfun_fix = @(x,optimState,state) outputfun(expandvars(x,fixidx,fixedvars),optimState,state);

Error in bads (line 429) isFinished_flag = outputfun(origunits(u,optimState),optimState,'init');

Error in fixedbads (line 46) [x_free,fval,exitflag,output] = bads(fun_fix,x0,LB,UB,PLB,PUB,nonbcon_fix,options);

Error in bads (line 382) [x,fval,exitflag,output,optimState,gpstruct] = fixedbads(fun_fix,x0,LB,UB,PLB,PUB,nonbcon_fix,options,fixidx,nargout);

Error in bads_examples (line 249) [x,fval,exitflag,output] = bads(fun,x0,lb,ub,plb,pub,[],options,mu);

I obtain the same error when I call bads.m from my own routine and set a parameter of the upper/lower bounds to be equal to each other and to x0.

Running under Mac OS X 10.12.5, Matlab R2016b. The only code in the path (apart from various Matlab toolboxes) is BADS.

lacerbi commented 7 years ago

Thanks for the bug report. Yes, there was a problem due to an interaction between the output function (a functionality added in v1.0.2) and fixed variables. I rolled v1.0.3 which fixes that bug. Everything should be okay now.

gkaguirre commented 7 years ago

Yep. That fixed it. Thanks very much for making this resource available!