When I compare the solutions between "fmincon" and GA solver, I get 2 different results. It is also clear that "fmincon" gives better solution:
n = 22;AssetMean = [...00.004400.051000.03970.02950000.03970.02950.03970.05100000000.02000];LowerBound = zeros(n,1);UpperBound = [...0.75000.750000.150000.15000.15000000.15000.15000.15000.15000000.75000000];%%fmincon
of = @(x) -(AssetMean'*x);[x, y] = fmincon(of, (1/n)*ones(n,1), [], [], ones(n,1)', 1, LowerBound, UpperBound)%%GA
of = @(x) -(x*m.AssetMean);[x1, y1] = ga(of, n, [], [], ones(n,1)', 1, LowerBound, UpperBound);x1 = x1'y1
Best Answer
"fmincon" uses second derivative information to find a solution.
On the other hand, for GA, the algorithm is converging but slowly because it is not using any derivative information.
For a linear programming problem, it is recommended to use the "linprog" function.