The best way to write a large number of constraints for an optimization problem

4 ビュー (過去 30 日間)
mohamed Faraj
mohamed Faraj 2019 年 11 月 6 日
コメント済み: mohamed Faraj 2019 年 11 月 21 日
Hi All,
I have an optimization problem which have a larger number of variables, probably 10000 optimization variables and a large number of constraints. The optimization problem is mixed integer convex problem. What is the best way to define the large number of constraints?. Can I use loops like the ones used in CVX to define constraints?. I have matlab 2013a.
Thank you

採用された回答

Matt J
Matt J 2019 年 11 月 6 日
編集済み: Matt J 2019 年 11 月 6 日
If they are linear constraints, they will be expressed using matrix-vector multiplication
A*x<=b
Aeq*x<=beq
so any vectorized method for building the A, Aeq, b, beq, matrices would be appropriate. Similarly, nonlinear constraints in Matlab are expressed using user-defined constraint functions of the following form
function [cineq,ceq]=nonlcon(x)
....
end
where cineq and ceq are vectors of inequality and equality constraint violations, respectively. When the number of variables or constraints is large, you would use vectorized Matlab commands to generate cineq and ceq from x.
  5 件のコメント
Matt J
Matt J 2019 年 11 月 21 日
編集済み: Matt J 2019 年 11 月 21 日
When I run the code
Code you haven't shown, so it's anybody's guess what's wrong with it....
However, my guess would be that your call to fmincon looks like this
fmincon(_____,nonlcon)
instead of this
fmincon(_____,@nonlcon)
mohamed Faraj
mohamed Faraj 2019 年 11 月 21 日
It works now with @. Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by