Parcourir la source

update macop paper for JOSS

Jérôme BUISINE il y a 3 ans
Parent
commit
8adb876ae9
5 fichiers modifiés avec 32 ajouts et 16 suppressions
  1. 2 2
      examples/knapsackMultiExample.py
  2. 2 2
      macop/algorithms/Algorithm.py
  3. 4 0
      macop/algorithms/multi/MOEAD.py
  4. 21 9
      paper.md
  5. 3 3
      setup.py

+ 2 - 2
examples/knapsackMultiExample.py

@@ -80,13 +80,13 @@ def main():
     policy = UCBPolicy(operators, _C=100, _exp_rate=0.2)
 
     # pass list of evaluators
-    algo = MOEAD(20, 5, init, [evaluator1, evaluator2, evaluator2, evaluator2], operators, policy, validator, _maximise=True)
+    algo = MOEAD(20, 5, init, [evaluator1, evaluator2], operators, policy, validator, _maximise=True)
     
     algo.addCallback(MultiCheckpoint(_every=5, _filepath=mo_checkpoint_path))
     algo.addCallback(ParetoCheckpoint(_every=5, _filepath=pf_checkpoint_path))
     algo.addCallback(UCBCheckpoint(_every=5, _filepath=ucb_checkpoint_path))
 
-    paretoFront = algo.run(10000)
+    paretoFront = algo.run(1000)
 
     print("Pareto front is composed of", len(paretoFront), "solutions")
 

+ 2 - 2
macop/algorithms/Algorithm.py

@@ -110,7 +110,7 @@ class Algorithm():
         """
 
         if self.parent is not None:
-            return self.parent.numberOfEvaluations
+            return self.parent.getGlobalEvaluation()
 
         return self.numberOfEvaluations
 
@@ -122,7 +122,7 @@ class Algorithm():
         """
 
         if self.parent is not None:
-            return self.parent.maxEvaluations
+            return self.parent.getGlobalMaxEvaluation()
 
         return self.maxEvaluations
 

+ 4 - 0
macop/algorithms/multi/MOEAD.py

@@ -299,6 +299,10 @@ class MOEAD(Algorithm):
                 if j in indexes:
                     continue
 
+                # check if solutions are the same
+                if all([ _population[i].data[k] == _population[j].data[k] for k in range(len(_population[i].data)) ]):
+                    continue
+
                 nDominated = 0
 
                 # check number of dominated objectives of current solution by the others solution

Fichier diff supprimé car celui-ci est trop grand
+ 21 - 9
paper.md


+ 3 - 3
setup.py

@@ -11,13 +11,13 @@ class TestCommand(distutils.command.check.check):
         
         # folders
         # from macop.algorithms import Algorithm
+        print("==============================")
+        print("Run test program...")
 
         print("==============================")
-        print("Runs test command...")
+        print("Run test using doctest...")
 
         # pass test using doctest
-        #doctest.testmod(Algorithm)
-
         distutils.command.check.check.run(self)