現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)