optimization - Matlab fmincon Not Yielding Global Maximum/Minimum -
i new matlab, apologies if question silly. using fmincon
function derive elements of matrix (x) maximize following objective function subject non-negativity constraint and:
where
in code used fmincon
used, objective function non-linear:
function optim = optim(m,n) a= ones(1,m*n); b = 100; z = zeros(m,n); in = inf(m,n); x = ones(m,n); [x, bestval] = fmincon(@myfun2,x,a,b,[],[],z,in,[]) function f = myfun2(x) alpha = 5; %kappa = 5; zeta = 5; beta = 0.90909; delta = 0.4; gamma = 0.4; pf = 1; pw = 1; i= 1:m f=0; sum(i)=0; j=1:n sum(i) = sum(i) +((beta^(i-1))*(-1)*(zeta)*(((alpha*pf.*((x(i,j)).^delta))- (pw.*x(i,j)))^gamma)); end f = f+sum(i) end end end
when code run 5x5 matrix (optim(5,5)), resulting solution x =
1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 1.5439 3.1748 3.1748 3.1748 3.1748 3.1748 bestval = -31.8780
but not global minimum - marginal conditions specify @ global minimum have (for 1st row):
and on each row. have each column:
for first column , on. none of these conditions satisfied resulting matrix. have looked @ the related questions in stack overflow , documentation , have no inkling of how better results. there problem code? can code tweaked better results?
can make marginal conditions stopping conditions , how go doing that. or can use jacobian in way? appreciated. thank you.
no optimization technique guaranteed return global minimum. algorithms guaranteed find local minimum if hessian positive definite, there no mathematical way determine function values , nth derivatives if local minimum global minimum.
now termination conditions. can pass in options structure fmincon, has parameters control operation of fmincon. can choose different algorithm best suit problem. read docs options structure, , see if there fits trying do.
Comments
Post a Comment