Clear Filters
Clear Filters

Help me figure out what the error is. This is the first time I use matlab. Optimization problem with thirteen variables.

1 view (last 30 days)
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.

Answers (1)

Torsten
Torsten on 27 Jan 2024
x0 = zeros(13,1);
lb = zeros(13,1);
ub = inf(13,1);
sol = fmincon(@fun1_optim,x0,[],[],[],[],lb,ub)
Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
sol = 13×1
1.0e-07 * 0.8139 0.7857 0.8161 0.8162 0.8139 0.7704 0.7988 0.8060 0.8081 0.8285
fun1_optim(sol)
ans = 30.9608
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 Comments

Sign in to comment.

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!