title: The Optimization of an Objective Function with Step Functions
body: <p>I've asked <a href="https://math.stackexchange.com/questions/16788/solution-technique-to-optimize-sets-of-constraint-functions-with-objective-functi">this question</a> at Math SE, but the response is not very satisfactory. So I asked here again:</p>
  
  <p>I have an optimization problem with linear inequalities and equalities constraint:</p>
  
  <pre><code>A*x&lt;=b 
  Aeq*x=beq
  </code></pre>
  
  <p>The problem is that the objective function is composed of a summation of a series of Heaviside step functions, </p>
  
  <p>Here's the pseudo code for the objective function:</p>
  
  <pre><code>function f(k, c, x)
    ffunction =0;
    for i=0;i&lt;k.row.length;i++
       smallF=0
       for j=0; j&lt;k.column.length; j++
        smallF+= k.row[i]*k.column[j]*x[j]+c[j]
       end 
       ffunction += u(smallF)
    end
   f=ffunction 
  end
  
  
  function u(x)
    if(x&gt;0)
     return 1
    else
     return 0
    end
  end
  </code></pre>
  
  <p>The suggestion I got is to approximate the step function as a smooth function and use nonlinear optimization for this purpose. But is there anything in MATLAB toolbox that allows me to solve this without doing the smooth function conversion?</p>