Undefined function 'ga' for input arguments of type 'function_handle'.

1 view (last 30 days)
Hi,
I have 2014a version of matlab on my mac. I am trying to solve a MILP using ga. The global optimization toolbox is installed on my system, and I also have the license for it. But when I try to run the ga, I get the following error:
Undefined function 'ga' for input arguments of type 'function_handle'.
A snippet from my code:
fn = @(x) f'*x;
[x,fval,exitflag]=ga(fn,2*n^2,A,b,Aeq,beq,lb,ub,[],intcon);
I don't know how to debug it, since documentations says that I need to supply a function handle here.

Answers (1)

Alan Weiss
Alan Weiss on 20 Nov 2014
Edited: Alan Weiss on 20 Nov 2014
Try entering
which -all ga
Perhaps there is another ga file that is getting precedence.
Even better, use intlinprog rather than ga for much better performance and reliability.
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!