MATLAB: Error,, too many input arguments!!

genetic algorithmgenetic programming

function [x,fval] = yasmin
%% Fitness function (objective function) and number of variables
fitnessFcn = @(x) ga_test(x);
numberOfVariables = 1310;
A=[]; %% (2596×1310)
b=[]; %% (1310×1)
Aeq=[]; %% (20×220)
beq=[]; %% (220×1)
%% Decision variables are bounded (either zero or one)
LB = zeros(1,1310);
UB = ones(1,1310);
Bound = [LB;UB];
% Create an options structure to be passed to GA % Three options namely 'CreationFcn', 'MutationFcn', and % 'PopInitRange' are required part of the problem. %% Population size to be at least the value of Number of variables, so that %% the individuals in each population span the space being searched.
options = gaoptimset('CreationFcn',@int_pop,'MutationFcn',@int_mutation, … 'PopInitRange',Bound,'Display','iter','StallGenL',100,'Generations',150, … 'PopulationSize',1310,'PlotFcns',{@gaplotbestf,@gaplotbestindiv});
[x,fval] = ga(fitnessFcn,numberOfVariables,A,b,Aeq,beq,LB,UB,[],options);
x
%%************************************************************************* %%*************************************************************************
% Mutation function to generate childrens satisfying the range and integer % constraints on decision variables.
function mutationChildren = int_mutation(parents,options,GenomeLength, … FitnessFcn,state,thisScore,thisPopulation)
shrink = .01;
scale = 1;
scale = scale – shrink * scale * state.Generation/options.Generations;
range = options.PopInitRange;
lower = range(1,:);
upper = range(2,:);
scale = scale * (upper – lower);
mutationPop = length(parents);
% The use of ROUND function will make sure that childrens are integers.
mutationChildren = repmat(lower,mutationPop,1) + … round(repmat(scale,mutationPop,1) .* rand(mutationPop,GenomeLength));
% End of mutation function
%%************************************************************************* %%*************************************************************************
function Population = int_pop(GenomeLength,FitnessFcn,options)
totalpopulation = sum(options.PopulationSize);
range = options.PopInitRange;
lower= range(1,:);
span = range(2,:) – lower;
% The use of ROUND function will make sure that individuals are integers.
Population = repmat(lower,totalpopulation,1) + … round(repmat(span,totalpopulation,1) .* rand(totalpopulation,GenomeLength));
% End of creation function
When I run my m-file from the command line I write: x=ga(@ga_test,1310,A,b,Aeq,beq,LB,UB,[],options) OR [x,fval]=ga(@ga_test,1310,A,b,Aeq,beq,LB,UB,[],options)
and I get error using ga,, Too many input arguments
So I also tried : x=ga(yasmin) but I keep getting the same error.
Any help in this regard will be highly appreciated
Thanx in advance.

Best Answer

Which version are you using?
Please check
which -all ga
If you see anything other than an entry under the gads toolbox, you might have a conflicting function.