이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Matlab optimprob _Problem based _how can i see the optimal parameter setting while using optimprob
조회 수: 1 (최근 30일)
이전 댓글 표시
NN
2021년 9월 14일
Hi,
i am using optimprob for grid optimal dispatch problem, in this case how can i see the optimal parameter settings/iterations etc as we normally plot for other optimization methods, ?
Any graph/data that i can plot during simulation like optimization search space/paramters etc using any commands ???
[values,~,exitflag] = solve(prob,'Options',options);
I use this command,
how can i see the optimal values and cosntraints
Please advcie
채택된 답변
Alan Weiss
2021년 9월 14일
You can set a plot function in the options for your solver. To see which solver is being used, call optimoptions:
options = optimoptions(prob) % I assume prob is your optimproblem
Suppose that your solver is ga. Then you can set a plot function that ga accepts:
options = optimoptions(prob,"PlotFcn","gaplotbestf");
If the plot functions do not show what you want, feel free to write a custom plot function (ga is shown, but there are custom plot functions available for most solvers).
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 11
NN
2021년 9월 18일
This is my code ,
how can i view the optimal value, the variables that give the optimal value and the operating conditions?
% Solve the linear program
options = optimoptions(prob.optimoptions,'Display','none');
[values,~,exitflag] = solve(prob,'Options',options);
% Parse optmization results
if exitflag <= 0
Pd = zeros(N,1);
Pbattups = zeros(N,1);
Ebattups = zeros(N,1);
else
Pd = values.PdV;
Pbattups = values.PbattupsV;
Ebattups = values.EbattupsV;
end
NN
2021년 9월 18일
with below command It doesnt not display anything either in workspace or in command window , i dont knwo what mistake i have done.
options = optimoptions(prob.optimoptions,'Display','iter');
NN
2021년 9월 18일
편집: NN
2021년 9월 18일
when i used the below command
options = optimoptions(prob.optimoptions,'Display','iter');
[values,~,exitflag] = solve(prob,'Options',options);
fval = evaluate(prob.Objective,values);
I am getting below data in diagnosis viewer.
LP preprocessing removed 723 inequalities, 244 equalities,
727 variables, and 1379 non-zero elements.
Iter Time Fval Primal Infeas Dual Infeas
0 0.003 -5.713331e+09 5.951959e+08 0.000000e+00
101 0.004 -5.567856e+09 2.816612e+09 0.000000e+00
202 0.006 -5.397463e+09 1.412637e+10 0.000000e+00
303 0.007 -5.188584e+09 2.415490e+08 0.000000e+00
345 0.008 -5.186765e+09 0.000000e+00 0.000000e+00
Optimal solution found.
fval =
-6.0203e+09
What does thsi mean?what are the different parameters mentioned ?Please advice
In this below exampl,
tb1=struct2table(chemsol)
gives the variable values for fval,
I rewritten it as
tb1=struct2table(values) and got 241*5 table in diagnostic viewer.
LP preprocessing removed 723 inequalities, 244 equalities,
727 variables, and 1379 non-zero elements.
Iter Time Fval Primal Infeas Dual Infeas
0 0.004 -5.713331e+09 5.951959e+08 0.000000e+00
101 0.005 -5.567856e+09 2.816612e+09 0.000000e+00
202 0.008 -5.397463e+09 1.412637e+10 0.000000e+00
303 0.011 -5.188584e+09 2.415490e+08 0.000000e+00
345 0.012 -5.186765e+09 0.000000e+00 0.000000e+00
Optimal solution found.
tb1 =
241×5 table
Ebatt1V EbattupsV PbattEVregV PbattupsV PdV
________ _________ ___________ ___________ ___________
7.2e+07 5.575e+09 -16500 -4.1667e+05 4.5438e+05
7.2e+07 5.7e+09 -16500 -5e+05 5.378e+05
7.2e+07 5.85e+09 -16500 -5e+05 5.3788e+05
7.2e+07 6e+09 -16500 5e+05 -4.6813e+05
7.2e+07 5.85e+09 -16500 5e+05 -4.683e+05
7.2e+07 5.7e+09 -16500 5e+05 -4.6846e+05
7.2e+07 5.55e+09 -16500 5e+05 -4.6862e+05
7.2e+07 5.4e+09 -16500 5e+05 -4.6879e+05
7.2e+07 5.25e+09 -16500 5e+05 -4.6895e+05
7.2e+07 5.1e+09 -16500 5e+05 -4.6911e+05
7.2e+07 4.95e+09 -16500 5e+05 -4.6927e+05
7.2e+07 4.8e+09 -16500 5e+05 -4.6944e+05
7.2e+07 4.65e+09 -16500 5e+05 -4.696e+05
7.2e+07 4.5e+09 -16500 5e+05 -4.6976e+05
7.2e+07 4.35e+09 -16500 5e+05 -4.6993e+05
7.2e+07 4.2e+09 -16500 5e+05 -4.7007e+05
7.2e+07 4.05e+09 -16500 5e+05 -4.7015e+05
7.2e+07 3.9e+09 -16500 5e+05 -4.7023e+05
7.2e+07 3.75e+09 -16500 5e+05 -4.7031e+05
7.2e+07 3.6e+09 -16500 5e+05 -4.7039e+05
7.2e+07 3.45e+09 -16500 5e+05 -4.7048e+05
7.2e+07 3.3e+09 -16500 5e+05 -4.7056e+05
7.2e+07 3.15e+09 -16500 5e+05 -4.7064e+05
7.2e+07 3e+09 -16500 5e+05 -4.7072e+05
7.2e+07 2.85e+09 -16500 5e+05 -4.708e+05
7.2e+07 2.7e+09 -16500 5e+05 -4.7088e+05
7.2e+07 2.55e+09 -16500 5e+05 -4.7096e+05
7.2e+07 2.4e+09 -16500 5e+05 -4.7102e+05
7.2e+07 2.25e+09 -16500 5e+05 -4.7099e+05
7.2e+07 2.1e+09 -16500 5e+05 -4.7097e+05
7.2e+07 1.95e+09 -16500 5e+05 -4.7094e+05
7.2e+07 1.8e+09 -16500 0 29084
7.2e+07 1.8e+09 -16500 0 29109
7.2e+07 1.8e+09 -16500 0 29134
7.2e+07 1.8e+09 -16500 0 29160
7.2e+07 1.8e+09 -16500 0 29185
7.2e+07 1.8e+09 -16500 0 29210
7.2e+07 1.8e+09 -16500 0 29235
7.2e+07 1.8e+09 -16500 0 29261
7.2e+07 1.8e+09 -16500 0 29302
7.2e+07 1.8e+09 -16500 0 29404
7.2e+07 1.8e+09 -16500 0 29506
7.2e+07 1.8e+09 -16500 0 29608
7.2e+07 1.8e+09 -16500 0 29710
7.2e+07 1.8e+09 -16500 0 29812
7.2e+07 1.8e+09 -16500 0 29914
7.2e+07 1.8e+09 -16500 0 30016
7.2e+07 1.8e+09 -16500 0 30119
7.2e+07 1.8e+09 -16500 0 30221
7.2e+07 1.8e+09 -16500 0 30323
7.2e+07 1.8e+09 -16500 0 30425
7.2e+07 1.8e+09 -16500 0 30643
7.2e+07 1.8e+09 -16500 0 31327
7.2e+07 1.8e+09 -16500 0 32011
7.2e+07 1.8e+09 -16500 0 32695
7.2e+07 1.8e+09 -16500 0 33379
7.2e+07 1.8e+09 -16500 0 34063
7.2e+07 1.8e+09 -16500 0 34747
7.2e+07 1.8e+09 -16500 0 35431
7.2e+07 1.8e+09 -16500 0 36114
7.2e+07 1.8e+09 -16500 0 36798
7.2e+07 1.8e+09 -16500 0 37482
7.2e+07 1.8e+09 -16500 0 38166
7.2e+07 1.8e+09 -16500 0 38960
7.2e+07 1.8e+09 -16500 -5e+05 5.4019e+05
7.2e+07 1.95e+09 -16500 -5e+05 5.4142e+05
7.2e+07 2.1e+09 -16500 -5e+05 5.4265e+05
7.2e+07 2.25e+09 -16500 -5e+05 5.4388e+05
7.2e+07 2.4e+09 -16500 -5e+05 5.4512e+05
7.2e+07 2.55e+09 -16500 -5e+05 5.4635e+05
7.2e+07 2.7e+09 -16500 -5e+05 5.4758e+05
7.2e+07 2.85e+09 -16500 -5e+05 5.8181e+05
7.2e+07 3e+09 -16500 -5e+05 5.8304e+05
7.2e+07 3.15e+09 -16500 -5e+05 5.8427e+05
7.2e+07 3.3e+09 -16500 -5e+05 5.855e+05
7.2e+07 3.45e+09 -16500 -5e+05 5.8677e+05
7.2e+07 3.6e+09 -16500 -5e+05 5.8815e+05
7.2e+07 3.75e+09 -16500 -5e+05 5.8953e+05
7.2e+07 3.9e+09 -16500 -5e+05 5.9091e+05
7.2e+07 4.05e+09 -16500 -5e+05 5.9229e+05
7.2e+07 4.2e+09 -16500 -5e+05 5.9367e+05
7.2e+07 4.35e+09 -16500 -5e+05 5.9505e+05
7.2e+07 4.5e+09 -16500 -5e+05 5.9643e+05
7.2e+07 4.65e+09 -16500 -5e+05 5.9781e+05
7.2e+07 4.8e+09 -16500 -5e+05 5.9919e+05
7.2e+07 4.95e+09 -16500 -5e+05 5.8408e+05
7.2e+07 5.1e+09 -16500 -5e+05 5.8546e+05
7.2e+07 5.25e+09 -16500 -5e+05 4.5447e+05
7.2e+07 5.4e+09 -16500 -5e+05 4.5612e+05
7.2e+07 5.55e+09 -16500 -5e+05 4.5777e+05
7.2e+07 5.7e+09 -16500 -5e+05 4.5942e+05
7.2e+07 5.85e+09 -16500 -5e+05 4.6107e+05
7.2e+07 6e+09 -16500 -5e+05 4.6272e+05
7.2e+07 6.15e+09 -16500 -5e+05 4.6437e+05
7.2e+07 6.3e+09 -16500 -5e+05 4.6602e+05
7.2e+07 6.45e+09 -16500 -5e+05 4.6767e+05
7.2e+07 6.6e+09 -16500 -5e+05 4.6932e+05
7.2e+07 6.75e+09 -16500 -5e+05 6.6897e+05
7.2e+07 6.9e+09 -16500 -5e+05 6.7062e+05
7.2e+07 7.05e+09 -16500 -5e+05 3.756e+05
7.2e+07 7.2e+09 -16500 -1.334e-08 -1.234e+05
7.2e+07 7.2e+09 -16500 0 -1.224e+05
7.2e+07 7.2e+09 -16500 0 -1.214e+05
7.2e+07 7.2e+09 -16500 0 -1.204e+05
7.2e+07 7.2e+09 -16500 0 -1.194e+05
7.2e+07 7.2e+09 -16500 0 2.1161e+05
7.2e+07 7.2e+09 -16500 0 2.1261e+05
7.2e+07 7.2e+09 -16500 0 2.1361e+05
7.2e+07 7.2e+09 -16500 0 2.1461e+05
7.2e+07 7.2e+09 -16500 0 2.1561e+05
7.2e+07 7.2e+09 -16500 0 2.1661e+05
7.2e+07 7.2e+09 -16500 0 -25221
7.2e+07 7.2e+09 -16500 0 -25239
7.2e+07 7.2e+09 -16500 0 -25258
7.2e+07 7.2e+09 -16500 0 -25276
7.2e+07 7.2e+09 -16500 0 -25294
7.2e+07 7.2e+09 -16500 0 40687
7.2e+07 7.2e+09 -16500 0 40669
7.2e+07 7.2e+09 -16500 0 40651
7.2e+07 7.2e+09 -16500 0 40632
7.2e+07 7.2e+09 -16500 0 40614
7.2e+07 7.2e+09 -16500 0 40596
7.2e+07 7.2e+09 -16500 0 40578
7.2e+07 7.2e+09 -16500 0 -98620
7.2e+07 7.2e+09 -16500 0 -99406
7.2e+07 7.2e+09 -16500 0 -1.0019e+05
7.2e+07 7.2e+09 -16500 0 -1.0098e+05
7.2e+07 7.2e+09 -16500 0 -1.0176e+05
7.2e+07 7.2e+09 -16500 0 -1.0255e+05
7.2e+07 7.2e+09 -16500 8.0039e-09 -1.0334e+05
7.2e+07 7.2e+09 -16500 5e+05 -6.0412e+05
7.2e+07 7.05e+09 -16500 5e+05 -6.0491e+05
7.2e+07 6.9e+09 -16500 5e+05 -6.0569e+05
7.2e+07 6.75e+09 -16500 5e+05 -6.0648e+05
7.2e+07 6.6e+09 -16500 5e+05 -6.0726e+05
7.2e+07 6.45e+09 -16500 5e+05 -6.8054e+05
7.2e+07 6.3e+09 -16500 5e+05 -6.7989e+05
7.2e+07 6.15e+09 -16500 5e+05 -6.7924e+05
7.2e+07 6e+09 -16500 5e+05 -6.7858e+05
7.2e+07 5.85e+09 -16500 5e+05 -6.7793e+05
7.2e+07 5.7e+09 -16500 5e+05 -6.7728e+05
7.2e+07 5.55e+09 -16500 5e+05 -6.7663e+05
7.2e+07 5.4e+09 -16500 5e+05 -6.7598e+05
7.2e+07 5.25e+09 -16500 5e+05 -6.7532e+05
7.2e+07 5.1e+09 -16500 5e+05 -6.7467e+05
7.2e+07 4.95e+09 -16500 5e+05 -6.7402e+05
7.2e+07 4.8e+09 -16500 5e+05 -6.7337e+05
7.2e+07 4.65e+09 -16500 5e+05 -6.6775e+05
7.2e+07 4.5e+09 -16500 5e+05 -6.6772e+05
7.2e+07 4.35e+09 -16500 5e+05 -6.677e+05
7.2e+07 4.2e+09 16500 5e+05 -1.9877e+06
7.2e+07 4.05e+09 16500 5e+05 -1.9876e+06
7.2e+07 3.9e+09 16500 5e+05 -1.9876e+06
7.2e+07 3.75e+09 16500 5e+05 -1.9876e+06
7.2e+07 3.6e+09 16500 5e+05 -1.9876e+06
7.2e+07 3.45e+09 16500 5e+05 -1.9875e+06
7.2e+07 3.3e+09 16500 5e+05 -1.9875e+06
7.2e+07 3.15e+09 16500 5e+05 -1.9875e+06
7.2e+07 3e+09 16500 5e+05 -1.9875e+06
7.2e+07 2.85e+09 16500 5e+05 -1.9605e+06
7.2e+07 2.7e+09 16500 5e+05 -1.961e+06
7.2e+07 2.55e+09 16500 5e+05 -1.9614e+06
7.2e+07 2.4e+09 16500 5e+05 -1.9619e+06
7.2e+07 2.25e+09 16500 5e+05 -1.9623e+06
7.2e+07 2.1e+09 16500 5e+05 -1.9628e+06
7.2e+07 1.95e+09 16500 5e+05 -1.9633e+06
7.2e+07 1.8e+09 16500 0 -1.4637e+06
7.2e+07 1.8e+09 16500 0 -1.4807e+06
7.2e+07 1.8e+09 16500 0 -1.4811e+06
7.2e+07 1.8e+09 16500 0 -1.4816e+06
7.2e+07 1.8e+09 16500 0 -1.4821e+06
7.2e+07 1.8e+09 16500 0 -1.3138e+06
7.2e+07 1.8e+09 16500 0 -1.3143e+06
7.2e+07 1.8e+09 16500 0 -1.2489e+06
7.2e+07 1.8e+09 16500 0 -1.2494e+06
7.2e+07 1.8e+09 16500 0 -1.25e+06
7.2e+07 1.8e+09 16500 0 -1.2505e+06
7.2e+07 1.8e+09 16500 0 -1.251e+06
7.2e+07 1.8e+09 16500 0 -1.2516e+06
7.2e+07 1.8e+09 16500 0 -1.2521e+06
7.2e+07 1.8e+09 16500 0 -1.2526e+06
7.2e+07 1.8e+09 16500 0 -1.2532e+06
7.2e+07 1.8e+09 16500 0 -1.2537e+06
7.2e+07 1.8e+09 16500 0 -8.4094e+05
7.2e+07 1.8e+09 16500 0 -8.4202e+05
7.2e+07 1.8e+09 16500 0 -8.431e+05
7.2e+07 1.8e+09 16500 0 -8.4418e+05
7.2e+07 1.8e+09 16500 0 -8.4526e+05
7.2e+07 1.8e+09 16500 0 -8.4634e+05
7.2e+07 1.8e+09 16500 0 -8.4742e+05
7.2e+07 1.8e+09 16500 0 -8.485e+05
7.2e+07 1.8e+09 16500 0 -8.4959e+05
7.2e+07 1.8e+09 16500 -1.0545e-09 -8.5067e+05
7.2e+07 1.8e+09 16500 1.0949e-09 -8.5175e+05
7.2e+07 1.8e+09 -16500 1.2775e-09 -77328
7.2e+07 1.8e+09 -16500 -1.3262e-09 1.7958e+05
7.2e+07 1.8e+09 -16500 0 1.7854e+05
7.2e+07 1.8e+09 -16500 0 1.7749e+05
7.2e+07 1.8e+09 -16500 0 1.7644e+05
7.2e+07 1.8e+09 -16500 0 1.7539e+05
7.2e+07 1.8e+09 -16500 -2.1344e-08 1.7435e+05
7.2e+07 1.8e+09 -16500 -5e+05 6.733e+05
7.2e+07 1.95e+09 -16500 -5e+05 6.7225e+05
7.2e+07 2.1e+09 -16500 -5e+05 6.7121e+05
7.2e+07 2.25e+09 -16500 -5e+05 6.7016e+05
7.2e+07 2.4e+09 -16500 -5e+05 6.6911e+05
7.2e+07 2.55e+09 -16500 -5e+05 6.6807e+05
7.2e+07 2.7e+09 -16500 -5e+05 8.1026e+05
7.2e+07 2.85e+09 -16500 -5e+05 8.0963e+05
7.2e+07 3e+09 -16500 -5e+05 8.0901e+05
7.2e+07 3.15e+09 -16500 -5e+05 8.0839e+05
7.2e+07 3.3e+09 -16500 -5e+05 8.0776e+05
7.2e+07 3.45e+09 -16500 -5e+05 8.0714e+05
7.2e+07 3.6e+09 -16500 -5e+05 8.0651e+05
7.2e+07 3.75e+09 -16500 -5e+05 8.0589e+05
7.2e+07 3.9e+09 -16500 -5e+05 8.0527e+05
7.2e+07 4.05e+09 -16500 -5e+05 8.0464e+05
7.2e+07 4.2e+09 -16500 -5e+05 8.0402e+05
7.2e+07 4.35e+09 -16500 -5e+05 8.034e+05
7.2e+07 4.5e+09 -16500 -5e+05 7.0381e+05
7.2e+07 4.65e+09 -16500 -5e+05 7.0336e+05
7.2e+07 4.8e+09 -16500 -5e+05 7.0292e+05
7.2e+07 4.95e+09 -16500 -5e+05 7.0247e+05
7.2e+07 5.1e+09 -16500 -5e+05 7.0202e+05
7.2e+07 5.25e+09 -16500 -5e+05 7.0158e+05
7.2e+07 5.4e+09 -16500 -5e+05 7.0113e+05
7.2e+07 5.55e+09 -16500 -5e+05 7.0068e+05
7.2e+07 5.7e+09 -16500 -5e+05 7.0024e+05
7.2e+07 5.85e+09 -16500 -5e+05 6.9979e+05
7.2e+07 6e+09 -16500 -5e+05 6.9935e+05
7.2e+07 6.15e+09 -16500 -5e+05 6.494e+05
7.2e+07 6.3e+09 -16500 -5e+05 6.4896e+05
7.2e+07 6.45e+09 -16500 -5e+05 6.4854e+05
7.2e+07 6.6e+09 -16500 -5e+05 6.4812e+05
7.2e+07 6.75e+09 -16500 -5e+05 6.477e+05
7.2e+07 6.9e+09 16500 -5e+05 4.4928e+05
7.2e+07 7.05e+09 16500 -5e+05 4.4886e+05
7.2e+07 7.2e+09 16500 0 -51554
7.2e+07 7.2e+09 16500 0 -51972
7.2e+07 7.2e+09 -16500 0 46609
2.88e+08 7.2e+09 -16500 -5e+05 5.4619e+05
NN
2021년 9월 18일
Is it possible to get a signle value or a final value for optimised objective function and the variables instead of all these 241*5 table ?
kindly advice.
Alan Weiss
2021년 9월 20일
It is clear that solve is using intlinprog as the underlying solver. You have a mixed-integer linear programming problem.
The solution sol and objective function value fval are returned in
[sol,fval] = solve(prob,'Options',opts)
If that does not answer your question, then I obviously didn't understand what you were asking. Maybe ask in a different way, with an example of what you want.
Alan Weiss
MATLAB mathematical toolbox documentation
NN
2021년 9월 20일
Thank you very much. I understood it now, but i have a question, Please be kind to clear my doubt.I am getting Favl value very big,
I have tried to plot the values of optimal solution (minimal cost in this problem)
When I used the command
options = optimoptions(prob.optimoptions,'Display','iter');
I am getting a big value of 8.97e10 $/hr as Fval(optimal solution).
Please check this and confirm if it is correct or not or since the problem using an optimized time vector(dt=300), Is it required to modify the fval we get at the end (8.97e10 $/hr.)?
Please let me know. I am attaching the modified files(battsolaropt) and the diagnostic viewer screen for your reference. It is written No feasible solution was found.
Also please let me know why a gain of (3600*100) is used for calculating cost in Simulink, Why 100 is there?
Please advice .This has been posted as a seperate post here also,
https://www.mathworks.com/matlabcentral/answers/1456834-question-about-finding-the-optimal-value-_problem-based-optimization
NN
2021년 9월 20일
as per the problem,only 241 x1 table will be the answer for each variable or single variable i can get ?
Alan Weiss
2021년 9월 20일
I'm sorry, but I have reached the limit of the time I am willing to put in investigating your problem.
Alan Weiss
MATLAB mathematical toolbox documentation
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)