Linearizing a nonlinear constraint for use in intlinprog
古いコメントを表示
Hello Everyone,
I'm setting up an integer linear program using the "Problem-based approach". I have several constraints of the form:

Where:
x: is a binary decision variable, defined using "optimvar".
y: is a continious variable, defined using "optimexpr"
C: a constant real number.
I have tried to resolve this by creating an extra optimization expression "z" and then describing the product in several linear constraints as shown below.
constr1 = z <= M* x; % M is a big M constant
constr2 = z <= y; % y is an optimexpr described elsewhere in the code
constr3 = z >= y - M*(1- x);
constr4 = z >=0;
constr5 = z <= C;
However, when I apply it, and use the function "show" to chek on the constraints, this is what I get:
" Constraint with all zero coefficients"
Could someone point me to what I'm missing here?
3 件のコメント
However, when I apply it, and use the function "show" to chek on the constraints, this is what I get:
Well, you wouldn't have been able to examine a constraint using show(). You would need showconstr() for that...
I also don't understand why you would be using optimexpr to create y. Isn't y an independent variable? If so, you should use optimvar to create y as well.
Hatim Mala
2020 年 11 月 28 日
Matt J
2020 年 11 月 28 日
Well, I suggest attaching a .mat file containing x,y,z,C so that we can try to reproduce what you're seeing.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Linear Least Squares についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!