Powell's Algorithm not obeying Upper Bound (UB)
Show older comments
Hello,
I am running Powell's algorithm with Golden Section method, to find the minimum of a function. My function call statement is as follows:
Q=pi/180;
S=Q*-8.5;
L=Q*-10;
U=Q*-8;
[xo,Ot,nS]=powell('My_Func',S,0,1,L,U,[],[],300);
My_Func is a user defined function. I am getting xo = -0.0727 as output, which is greater than U. Please explain why Powell's algorithm is not obeying boundaries.
5 Comments
Jan
on 18 May 2022
@Debapriya Sengupta: Seriously? powell is no function of Matlab's toolboxes. There is no chance, that the readers cann guess, which code you run and if it contains bugs. We do not know the interface of this function also.
Please explain, which code you use.
Voss
on 18 May 2022
@Debapriya Sengupta: Is it this?: https://www.mathworks.com/matlabcentral/fileexchange/15072-unconstrained-optimization-using-powell
Please provide the definition of the function My_Func.
Debapriya Sengupta
on 18 May 2022
Jan
on 18 May 2022
@Debapriya Sengupta: How can we solve the problem without having your code and data? We cannot debug the function provided by Giovani Tonel 15 years ago - but you can. Use the debugger to step through the code line by line.
Debapriya Sengupta
on 19 May 2022
Answers (1)
Yes, this is the documented behavior:
% Lb, Ub: lower and upper bound vectors to plot (default = x0*(1+/-2))
Lb and Ub are used for the graphics only.
Summary: You are using a function provided 15 years ago with a limited quality. It does not do, what you need and this is mentioned in the lean documentation. Then you explain in the forum, that this function does not do, what you need, but do not mention initially, which function you actually mean.
"Please explain why Powell's algorithm is not obeying boundaries."
Because this implementation of Powell's algorithm is not designed to consider the boundries for finding the result.
Sorry, you made it as hard as possible to find this trivial answer. You even found this answer by your own already: "I could not find a check for L or U anywhere in the code."
8 Comments
Debapriya Sengupta
on 19 May 2022
John D'Errico
on 19 May 2022
Why would you expect code found on the file exchange, where anyone can post code, to be as robust asnd well written as code written by professionals in the field? Remember that anyone can post code to the FEX, including complete novices to programming. Trust that which you get for free to be sometimes worth what you paid for it. Admittedly, there are codes to be found on the FEX which were written by highly skilled coders who have written code as good as that which you will get from the MathWorks itself. But that is not the case for all such submissions.
Usually the comments can be good guides, but even there you can find false advertising. I could mention the case where someone used a fake account in the name of their own grandmother to post misleadingly admiring comments on their own useless code. So for any code you find, read the comments, but also look at the quality of the code you find. Good, well written code often has a look and feel that is very different from what would be posted by a novice. You will find clearly written help that explains the code and how to use it. You will find a well designed interface.
But in all cases, remember what you paid for free code.
Jan
on 19 May 2022
@Debapriya Sengupta: Your questions about Matlab are welcome in the forum. It is the purpose of the forum to solve such problems.
You have overestimated the quality of the contributions to the FileExchange. And even for built-in functions written by MathWorks, reading the documentation carefully is important.
If you see, that a code does not do, what you want, trust your observation.
When you ask a question in the forum, provide as much relevant information as possible.
Now let's come to your actual problem: Do you need an implementation of the Powell algorithm with golden sction search and considering limits? Or would another optimzation tool solve your need also?
Debapriya Sengupta
on 19 May 2022
Jan
on 20 May 2022
Is it an option to write such a tool by your own?
Debapriya Sengupta
on 20 May 2022
The time when Powell's method became popular was FORTRAN time in software development. I guess you will find FORTRAN code for your problem in the internet.
Here is a link:
Debapriya Sengupta
on 21 May 2022
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!