フィルターのクリア

intlinprog is returning noninteger values

1 回表示 (過去 30 日間)
Standardtrickyness
Standardtrickyness 2015 年 8 月 31 日
コメント済み: Brendan Hamm 2016 年 7 月 15 日
I have my code where DDD is a 35x60 matrix I'm trying to get integer values for w(26:60) but its giving me
w= -1.0000
0
-1.0000
1.0000
0
-0.6667
-0.2222
-1.0000
-0.6667
-1.0000
-0.5556
-1.0000
-0.6667
-1.0000
-1.0000
-0.3333
-1.0000
0.7778
0
-1.0000
-1.0000
-0.7778
-0.8890
-0.6667
-0.3333
-1.0000
-1.0000
-1.0000
-2.0000
-1.0000
-1.0000
0
-1.0000
-1.7778
-1.0000
-2.0000
-1.6667
0
1.0000
0
0
-1.0000
-1.0000
-2.0000
-2.0000
-2.0000
-2.0000
-1.0000
-2.0000
-3.0000
-1.6667
-2.0000
-2.0000
-1.2222
-2.0000
-2.0000
-3.0000
-2.0000
-2.3333
-15.0000
For my Code:
intcon= zeros(35,1);
for i= 1 : 35
intcon(i,1)=25+i;
end
D = [ DDD ; eye(25), zeros(25,35); -eye(25), zeros(25,35) ] ;
f= [zeros(25,1) ; g ; -1 ] ;
b=[zeros(34,1); [1-0.0001 ] ; ones(25,1); ones(25,1) ] ;
w = intlinprog(-f,intcon,D,b) ;
  4 件のコメント
Taner Cokyasar
Taner Cokyasar 2016 年 7 月 14 日
Writing this just for future users: The intcon code you are using seems to be wrong. Intcon should be (1,35) for your problem. So all numbers should in the first row. The following code could solve this problem. As Matt mentioned, ub and lb are also necessary for particular bounds on variables.
intcon = 26:1:60;
Brendan Hamm
Brendan Hamm 2016 年 7 月 15 日
@Taner For future users, it should be known that the intcon being a row or column vector does not matter. Internally, intlinprog uses:
intcon = intcon(:)
Maybe at some point in the past this was different, I am not sure, but this would mean future users using past versions :).

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by