Lower bound in fmincon

4 ビュー (過去 30 日間)
ABHISHEK BHARDWAJ
ABHISHEK BHARDWAJ 2019 年 10 月 16 日
コメント済み: winkmal 2020 年 8 月 17 日
During optimization by fmincon, I have set lower bound equal to 0. So fmincon outputs some variables with very small values like 0.00000056 which is almost equal to 0.
How can I set this value to be 0 if it goes lower than 0.01 in fmincon. Means I want precision to two places after decimal only in the output.
  1 件のコメント
winkmal
winkmal 2020 年 8 月 17 日
Same problem here. Any progress would be appreciated.

サインインしてコメントする。

回答 (1 件)

Sai Bhargav Avula
Sai Bhargav Avula 2019 年 10 月 23 日
Hi,
Than setting the precision of the output of the fmincon, you can use the below given work around(as you want to set this only for the output).
n = 4; % number of desired decimal points
out= round(out*10^n)/10^n;
Hope this helps !
  1 件のコメント
ABHISHEK BHARDWAJ
ABHISHEK BHARDWAJ 2019 年 11 月 8 日
Thank you for the answer... but I want fmincon to return answer like this only... as I am using constraints like some of variables equal to 1...and there are lots of variables involved.
fmincon is returning all the variables with very small values and sum constraint satisfied. But I want significant values for some variables. If I use above code in this case...than all variables will become zero.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by