I'm seeking for values 0 or more than 0.1 for example. How can I do this?

2 件のコメント

Torsten
Torsten 2022 年 5 月 31 日
編集済み: Torsten 2022 年 5 月 31 日
help find
if you seek them in an array or a matrix.
Otherwise, you have to explain your problem in more detail.
Milena Beneva
Milena Beneva 2022 年 5 月 31 日
partially discrete constraint like "x(i)=0 or x(i)>=0.1"

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

 採用された回答

Matt J
Matt J 2022 年 5 月 31 日
編集済み: Matt J 2022 年 5 月 31 日

0 投票

You cannot specify a partially discrete constraint like "x(i)=0 or x(i)>=0.1" on your variables with fmincon.
To handle that with fmincon, you must run a separate fmincon optimization for every possible subset S of non-zero x(i) variables, constraining x(i)>=0.1 for and x(i)=0 for .
An alternative to doing a combinatoric optimization would be to introduce binary variables b(i) and impose the linear inequality constraints,
0<=x(i)
b(i)<=10*x(i)
x(i)<=ub(i)*b(i)
The only x(i)<0.1 which satisfies these constraints is x(i)=0. For this approach, however, you would need a solver that can handle binary-constrained variables, like intlinprog (if your objective and other constraints are linear) or ga.

3 件のコメント

Walter Roberson
Walter Roberson 2022 年 5 月 31 日
You could use ga and nonlinear constraints though. ga and patternsearch should be able to handle discontinuities
Milena Beneva
Milena Beneva 2022 年 5 月 31 日
Thanks a lot! I do a portfolio optimization (by min risk) but all of assets from initial asset list take a part in optimized portfolio. It is not normal. Some of assets have weigths below 0.00005. I'm looking to desision how to constraint that solution.
Matt J
Matt J 2022 年 5 月 31 日
編集済み: Matt J 2022 年 5 月 31 日
You could use ga and nonlinear constraints though. ga and patternsearch should be able to handle discontinuities
I 'm less optimistic about that being successful. ga cannot do any prior analysis of nonlinear discontinuous constraints to determine how to distribute the initial population over discontinuous feasible regions.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProblem-Based Optimization Setup についてさらに検索

製品

リリース

R2022a

質問済み:

2022 年 5 月 31 日

編集済み:

2022 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by