title: Weird result of CPLEX "cplexmilp" function in MATLAB
body: <p>According to <a href="https://stackoverflow.com/questions/20831074/using-min-max-operator-in-integer-programming">my previous question</a>, I want to optimize an objective function using <strong>binary integer linear programming</strong> (all of variables are binary) as follows:  </p>
  
  <pre><code>Minimize f = (c1*x1) + (c2*x2) + MAX((c3*x3),(c4*x4)) + (c5*x5)
  Subject to: some equality and inequality constraints
  </code></pre>
  
  <p>For <code>MAX</code> operator, I used auxiliary variable <code>x6</code> and added <code>x6&gt;=(c3*x3)</code> and <code>x6&gt;=(c4*x4)</code> constraints to the problem so the problem turn into:  </p>
  
  <pre><code>Minimize f = (c1*x1) + (c2*x2) + x6 + (c5*x5),  with added constraints.
  </code></pre>
  
  <p>I used <code>CPLEX API for MATLAB</code> to optimize the objective function.<br>
  Because all of variables are binary except one ((<code>x6</code>) which is continuous) and coefficients have <code>double</code> values, the problem turn into <strong>mixed integer linear programming</strong> so I used <code>cplexmilp</code> function with this configuration:  </p>
  
  <ul>
  <li>Variable types: <code>ctype='BBBBBC'</code> ( <strong>B</strong>:Binary, <strong>C</strong>:Continuous) </li>
  <li>Lower Bounds: <code>lb=[0 0 0 0 0 0]</code></li>
  <li>Upper Bounds: <code>ub=[0 0 0 0 0 inf]</code>  </li>
  <li>Function Call:
  <code>[fval] = cplexmilp(f, Aineq, bineq, Aeq, beq,[],[],[],lb,ub,ctype)</code></li>
  </ul>
  
  <p>but sometimes in the results I see <code>x3</code> and <code>x4</code> have  continuous values(between 0 and 1) and <code>x3+x4=1</code>.
  So my questions are:</p>
  
  <ol>
  <li>Can any one tell me what's wrong with <code>x3</code> and <code>x4</code>? </li>
  <li>Is there a solution for not using auxiliary variable and solving this optimization problem with <code>cplexbilp</code> ?   </li>
  </ol>
  
  <p>Thanks in advance</p>
  
  <p>[<strong>UPDATE</strong>]:<br>
  One parts of my code had logical errors which I fixed them, now in all cases which x3 and x4 are not binary we have x3*(1-x3)&lt; 10^(-5), x4*(1-x4)&lt; 10^(-5) and x3+x4=1, so @David Nehme were right (according to his useful comment), but my second question still remains here!</p>