我的目标函数为
function val = fitness( X )
val = 10*X(7)+20*X(8)+50*X(9)+10*X(10)+20*X(11)+50*X(12);
end
我想把 ga 称为
ga(@fitness,12,A,b,[],[],lb,[],[],IntCon)
A = 9X9 matrix
b = 9X1 matrix
lb = 9X1 Zero matrix
IntCon = [1:12]
我收到以下错误消息
Error using preProcessLinearConstr (line 48)
The number of columns in A must be the same as the length of X0.
Error in gacommon (line 100)
[Iterate.x,Aineq,bineq,Aeq,beq,lb,ub,msg,exitFlag] = ...
Error in ga (line 319)
[x,fval,exitFlag,output,population,scores,FitnessFcn,nvars,Aineq,bineq,Aeq,beq,lb,ub,
请提供一个使用 ga 函数解决混合整数问题的示例。