title: Google OR-Tools : Solution unable to converge for Assignment with Task Sizes using python
body: <p>I tried to elaborate on the Assignment with Task Sizes example by adding a multi-dimensional "size"(demand) and "total_size_max" .</p>
  
  <p>The solution seems to decide to allocate everything to 1 worker only despite the fact that others are available. The result when run allocates everything to worker(machine 18).</p>
  
  <p>Sample output :</p>
  
  <pre><code>Machine 18 is assigned to produce Component 0 with minimum Cycle_Time = 10000000
  Machine 18 is assigned to produce Component 1 with minimum Cycle_Time = 10000000
  Machine 18 is assigned to produce Component 2 with minimum Cycle_Time = 10000000
  Machine 18 is assigned to produce Component 3 with minimum Cycle_Time = 10000000
  Machine 18 is assigned to produce Component 4 with minimum Cycle_Time = 10000000
  Machine 18 is assigned to produce Component 5 with minimum Cycle_Time = 10000000
  </code></pre>
  
  <p>Code :</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  from __future__ import print_function
  from ortools.sat.python import cp_model
  import time
  import numpy as np
  
  def main():
    model = cp_model.CpModel()
  
    start = time.time()
    # cost = machines on rows and components on columns with least cycle_time
    cost = [[7.995722268,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.995722268,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.995722268,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.995722268,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.764712938,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.64179678,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.764712938,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,26.10110138,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,26.10110138,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,24.79202174,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,27.72432227,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,29.63946277,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,29.4907994,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,24.79202174,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,27.72432227,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,29.63946277,10000000,10000000,10000000],
  [10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.271052178,10000000,10000000,10000000,10000000,10000000,10000000],
  [8.213437897,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.213437897,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.213437897,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.213437897,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.372568825,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.282863934,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,15.49746661,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,14.36944353,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,14.95278777,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,13.33333333,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,13.33333333,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,6.194286893,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,14.56521739,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,17.57157641,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.194286893,10000000,14.56521739,10000000,10000000,10000000,10000000],
  [8.076237035,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.076237035,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.076237035,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.076237035,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.400797794,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [8.019304639,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.019304639,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.019304639,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.019304639,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.496583613,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,3.778990587,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,11.51228733,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,11.06301248,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,4.492667454,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,5.512785364,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358,10000000,10000000,10000000,10000000,10000000,10000000,10000000,1.780837358,10000000,1.780837358],
  [10000000,10000000,10000000,10000000,10000000,7.755011055,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.755011055,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.755011055,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,7.755011055,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,25.45422456,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,29.69460764,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,32.00169225,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,25.45422456,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,29.69460764,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,10000000,10000000,10000000,10000000,10000000,28.19319991,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,27.13193117,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,26.59704717,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,28.19319991,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,27.13193117,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,21.5723175,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,8.455696203,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000],
  [10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000,6.776314217,10000000,10000000,10000000,10000000,10000000,10000000,10000000,10000000]
  ]
  
    #costList = [round(x) for x in cost]
    costlist = np.round(cost).astype(int).tolist()
  
    # demand for each component
    demand = [28,28,28,28,28,28,28,28,28,56,28,30,30,30,30,30,30,30,30,30,60,176,176,176,176,176,176,176,176,176,352,194,194,194,194,194,194,194,194,194,388,56,56,56,56,56,56,56,56,56,112,56,149,149,149,149,149,149,149,149,149,298,911,911,911,911,911,911,911,911,911,1822]
  
    # convert to numpy array for division
    arr = np.array(cost)
    # total available hours
    available_hrs = 2592000
    total_size_max =  available_hrs / arr
    total_size_max = total_size_max.astype(int)
  
    num_workers = len(cost)
    num_tasks = len(cost[1])
    # Variables
    x = []
    for i in range(num_workers):
      t = []
      for j in range(num_tasks):
        t.append(model.NewIntVar(0, 1, "x[%i,%i]" % (i, j)))
      x.append(t)
    x_array = [x[i][j] for i in range(num_workers) for j in range(num_tasks)]
  
    # Constraints
  
    # Each component is assigned to at least one machine.
    [model.Add(sum(x[i][j] for i in range(num_workers)) &gt;= 1)
    for j in range(num_tasks)]
  
    # Total demand of component for each machine is at most total_size_max(available_hrs/cycle_time).
    [model.Add(sum(demand[j] * x[i][j] for j in range(num_tasks)) &lt;= total_size_max[i][j])
    for i in range(num_workers)]
    model.Minimize(sum([np.dot(x_row, cost_row) for (x_row, cost_row) in zip(x, costlist)]))
    solver = cp_model.CpSolver()
    status = solver.Solve(model)
  
    if status == cp_model.OPTIMAL:
      print('Minimum cost = %i' % solver.ObjectiveValue())
      print()
  
      for i in range(num_workers):
  
        for j in range(num_tasks):
  
          if solver.Value(x[i][j]) == 1:
            print('Machine ', i, ' is assigned to produce Component ', j, ' with minimum Cycle_Time = ', cost[i][j])
      print()
      end = time.time()
      print("Time = ", round(end - start, 4), "seconds")
  
  
  if __name__ == '__main__':
    main()
  </code></pre>
  
  <p>I took this from the sample example and tweaked input data according to my need. Can someone help resolve this issue?</p>
  
  <p>Expected result is that the machine with lowest time should be assigned according to the demand</p>