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?
조회 수: 6 (최근 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
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 Center 및 File Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!