Beispiel #1
0
  def check_current_joins_three_two_edges_case1_next_2_l1_cN(self, l0_col_second, l0_col, l1_col):
    next_row = 2

    cds = CDS(self.session, 3, 2)
    self.session.run(tf.global_variables_initializer())
    cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
    cds.joins([(0, l0_col)], (1, l1_col), "l1_c0")
    cds.joins([(0, l0_col_second), (1, l1_col)], (next_row, 0), "next")
    return cds
Beispiel #2
0
 def run(self):
     machine_count, job_count = self.data.shape
     if self.method=="B&B":
         #do somethign
         print('BB')
         print(self.data)
     elif self.method=="CDS":
         start = time()
         result = CDS(self.data)
         end = time()
         self.label.setText(bend(50,'{}\nOrdre : {}\nMakespan : {}\nTemps d\'execution : {:.6}s'.format(self.label.text(),result[0],result[1],end - start)))
         plotGantt(self.data,result[0],"CDS",job_count)
     elif self.method=="NEH":
         start = time()
         result = neh(self.data)
         end = time()
         self.label.setText(bend(50,'{}\nOrdre : {}\nMakespan : {}\nTemps d\'execution : {:.6}s'.format(self.label.text(),result[0],result[1],end - start)))
         plotGantt(self.data,result[0],"NEH",job_count)
     elif self.method=="GENETIC":
         population_size = 50
         # Generer une les individus de la population aleatoirement
         initPop = [sample(list(range(0, job_count)), job_count) for _ in range(0, population_size)] # same repeated individual
         start = time()
         result = genetic(self.data, initPop, population_size, 0.1, 200)
         end = time()
         self.label.setText(bend(50,'{}\nOrdre : {}\nMakespan : {}\nTemps d\'execution : {:.6}s'.format(self.label.text(),result[0],result[1],end - start)))
         plotGantt(self.data,result[0],"Genetic",job_count)
     elif self.method=="RECUIT":
         start = time()
         result = simulated_annealing(self.data, Ti = 790,Tf = 3 ,alpha = 0.93)
         end = time()
         self.label.setText(bend(50,'{}\nOrdre : {}\nMakespan : {}\nTemps d\'execution : {:.6}s'.format(self.label.text(),result[0],result[1],end - start)))
         plotGantt(self.data,result[0],"Genetic",job_count)
     elif self.method=="HYBRID":
         population_size = 50
         # Generer une les individus de la population aleatoirement
         initPop = [sample(list(range(0, job_count)), job_count) for _ in range(0, population_size)] # same repeated individual
         start = time()
         result = genetic_rt(self.data, initPop, population_size, 0.1, 200)
         end = time()
         self.label.setText(bend(50,'{}\nOrdre : {}\n Makespan : {}\nTemps d\'execution : {:.6}s'.format(self.label.text(),result[0],result[1],end - start)))
         plotGantt(self.data,result[0],"Hybrid",job_count)
Beispiel #3
0
 def check_current_joins_three_one_edge_case5(self, next_row):
   cds = CDS(self.session, 3, 2)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   cds.joins([(0, 1)], (next_row, 1), "next")
   self.assertEqual([((0, 0), "l0_c0"), ((next_row, 1), "next"), ((0, 2), "l0_c2")], cds.current())
Beispiel #4
0
 def test_current_joins_initialize_three(self):
   cds = CDS(self.session, 3, 1)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   self.assertEqual([((0, 0), "l0_c0"), ((0, 1), "l0_c1"), ((0, 2), "l0_c2")], cds.current())
Beispiel #5
0
 def check_current_joins_three_three_edges_case1(self, to_column):
   cds = CDS(self.session, 3, 2)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   cds.joins([(0, 0), (0, 1), (0, 2)], (1, to_column), "next")
   self.assertEqual([((1, to_column), "next")], cds.current())
Beispiel #6
0
 def test_current_joins_initialize_one(self):
   cds = CDS(self.session, 1, 1)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0"])
   self.assertEqual([((0, 0), "l0_c0")], cds.current())
Beispiel #7
0
 def test_current_empty(self):
   cds = CDS(self.session, 1, 1)
   self.session.run(tf.global_variables_initializer())
   self.assertEqual([], cds.current())
Beispiel #8
0
 def test_depth_is_set(self):
   self.assertEqual(1, CDS(self.session, 1, 1).depth)
Beispiel #9
0
 def test_length_is_set(self):
   self.assertEqual(1, CDS(self.session, 1, 1).length)
Beispiel #10
0
 def test_session_is_set(self):
   self.assertEqual(self.session, CDS(self.session, 1, 1).session)
Beispiel #11
0
 def test_create(self):
   assert( CDS(self.session, 1,1) )
nbIterAG = []
nbIterHY = []

for nbOfJobs in [20, 50, 100]:
    for instance in [1, 2]:
        path = './data/ta{}_10_{}.txt'.format(nbOfJobs, instance)
        matrice = dataReader.read(path, 10)
        matrice = np.array(matrice)

        machine_count, job_count = matrice.shape
        print('{} machines et {} jobs'.format(machine_count, job_count))

        print('Algorithme CDS :')
        start = time()
        result = CDS(matrice)
        end = time()
        print('  Ordre : {}'.format(result[0]))
        print('  Makespan : {}'.format(result[1]))
        print('  Temps d\'execution : {:.6}s\n'.format(end - start))
        tempsCDS.append(end - start)
        makespanCDS.append(result[1])

        print('Algorithme NEH :')
        start = time()
        result = neh(matrice)
        end = time()
        print('  Ordre : {}'.format(result[0]))
        print('  Makespan : {}'.format(result[1]))
        print('  Temps d\'execution : {:.6}s\n'.format(end - start))
        tempsNEH.append(end - start)