필터 지우기
필터 지우기

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 (최근 30일)
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
  댓글 수: 11
Ivan
Ivan 2024년 2월 27일
Well, first of all, my variables must have a limit - no lower than a certain value. Secondly, these variables must take discrete values from a certain list with a certain numerical step. Then I want to add a component that will take a random value from a certain range.
Walter Roberson
Walter Roberson 2024년 2월 27일
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)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by