text: #from association_single_threaded import association
  from association_single_threaded import association
  from time import time
  import numpy as np
  
  def main():
      #Test data
      workers_limit = [
          480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480
      ]
      item_demand = [
          4, 1, 6, 1, 2, 2, 1, 5, 5, 9, 3, 1, 1, 1, 1, 1, 2, 6
      ]
      performance = [
          [145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964, 145.1964],
          [145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971, 145.4971],
          [155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267, 155.267],
          [157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713, 157.3713],
          [154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664, 154.9664],
          [154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658, 154.6658],
          [157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707, 157.0707],
          [145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977, 145.7977],
          [150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063, 150.0063],
          [156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701, 156.7701],
          [144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952, 144.5952],
          [144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958, 144.8958],
          [155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676, 155.5676],
          [156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695, 156.4695],
          [146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983, 146.0983],
          [143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928, 143.3928],
          [155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682, 155.8682],
          [143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934, 143.6934],
          [144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946, 144.2946],
          [156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688, 156.1688]
      ]
  
      #Calling method
      print('Optimization has begun...')
      beginning = time()
      scheudle, work_time, remains = association(performance, workers_limit, item_demand)
      elapsed_time = time() - beginning
  
      #Displaying result
      work_time_total = 0
      for i in range(0, len(scheudle)):
          work_time_total += work_time[i]
      remains_total = 0
      for item_count in remains:
          remains_total += item_count
      print('scheudle saved to result.txt')
      print('Items remaining: %d' % remains_total)
      print('Total work time: %.0f' % work_time_total)
      print('Items left: %d' % remains_total)
      print('Elapsed time:    %.3fs' % elapsed_time)
  
      #Saving scheudle to result.txt
      np.savetxt('result.txt', np.array(scheudle), fmt='%d', delimiter='  ')
  
  if __name__ == '__main__':
      main()
  