MATLAB: How to convert old syntax search methods to new syntax for the Genetic Algorithm and Direct Search Toolbox

gaGlobal Optimization Toolboxpatternsearchtemplate

I have a search function written before version 2.0.2 of Genetic Algorithm and Direct Search Toolbox. The old syntax I have currently follows the form:
function [successSearch,nextIterate,optimState] =
searchfcntemplate(fun,iterate,tol,A,L,U, ...
funeval,maxfun,searchoptions,objfcnarg, ...
iterlimit,factors)
How can I convert this syntax so that it will work in later versions?

Best Answer

In Genetic Algorithm and Direct Search Toolbox version 2.0.2, a new syntax for search method is introduced. The new syntax is more efficient both with speed and memory, and has the following form:
function [successSearch,xBest,fBest,funccount] =
searchfcntemplate(fun,x,A,b,Aeq,beq,lb,ub, ...
optimValues,options)
If you have a search function written for use in a previous release, the function performs correctly in Version 2.0.2 but returns a warning. Custom search functions written in a previous version need to be updated with the new syntax. In later versions, this syntax may cause a warning or error.
A utility function is provided to convert your search functions from previous releases to the new syntax of Version 2.0.2. Download the attached MATLAB file named "searchConversion".
Related Question