using GA including a hybrid function option
Show older comments
Hi everyone
I have a problem related to how to use options in GA .
I want to use a hybrid function like fmincon.
n1=1;
n2=5;
n3=7;
n4=466352414.326725;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A=[-1 -1 -1 -1;...
1 1 1 1;...
-1 0 0 0;...
0 -1 0 0;...
0 0 -1 0;...
0 0 0 -1];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b=[0,4.8e8,0,0,0,0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ub=[n1,n2,n3,n4];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fun=@(t) ((5*t(1)^2)-(10*(t(1))))+...
((0.4*(t(2))^2)-(4*(t(2))))+...
((0.408163265306122*(t(3))^2)-(5.71428571428571*(t(3))))+...
((1.3170965284189E-07*(t(4))^2)-(122.8462291859*(t(4))));
rng default
opt=optimoptions(@ga,'HybridFcn',fmincon),
w=ga(fun,4,A,b,[],[],[],[],ub);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w
sumni=n1+n2+n3+n4
sumresult=w(1)+w(2)+w(3)+w(4)
but the result is this:
Not enough input arguments.
Error in fmincon (line 218)
X, A, B, Aeq, Beq, LB, UB);
Error in plotttt (line 22)
opt=optimoptions(@ga,'HybridFcn',fmincon),
how should I write option to get a result?
Accepted Answer
More Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!