intlinprog is returning noninteger values
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Taner Cokyasar
le 14 Juil 2016
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
le 15 Juil 2016
@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 :).
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!