Nonlinear Optimization problem ( If statement)
古いコメントを表示
Hello everyone,
I'm tryng to solve a nonlinear optimization problem (constrained) using fmincon with 2232 variables (three vectors x,y,z of 744 elements).
I would like to add an "if condition" to the costraints, something like this:
for i=1:744
if x(i)>=650
y(i)<100
else
y(i)<50
end
end
it gives me the following error message :
"Conversion to logical from optim.problemdef.OptimizationInequality is not possible."
How can I add that kind of constraint?Is it possible with fmincon? If not, what solver would be the best choice?
3 件のコメント
Ameer Hamza
2020 年 4 月 24 日
This for loop is part of which function?
michael francesco pez
2020 年 4 月 24 日
Ameer Hamza
2020 年 4 月 24 日
You mentioned that you get this error
"Conversion to logical from optim.problemdef.OptimizationInequality is not possible."
Can you show the code which cause this error?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Choose a Solver についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!