Help me figure out what the error is. This is the first time I use matlab. Optimization problem with thirteen variables.
조회 수: 2 (최근 30일)
이전 댓글 표시
My task is to solve the target function, which is the sum of the total costs of purchasing and using reactive power compensation devices in medium voltage electrical networks. I need to minimize it.
For now, conditionally, there should be a reactive power compensation device(PCD) on each load.
I have formed a target function from three variables (capital costs, costs of energy loss in the network and costs depending on the reliability of the system).
Since the third variable does not depend on the PCD, it can be ignored. I have divided the target function into two to find their minima. I'll shorten the calculations, the final function in the matlab looks like this:
function f=fun1_optim(x)
f(1) = 266.214+0.256*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10)+x(11)+x(12)+x(13));
f(2) = 23.37*0.05*((sqrt(100^2+(90-x(1))^2))/(sqrt(3)*10^2)...
+(sqrt(150^2+(130-x(2))^2))/(sqrt(3)*10^2)...
+(sqrt(210^2+(180-x(3))^2))/(sqrt(3)*10^2)...
+(sqrt(300^2+(250-x(4))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(5))^2))/(sqrt(3)*10^2)...
+(sqrt(600^2+(450-x(6))^2))/(sqrt(3)*10^2)...
+(sqrt(400^2+(390-x(7))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(8))^2))/(sqrt(3)*10^2)...
+(sqrt(150^2+(130-x(9))^2))/(sqrt(3)*10^2)...
+(sqrt(180^2+(162-x(10))^2))/(sqrt(3)*10^2)...
+(sqrt(600^2+(450-x(11))^2))/(sqrt(3)*10^2)...
+(sqrt(500^2+(470-x(12))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(13))^2))/(sqrt(3)*10^2));
and here is the error:
I sincerely don't understand what they want from me. Please help me.
댓글 수: 1
답변 (1개)
Torsten
2024년 1월 27일
x0 = zeros(13,1);
lb = zeros(13,1);
ub = inf(13,1);
sol = fmincon(@fun1_optim,x0,[],[],[],[],lb,ub)
fun1_optim(sol)
function F=fun1_optim(x)
f(1) = 0.256*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10)+x(11)+x(12)+x(13));
f(2) = 23.37*0.05*((sqrt(100^2+(90-x(1))^2))/(sqrt(3)*10^2)...
+(sqrt(150^2+(130-x(2))^2))/(sqrt(3)*10^2)...
+(sqrt(210^2+(180-x(3))^2))/(sqrt(3)*10^2)...
+(sqrt(300^2+(250-x(4))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(5))^2))/(sqrt(3)*10^2)...
+(sqrt(600^2+(450-x(6))^2))/(sqrt(3)*10^2)...
+(sqrt(400^2+(390-x(7))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(8))^2))/(sqrt(3)*10^2)...
+(sqrt(150^2+(130-x(9))^2))/(sqrt(3)*10^2)...
+(sqrt(180^2+(162-x(10))^2))/(sqrt(3)*10^2)...
+(sqrt(600^2+(450-x(11))^2))/(sqrt(3)*10^2)...
+(sqrt(500^2+(470-x(12))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(13))^2))/(sqrt(3)*10^2));
F = f(1) + f(2);
end
댓글 수: 15
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!