How to write this small optimisation problem?

조회 수: 4 (최근 30일)
Vishesh Vatsal
Vishesh Vatsal 2013년 6월 20일
The rough sketch of the problem is:
find the maximum value of F(x,y,z)
s.t. Amin<=x<=Amax Bmin<=y<=Bmax Cmin<=z<=Cmax x,y,z belong to Real set
my approach was: I fixed z=z0. x, y are column vectors with different step sizes going from their minimum to maximum value. F is the matrix of all the different values of x,y. max(F(:)) gives me the max value. Good for two variables.
But when I have three varying variables x,y,z, I am confused how to approach it. I need to find the maximum value Fmax as well as the values of x,y,z, when F=Fmax. Trying this for a day. I do not know optimisation. Any help how to begin writing this code?

채택된 답변

Alan Weiss
Alan Weiss 2013년 6월 20일
편집: Alan Weiss 2013년 6월 20일
If you have Optimization Toolbox, use fmincon on -F(x,y,z) = -F(t), where t = [x,y,z]. If you just want to make a grid of points and look at the maximum on the grid:
xgrid = linspace(Amin,Amax); % gives 100 values, change if you like
ygrid = linspace(Bmin,Bmax);
zgrid = linspace(Cmin,Cmax);
% biggrid = ndgrid(xgrid,ygrid,zgrid); % for a vectorized F
% Fvals = F(biggrid); % this works is F is vectorized. Otherwise:
Fvals = zeros(100,100,100);
for x = 1:100
for y = 1:100
for z = 1:100
Fvals(x,y,z) = F(xgrid(x),ygrid(y),zgrid(z));
end
end
end
Alan Weiss
MATLAB mathematical toolbox documentation

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by