MATLAB: Not enough input arguments. when using “gamultiobj”

gamultiobj

I am using the below code for multi objective optimization.
D = [4, 3, 6, 8, 12, 4, 19, 13, 6, 8];
F = [20, 12, 40, 26, 10, 32, 19, 47, 11, 15];
T = 120;
H = round(rand(10,10));
nvars = 10;
A = -F;
b = -T;
Aeq = [];
Beq = [];
lb = zeros(10,1);
ub = ones(10,1);
x = gamultiobj(fitnessfcn,nvars,A,b,Aeq,Beq,lb,ub,mycon);
function xsum= constraint2(var,H)
xsum=0;
for i=1:length(H)
for j=i+1:length(H)
xsum=xsum+H(i,j)*var(i)*var(j);
end
end
end
function [c,ceq] = mycon(x,H)
c = [];
ceq = constraint2(x,H);
end
I am getting the below error. Can any one please indicate the problem?
Not enough input arguments.
Error in test1>mycon (line 36)
ceq = constraint2(x,H);
Error in test1 (line 23)
x = gamultiobj(fitnessfcn,nvars,A,b,Aeq,Beq,lb,ub,mycon);

Best Answer

x = gamultiobj(fitnessfcn, nvars, A, b, Aeq, Beq, lb, ub, @(x) mycon(x, H));