constraints in a fitness function in MATLAB -
i need optimize weights in fitness function:
f(x)=x(1)*a+x(2)*b+x(3)*c+x(4)*d;
(where a,b,c,d numeral constants , x vector of 4 weights)
and need define these simple constraints in function:
each weight (x(i)) must between 0 , 1;
and
sum (x(i))=1; (i=1:4)
could me please?
assuming have optimization toolbox,
x= linprog([a,b,c,d],[],[],[1 1 1 1],1,[0 0 0 0],[1,1,1,1]);
Comments
Post a Comment