fminsearchbnd optimization function in matlab

i used fminsearchbnd for boundary problem but the matlab it tell me that Undefined function 'fminsearchbnd' can any one help me with is problem i used this example
fun = @(x)(x(1)-5)^2+(x(2)+6)^2+x(3); % x0 = [0 0 0]; Lb=[0 -1 2]; Ub=[1 2 3]; [x,fval,exitflag,output] = fminsearchbnd(fun,Lb,Ub); disp(fval)
thank you

 채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 2일

0 개 추천

fminsearchbnd is not part of MATLAB. You can get it one of the versions from the File Exchange

댓글 수: 3

thank you very much for answering me yes i used file exchange from http://www.mathworks.com/matlabcentral/fileexchange/17804-fminsearchbnd-new
even though i put this in the toolbox of matlab , i doesn't work
Do not put it in the MATLAB toolbox. Download the .zip file, and unzip it into a directory that has nothing else in it (and which is not under the MATLAB installation.) Then use pathtool to add the directory to the MATLAB path. After that MATLAB will be able to find the file.
Thank you very much

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

MASTER WHOS
MASTER WHOS 2019년 2월 7일

0 개 추천

I DID THIS:
Do not put it in the MATLAB toolbox. Download the .zip file, and unzip it into a directory that has nothing else in it (and which is not under the MATLAB installation.) Then use pathtool to add the directory to the MATLAB path. After that MATLAB will be able to find the file.
but it gives error: Error in fminsearchbnd (line 264)
[xu,fval,exitflag,output] = fminsearch(intrafun,x0u,options,varargin);
what might be the problem?

댓글 수: 11

Torsten
Torsten 2019년 2월 7일
편집: Torsten 2019년 2월 7일
Please show your call to "fminsearchbnd" together with the setting of all input variables/function handles.
Please show the COMPLETE error. That is, all the red text.
and a full copy of the error message . you would not get that error report unless the function was found.
thanks for the a response @Torsten@ John D'Errico@Walter Roberson
Attached image is the error;
And the refered equation 37 is below:
37: theta_noNull = fminsearchbnd(SQP_complex2 , [x0 , 1, x00],[x1 , 1, x3], [x2 , 1, x4]);
What is SQP_complex2 ? What are the values of x0, x00, x1, x3, x2, x4 ?
x0 = zeros (1 ,45); % initial value for optimization
x00 = zeros (1 ,10);
x1 = -pi/1 * ones (1 ,45);
x2 = pi/1 * ones (1 ,45);
x3 = -pi/1 * ones (1 ,10);
x4 = pi/1 * ones (1 ,10);
Can't you include executable code here ?
Ok. Your very first problem is that you cannot realistically use fminserchbnd with any serious hope of success.
You have 56 unknowns to estimate. Although one of them seems to have a lower bound of 1 which is equal to its upper bound of 1. The latter is not a problem though. Fminserchbnd can handle that case. In fact, I recall that I specifally catered to that case, looking for variables that had lower and upper bounds that were identical. So really, you have 55 unknowns to estimate.
Regardelss, that is by far too many unknowns for fminsearchbnd to handle. Perhaps 10-12 unknowns is a far more reasonable limit to gain convergence from a tool like fminsearchbnd. Once you start to try to solve problems with many tens of parameters like this, tools like fminsearch and fminsearchbnd tend to get bogged down, becoming far too inefficient. fminsearchbnd would probably require literally billions of function evaluations to achieve even approximate convergence.
I would strongly recommend instead using fmincon from the optimization toolbox, if that is an option.
(And please stop adding answers just to add comments.)
Thanks for your utmost responsive support.
@Torsten attached are the codes , so that you can see how you can help.
NB: I do not have much experience YET with MATLAB as I almost started using it last year. So, if you can use SIMPLE (easy to understand guidance) then I will appreciate the most
I AM VERY GRATEFUL FOR YOUR HELP
I still don't see neither
@SQP_complex2
nor
@SQP_complex2_case2
I have my own private implementation of tricking fminsearch into being bounded (stops when it hits the boundary rather than reflecting as might be nice.)
I know from experience that 55 variables is completely intractable to use seriously with fminsearch . fminsearch gets caught in local minima , not as easily as fmincon gets caught but it happens all the time. It is not a global minimizer. To use it for more than light use you need to start it at multiple locations . In particular you need starting points near every valid combination of upper and lower bounds . With 55 variables that would be 2^55 configuration to examine. If you could process 2^30 per second (gigaflop range ) then that would take you 2^25 seconds . That would be a year . You probably cannot process more than 1/100 of that speed so probably 100 or so years . Just for figuring out crudely which end of each bound you probably near.

댓글을 달려면 로그인하십시오.

MASTER WHOS
MASTER WHOS 2019년 2월 8일

0 개 추천

Thanks for your comment.
sorry, so, is that the only problem? [missing @SQP_complex2, & @SQP_complex2_case2] (which bring the error I attached with fminsearchbnd)?

댓글 수: 2

Torsten
Torsten 2019년 2월 8일
편집: Torsten 2019년 2월 8일
I don't know, but if you don't supply a functional expression to be minimized, "fminsearchbnd" will of course complain.
There is @ missing before SQP_complex_case2 unless that is a function that returns aa function handle.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

질문:

2015년 12월 2일

답변:

2019년 2월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by