Not enough input arguments. when using "gamultiobj"

1 次查看(过去 30 天)
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);

采纳的回答

Walter Roberson
Walter Roberson 2018-3-3
x = gamultiobj(fitnessfcn, nvars, A, b, Aeq, Beq, lb, ub, @(x) mycon(x, H));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by