title: How to solve school bus routing (SBR) using gurobi optimizer in matlab interface or in any other technical computing language?
body: <p>%An example to solve MILP using gurobi optimizer in matlab interface is given as follows:</p>
  
  <pre><code>function[] = mip1() 
  
  names = {'x'; 'y'; 'z'}; 
  
  try 
      clear model;  
      model.A = sparse([1 2 3; 1 1 0]);  
      model.obj = [1 1 2];  
      model.rhs = [4; 1];  
      model.sense = '&lt;&gt;';  
      model.vtype = 'B';  
      model.modelsense = 'min';  
  
      clear params;  
      params.outputflag = 0;  
      params.resultfile = 'mip1.lp';  
  
      result = gurobi(model, params);  
  
      disp(result)  
  
      for v=1:length(names)  
          fprintf('%s %d\n', names{v}, result.x(v));  
      end  
  
      fprintf('Obj: %e\n', result.objval);  
  
  catch gurobiError  
      fprintf('Error reported\n');  
  end  
  
  end  
  </code></pre>
  
  <p>======================================</p>
  
  <p>After running this code we have output like this:</p>
  
  <pre><code>      status: 'OPTIMAL'
   versioninfo: [1x1 struct]
        objval: 1
       runtime: 0
             x: [3x1 double]
         slack: [2x1 double]
      objbound: 1
     itercount: 0
  baritercount: 0
     nodecount: 0
  
  x 0
  y 1
  z 0
  Obj: 1.000000e+000
  </code></pre>
  
  <p>=========================================</p>
  
  <p>Now I want to generalize this code to solve school bus routing problem.</p>
  
  <p>I have modeled SBRP problem like this:</p>
  
  <pre><code>minimize sum_{i!=j} c_{ij} x_{ij}
  
  subject to sum_{j=1}^{n} x_{ij} = 1, for i=1,2,...,n
  
             sum_{i=1}^{n} x_{ij} = 1, for j=1,2,...,n
  
  
  
             sum_{i,j \in s} &lt;=|s|-v(s);
  
             s c V\{1};
  
             |s|&gt;=2;
  
             x_{ij} \in {0,1}; i,j =1,2,...,n; i!=j
  </code></pre>
  
  <p><code>c_{ij}</code> is cost</p>
  
  <p><code>v(s)</code> is an lower bound on the number of vehicles required to visit all vertices of <code>s</code> in the optimal solution.</p>
  
  <p><code>S</code> is a subset of <code>V/{1}</code>, where <code>V</code> is the set of bus stops.</p>
  
  <p>Please help me.</p>
  
  <p>Thanking you,</p>
  
  <p>Ajay</p>