optimization toolbox with fmincon
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i have a function
f= @(x,y,z) -5-2.*x+4.*x.^3+4.*(1-x.^2).*y+8.*(1-x.^2).*x.*y-12.*(1-x.^2).*x.*y.^2+12.*(1-x.^2).*(1-(abs(y).^2)).*z
with only constraint boundary
lb = [-1 -1 -1]
ub = [1 1 1]
i used fmincon to obtain the minimum f.
[bestxyz, fval] = fmincon(f,xyz0, A, b, Aeq, beq, lb, ub, nonlcon)
The optimization fmincon result in mininum f with the value of x,y,z in real number, but the function f has value of y in complex number through analytical solution. Is it the toolbox is limited to the real root or it can be modified to have the solution with imaginary root?
1 Kommentar
John D'Errico
am 30 Jun. 2022
Bearbeitet: John D'Errico
am 30 Jun. 2022
A search for a minimum is equivalent to a search for the roots of the derivatives of that function. So you can think of this as three nonlinear equations in three unknowns. And that is then equivalent to a higher order polynomial in one variable. So there certainly would be complex roots of the gradient equations.
The problem is, fmincon will not generate a complex valued solution. There are tricks you can do, but there is one glaring problem. What is it?
You place lower and upper bounds on the unknowns. bound constraints make no sense here, IF you wanted to allow complex solutions, since you have placed no constraints on the imaginary part.
Antworten (1)
Torsten
am 30 Jun. 2022
If you want to admit x,y and z to be complex-valued, you also have to change your objective function to be real-valued for complex inputs of the variables (e.g. abs(f) or f*f' or real(f) or imag(f)). What's your choice ?
Here is one example:
f = @(x1,x2,y1,y2,z1,z2) -5-2.*(x1+1i*x2)+4.*(x1+1i*x2).^3+4.*(1-(x1+1i*x2).^2).*(y1+1i*y2)+8.*(1-(x1+1i*x2).^2).*(x1+1i*x2).*(y1+1i*y2)-12.*(1-(x1+1i*x2).^2).*(x1+1i*x2).*(y1+1i*y2).^2+12.*(1-(x1+1i*x2).^2).*(1-(abs((y1+1i*y2)).^2)).*(z1+1i*z2);
g = @(x1,x2,y1,y2,z1,z2) f(x1,x2,y1,y2,z1,z2)*f(x1,x2,y1,y2,z1,z2)';
lb = [-1 -1 -1 -1 -1 -1];
ub = [1 1 1 1 1 1];
xyz0 = zeros(6,1);
[bestxyz, fval] = fmincon(@(x)g(x(1),x(2),x(3),x(4),x(5),x(6)),xyz0, [],[],[],[], lb, ub)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Direct Search finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!