I'm trying to find the minimum of a function with thirteen variables. Am I doing everything right? Tell me, how do I add restrictions?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to find the minimum of a function with thirteen variables. Am I doing everything right? Tell me, how do I add restrictions?
in short, I solve the problem of optimizing the electrical network by installing reactive power compensating devices.
function F = multiObjFcn(optimInput)
x(1) = optimInput(1);
x(2) = optimInput(2);
x(3) = optimInput(3);
x(4) = optimInput(4);
x(5) = optimInput(5);
x(6) = optimInput(6);
x(7) = optimInput(7);
x(8) = optimInput(8);
x(9) = optimInput(9);
x(10) = optimInput(10);
x(11) = optimInput(11);
x(12) = optimInput(12);
x(13) = optimInput(13);
F(1) = 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(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(100^2+(90-x(13))^2))/(sqrt(3)*10^2))+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))...
+23.37*0.05*((sqrt(180^2+(162-x(10))^2))/(sqrt(3)*10^2)...
+(sqrt(100^2+(90-x(13))^2))/(sqrt(3)*10^2))...
+23.37*0.05*((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(100^2+(90-x(13))^2))/(sqrt(3)*10^2))...
+23.37*0.05*((sqrt(210^2+(180-x(3))^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(100^2+(90-x(13))^2))/(sqrt(3)*10^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(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(100^2+(90-x(13))^2))/(sqrt(3)*10^2));
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1626743/image.png)
11 comentarios
Walter Roberson
el 27 de Feb. de 2024
I suggest you use Problem Based Optimization
Otherwise, you need to use ga() to handle the discrete values.
If the discrete values happen to be integers, then use lb and ub to establish natural bounds, and mark those variables as being restricted to integers.
If the discrete values do not happen to be integers, then use substitute integer variables with lower bound 0 and upper bound (number of discrete states minus one), and then in your code do a transformation (VALUE * NUMERIC_STEP + MINIMUM)
Respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!