Set up a gradient descent algorithm for a multivariable economic dispatch problem
Hi,
I’m working on an electrical engineering optimization problem. I tried running the problem following an algorithm which was given to me in class, but I am getting some undefined results. I am attaching my code below:
clc; clear;
syms x y z
vX = [x y z].’; % set up x vector and transposition
Q = [1.562E-3 0 0; 0 1.94E-3 0; 0 0 4.82E-3]; b = [7.92 7.85 7.97]’; % calculate Q and b values according to quadratic problem formula, reproduced as f below
tau = 0.00001; % set up tolerance value
f = vX.’*Q*vX+b.’*vX+949;
Delf = [diff(f,x); diff(f,y); diff(f,z)];
t = (Delf.’*Delf)/(Delf.’*Q*Delf);
vx_old = [300 300 100]’; % set up initial vX value
grad = double(subs(Delf,vX,vx_old));
lenGrad = norm(grad);
Data = [vx_old;lenGrad];
while lenGrad > tau
t = subs(t,vX,vx_old);
vx_new = vx_old-t*grad;
grad = double(subs(Delf,vX,vx_new));
lenGrad = norm(grad);
Data = [Data [vx_new;lenGrad]];
vx_old = vx_new;
end
vx_new = double(vx_new)
fval = double(subs(f,vX,vx_new));
disp([‘Minimum value of the function is: ‘,num2str(fval)]);
disp([‘argmin of x value is: ‘,num2str(vx_new(1))]);
disp([‘argmin of y value is: ‘,num2str(vx_new(2))]);
disp([‘argmin of z value is: ‘,num2str(vx_new(3))]);
For reference, the objective function, which I am trying to minimize, is:
0.001562P1^2 + 0.00194P2^2 + 0.00482P3^2 + 7.92P1 + 7.85P2 + 7.97P3 + 949,
where each P represents the power output of 3 generating thermal units. I understand other methods are better suited to this problem, but I am required to try out unconstrained optimization on this problem. Would you help me determine if my code is wrong at some point or what I can do to improve it?Hi,
I’m working on an electrical engineering optimization problem. I tried running the problem following an algorithm which was given to me in class, but I am getting some undefined results. I am attaching my code below:
clc; clear;
syms x y z
vX = [x y z].’; % set up x vector and transposition
Q = [1.562E-3 0 0; 0 1.94E-3 0; 0 0 4.82E-3]; b = [7.92 7.85 7.97]’; % calculate Q and b values according to quadratic problem formula, reproduced as f below
tau = 0.00001; % set up tolerance value
f = vX.’*Q*vX+b.’*vX+949;
Delf = [diff(f,x); diff(f,y); diff(f,z)];
t = (Delf.’*Delf)/(Delf.’*Q*Delf);
vx_old = [300 300 100]’; % set up initial vX value
grad = double(subs(Delf,vX,vx_old));
lenGrad = norm(grad);
Data = [vx_old;lenGrad];
while lenGrad > tau
t = subs(t,vX,vx_old);
vx_new = vx_old-t*grad;
grad = double(subs(Delf,vX,vx_new));
lenGrad = norm(grad);
Data = [Data [vx_new;lenGrad]];
vx_old = vx_new;
end
vx_new = double(vx_new)
fval = double(subs(f,vX,vx_new));
disp([‘Minimum value of the function is: ‘,num2str(fval)]);
disp([‘argmin of x value is: ‘,num2str(vx_new(1))]);
disp([‘argmin of y value is: ‘,num2str(vx_new(2))]);
disp([‘argmin of z value is: ‘,num2str(vx_new(3))]);
For reference, the objective function, which I am trying to minimize, is:
0.001562P1^2 + 0.00194P2^2 + 0.00482P3^2 + 7.92P1 + 7.85P2 + 7.97P3 + 949,
where each P represents the power output of 3 generating thermal units. I understand other methods are better suited to this problem, but I am required to try out unconstrained optimization on this problem. Would you help me determine if my code is wrong at some point or what I can do to improve it? Hi,
I’m working on an electrical engineering optimization problem. I tried running the problem following an algorithm which was given to me in class, but I am getting some undefined results. I am attaching my code below:
clc; clear;
syms x y z
vX = [x y z].’; % set up x vector and transposition
Q = [1.562E-3 0 0; 0 1.94E-3 0; 0 0 4.82E-3]; b = [7.92 7.85 7.97]’; % calculate Q and b values according to quadratic problem formula, reproduced as f below
tau = 0.00001; % set up tolerance value
f = vX.’*Q*vX+b.’*vX+949;
Delf = [diff(f,x); diff(f,y); diff(f,z)];
t = (Delf.’*Delf)/(Delf.’*Q*Delf);
vx_old = [300 300 100]’; % set up initial vX value
grad = double(subs(Delf,vX,vx_old));
lenGrad = norm(grad);
Data = [vx_old;lenGrad];
while lenGrad > tau
t = subs(t,vX,vx_old);
vx_new = vx_old-t*grad;
grad = double(subs(Delf,vX,vx_new));
lenGrad = norm(grad);
Data = [Data [vx_new;lenGrad]];
vx_old = vx_new;
end
vx_new = double(vx_new)
fval = double(subs(f,vX,vx_new));
disp([‘Minimum value of the function is: ‘,num2str(fval)]);
disp([‘argmin of x value is: ‘,num2str(vx_new(1))]);
disp([‘argmin of y value is: ‘,num2str(vx_new(2))]);
disp([‘argmin of z value is: ‘,num2str(vx_new(3))]);
For reference, the objective function, which I am trying to minimize, is:
0.001562P1^2 + 0.00194P2^2 + 0.00482P3^2 + 7.92P1 + 7.85P2 + 7.97P3 + 949,
where each P represents the power output of 3 generating thermal units. I understand other methods are better suited to this problem, but I am required to try out unconstrained optimization on this problem. Would you help me determine if my code is wrong at some point or what I can do to improve it? optimization, gradient search, economic dispatch MATLAB Answers — New Questions