use cplex for mixed integer problem but get non-integer output
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Lou
 am 26 Aug. 2015
  
    
    
    
    
    Beantwortet: Alan Weiss
    
      
 am 26 Aug. 2015
            Hello, i use cplex in my madlab code to solve a mixed integer problem. So I use the function cplexmilp(fu,Aineq,bineq,Aeq,beq,sostype,sosind,soswt,lb,ub,ctype), which should produce integer solutions because ctype only contains I and B. Most of the time it works fine but every now and then I get an "optimal solution" containing entries like -0.0000 or 1.0000 and the rest of my program breaks or gives the wrong output. Do you have any idea where my mistake might be? Thank you
0 Kommentare
Akzeptierte Antwort
  Alan Weiss
    
      
 am 26 Aug. 2015
        Nearly any MILP solver uses floating point arithmetic internally, and uses tolerances to decide whether a number is "integer enough."
If you need really integer values for some variables, round them. If intcon is the vector of indices of the integer variables, execute
 x(intcon) = round(x(intcon));
or some such thing. See Some Integer Solutions Are Not Integers for a brief discussion of this issue related to the MATLAB intlinprog solver.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

