title: How to limit number of locations for each vehicle in Google OR-Tools Route Optimization
body: <p>I have implemented Or-Tools for route optimization. Its working fine. Only one thing which i want to achieve that limit number of locations for each vehicle. For example, maximum two(2) locations defined for each vehicle.</p>
  <p>I have tried to implement Capacity Constraint but it does not work. Also i tried to implement SetSpanUpperBoundForVehicle function, in this case solution object is null.</p>
  <p>Here is my code</p>
  <pre><code>RoutingDimension timeDimension = routing.GetMutableDimension(&quot;Time&quot;);
              timeDimension.SetSpanUpperBoundForVehicle(2, 0);
              timeDimension.SetSpanUpperBoundForVehicle(2, 1);
              timeDimension.SetSpanUpperBoundForVehicle(2, 2);
  </code></pre>
  <p>How can i limit this number of routes? Please help.</p>