I want to optimize the 5 objective function
16 ビュー (過去 30 日間)
古いコメントを表示
I want to optimize five objective problems and having 5 variables
and it has some historical values of the variable and it has total 96 values. thats why i have choosen T=96
Function values
function [F g h]=wo_mpc(x)
T=96;
P_load=x(:,1);
P_pa=x(:,2);
P_bes=x(:,3);
P_ev=x(:,4);
P_grid=x(:,5);
%%%%%%%%%%%LOAD HISTORICAL VALUE%%%%%%%%%%
P_hist=[ 2000 2088.4 2023.2 2023.2 2023.2 2023.2 1958.3 1958.3 1958.3 1958.3 1918.6 1918.6 1918.6 1918.6 1915.0 1915.0 1915.0 1915.0 1964.2 1964.2 1964.2 1964.2 2091.8 2091.8 2091.8 2091.8 2300.0 2300.0 2300.0 2300.0 2399.9 2399.9 2399.9 2399.9 2345.8 2345.8 2345.8 2345.8 2191.9 2191.9 2191.9 2191.9 2055.5 2055.5 2055.5 2055.5 1958.3 1958.3 1958.3 1958.3 1910.7 1910.7 1910.7 1910.7 1901.2 1901.2 1901.2 1901.2 1932.2 1932.2 1932.2 1932.2 2028.9 2028.9 2028.9 2028.9 2144.2 2144.2 2144.2 2144.2 2328.5 2328.5 2328.5 2328.5 2502.8 2502.8 2502.8 2502.8 2652.1 2652.1 2652.1 2652.1 2635.1 2635.1 2635.1 2635.1 2536.4 2536.4 2536.4 2536.4 2371.5 2371.5 2371.5 2371.5 2218.1 2218.1 2218.1];
%%LOAD OBJECTIVE FUNCTION%%
f1=sum(((P_hist(1:T))-(P_load(1:T))).^2);
%%%%%%%%%PV HISTORICAL VALUE%%%%%%%%%%%%%
Ppa_hist=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .1 1.2 14.0 70.4 181.5 327.7 523.8 695.3 878.9 1025.1 1083.0 1101.6 1183.8 1170.8 1183.6 1158.9 1198.9 1188.9 1194.3 1195.1 1173.8 1185.8 1186.8 1227.1 1210.0 1195.1 1192.4 1175.9 1234.0 1254.5 1249.0 1268.0 1224.4 1226.4 1182.5 1222.3 1163.6 1140.4 1162.9 1019.7 996.0 1022.3 994.2 860.9 863.3 731.3 549.1 355.4 197.0 90.5 36.9 14.7 14.8 12.0 8.1 4.9 4.6 4.7 4.4 3.2 3.3 3.2 3.1 0 0 0 0 0 0 0];
%%PV OBJECTIVE FUNCTION%%
f2=sum(((Ppa_hist(1:T))-(P_pa(1:T))).^2);
%%%%%%%%%BES HISTORICAL VALUE%%%%%%%%%%%%%
P_bes_hist=[-73 -57 -88 -100 -112 -124 -71 -86 -82 -83 -122 -149 -130 -76 -130 -29 -37 -31 -18 42 61 69 85 8 67 69 87 164 201 272 200 361 414 203 120 472 369 -5 -156 339 20 -82 -204 -193 -330 -340 -368 -355 -125 -352 -419 -531 -484 -486 -448 -372 -479 -383 -133 -390 -136 -141 139 -129 274 247 66 328 447 229 213 85 -2 197 310 519 809 830 821 771 786 829 812 830 829 826 778 932 942 864 672 447 335 64 116 173];
%%BES OBJECTIVE FUNCTION%%
f3=sum((P_bes_hist(2:T))-P_bes(1:T-1));
%%%%%%%%%EV HISTORICAL VALUE%%%%%%%%%%%%%%%
P_ev_hist=[ 0 0 0 400 425 435 440 455 475 500 700 850 900 960 1000 1100 1250 1365 1145 1055 1000 996 970 950 935 600 520 200 -200 -350 -435 -765 -1356 -1400 -1156 -985 -915 -895 -850 -800 -650 -600 -545 -520 -300 -250 -150 315 350 368 400 412 420 430 460 500 485 470 465 462 458 452 448 442 440 437 550 570 475 460 462 465 470 475 450 435 420 360 320 225 195 160 -120 -135 -155 -175 -190 -220 -185 -160 -140 500 550 750 1000 1200];
%%EV OBJECTIVE FUNCTION%%
f4=sum(abs((P_ev_hist(2:T))-(P_ev(1:T-1))));
%%%%%%%%Grid HISTORICAL VALUE%%%%%%%%%%%%%%%
P_grid_hist=[2143.2 2146.4 2121.7 2108.7 2074.9 2073.9 2074.8 2075.6 2068.8 2073.9 2064.8 2045.5 2026.4 2003.7 1999.7 1997.4 2005.8 2024.9 2040.2 2043.6 2066.4 2135.2 2160.2 2204.3 2259.0 2361.4 2399.4 2443.4 2476.9 2540.3 2550.3 2542.6 2519.9 2501.7 2475.6 2475.5 2455.5 2412.9 2382.5 2360.2 2341.7 2325.2 2299.7 2261.0 2243.1 2240.7 2197.9 2210.5 2200.6 2192.5 2181.0 2187.2 2197.6 2177.4 2179.3 2178.3 2158.3 2198.4 2185.5 2207.9 2210.5 2232.6 2214.4 2222.4 2246.5 2251.5 2278.0 2334.3 2364.2 2393.7 2451.4 2483.8 2555.6 2559.4 2605.7 2650.0 2685.4 2734.6 2760.8 2762.3 2734.8 2708.9 2698.1 2673.0 2662.8 2657.1 2622.5 2589.5 2542.3 2501.6 2460.8 2422.2 2359.9 2334.2 2301.3 2268.4];
a=max(P_grid_hist);
b=min(P_grid_hist);
Cost=[1700.015 1700.030 1600.086 1600.085 1600.100 1700.075 1700.046 1700.030 1500.010 1500.043 1252.081 1252.051 1083.994 1052.050 1052.009 1020.452 979.590 1020.497 1020.434 1017.435 1083.988 1411.538 1452.039 149023 1083.941 1083.965 999.940 950.092 1400.032 1083.991 1300.071 1400.030 1441.643 1300.019 999.952 749.971 750.074 750.061 1020.464 1020.481 1380.237 1481.096 1390.430 1152.098 1020.496 852.064 852.007 700.084 700.079 699.935 564.528 440.008 400.075 565.514 699.966 852.001 852.060 852.088 1200.033 1200.078 1302.011 1302.082 1302.096 1382.475 1800.082 1803.621 1803.287 1803.111 1600.089 750.062 800.060 749.901 1020.480 1020.432 1600.040 1600.057 1800.679 1800.639 1800.619 1600.083 1370.539 1200.044 1200.021 1560.526 1500.073 1381.151 1380.190 1430.197 1083.936 1020.483 1150.152 1083.980 1801.742 1802.024 1786.004 1805.639];
g=(a-b)+(sum(abs((P_grid(2:T))-(P_grid(1:T-1)))))+(sum(((P_grid(1:T-2))-(2*P_grid(2:T-1))+(P_grid(3:T))).^2));
h=sum((Cost(1:T)).*(P_grid(1:T)));
f5=g+h;
F=[ f1 f2 f3 f4 f5]
end
To create a equality constraints
function [c ceq]=nonlin(x)
P_load=x(:,1);
P_pa=x(:,2);
P_bes=x(:,3);
P_ev=x(:,4);
P_grid=x(:,5);
ceq=P_load+P_pa+P_bes+P_ev+P_grid;
c=[]
end
and finally the main program
T=96;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
P_hist=[2088.4 2023.2 2023.2 2023.2 2023.2 1958.3 1958.3 1958.3 1958.3 1918.6 1918.6 1918.6 1918.6 1915.0 1915.0 1915.0 1915.0 1964.2 1964.2 1964.2 1964.2 2091.8 2091.8 2091.8 2091.8 2300.0 2300.0 2300.0 2300.0 2399.9 2399.9 2399.9 2399.9 2345.8 2345.8 2345.8 2345.8 2191.9 2191.9 2191.9 2191.9 2055.5 2055.5 2055.5 2055.5 1958.3 1958.3 1958.3 1958.3 1910.7 1910.7 1910.7 1910.7 1901.2 1901.2 1901.2 1901.2 1932.2 1932.2 1932.2 1932.2 2028.9 2028.9 2028.9 2028.9 2144.2 2144.2 2144.2 2144.2 2328.5 2328.5 2328.5 2328.5 2502.8 2502.8 2502.8 2502.8 2652.1 2652.1 2652.1 2652.1 2635.1 2635.1 2635.1 2635.1 2536.4 2536.4 2536.4 2536.4 2371.5 2371.5 2371.5 2371.5 2218.1 2218.1 2218.1];
Ppa_hist=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .1 1.2 14.0 70.4 181.5 327.7 523.8 695.3 878.9 1025.1 1083.0 1101.6 1183.8 1170.8 1183.6 1158.9 1198.9 1188.9 1194.3 1195.1 1173.8 1185.8 1186.8 1227.1 1210.0 1195.1 1192.4 1175.9 1234.0 1254.5 1249.0 1268.0 1224.4 1226.4 1182.5 1222.3 1163.6 1140.4 1162.9 1019.7 996.0 1022.3 994.2 860.9 863.3 731.3 549.1 355.4 197.0 90.5 36.9 14.7 14.8 12.0 8.1 4.9 4.6 4.7 4.4 3.2 3.3 3.2 3.1 0 0 0 0 0 0 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x0=ones(5,96).*[0];
A=[];
b=[];
Aeq=[];
Beq=[];
lb=ones(5,96).*[(0.5*(P_hist(1:T))),0,-100,-140,-3000];
ub=ones(5,96).*[(P_hist(1:T)),(Ppa_hist(1:T)),55,140,3000];
fun=@wo_mpc;
nlcon=@nonlin;
[x,fval,exitflag,output]=paretosearch(fun,5,A,b,Aeq,Beq,lb,ub,nlcon)
after that it showing that matrix daimension must agree
and error is comming in lower bound and upper bound
2 件のコメント
Matt J
2022 年 4 月 21 日
after that it showing that matrix daimension must agree
You should show that error to us as well. Either copy/paste the errors or, better yet, Run the code here for us (not on your local computer).
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Econometrics Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
