constraints in a fitness function in MATLAB

I need to optimize weights in this fitness function:


(where a,b,c,d are numeral constants and x is the vector of 4 weights)

and i need to define these simple constraints in my function:

each weight (x(i)) must be between 0 and 1;


sum (x(i))=1; (i=1:4)

could anybody help me please?


Assuming you have the Optimization Toolbox,

x= linprog([a,b,c,d],[],[],[1 1 1 1],1,[0 0 0 0],[1,1,1,1]);

if you minimize you fitness function, then check whether x is feasible (inside you search space) and whether it satisfies your constraint, if not then return +infinity (any big number) or infinity + some penalty, where the penalty is smaller for smaller violations of you constraints

Need Your Help

Using OData with POCO

.net wcf web-services odata

Is it possible to use OData with POCO or is it limited to just LinqToEntities?

Is it possible to have a one line each block in Ruby?


Is there a one-line method of writing this each block in Ruby?