Parcourir la source

update ucb policy using EvE with exploration rate

Jérôme BUISINE il y a 3 ans
Parent
commit
b38a85f3b0
68 fichiers modifiés avec 404 ajouts et 171 suppressions
  1. BIN
      docs/build/doctrees/environment.pickle
  2. BIN
      docs/build/doctrees/examples.doctree
  3. BIN
      docs/build/doctrees/macop/macop.algorithms.Algorithm.doctree
  4. BIN
      docs/build/doctrees/macop/macop.operators.policies.UCBPolicy.doctree
  5. 1 1
      docs/build/html/.buildinfo
  6. 2 2
      docs/build/html/_modules/index.html
  7. 2 14
      docs/build/html/_modules/macop/algorithms/Algorithm.html
  8. 2 2
      docs/build/html/_modules/macop/algorithms/mono/IteratedLocalSearch.html
  9. 2 2
      docs/build/html/_modules/macop/algorithms/mono/LocalSearch.html
  10. 2 2
      docs/build/html/_modules/macop/callbacks/BasicCheckpoint.html
  11. 2 2
      docs/build/html/_modules/macop/callbacks/Callback.html
  12. 2 2
      docs/build/html/_modules/macop/callbacks/MultiCheckpoint.html
  13. 2 2
      docs/build/html/_modules/macop/callbacks/ParetoCheckpoint.html
  14. 2 2
      docs/build/html/_modules/macop/evaluators/EvaluatorExample.html
  15. 2 2
      docs/build/html/_modules/macop/operators/Operator.html
  16. 2 2
      docs/build/html/_modules/macop/operators/crossovers/Crossover.html
  17. 2 2
      docs/build/html/_modules/macop/operators/crossovers/RandomSplitCrossover.html
  18. 2 2
      docs/build/html/_modules/macop/operators/crossovers/SimpleCrossover.html
  19. 2 2
      docs/build/html/_modules/macop/operators/mutators/Mutation.html
  20. 2 2
      docs/build/html/_modules/macop/operators/mutators/SimpleBinaryMutation.html
  21. 2 2
      docs/build/html/_modules/macop/operators/mutators/SimpleMutation.html
  22. 2 2
      docs/build/html/_modules/macop/operators/policies/Policy.html
  23. 2 2
      docs/build/html/_modules/macop/operators/policies/RandomPolicy.html
  24. 19 11
      docs/build/html/_modules/macop/operators/policies/UCBPolicy.html
  25. 2 2
      docs/build/html/_modules/macop/solutions/BinarySolution.html
  26. 2 2
      docs/build/html/_modules/macop/solutions/CombinatoryIntegerSolution.html
  27. 2 2
      docs/build/html/_modules/macop/solutions/IntegerSolution.html
  28. 52 1
      docs/build/html/_sources/examples.rst.txt
  29. 1 1
      docs/build/html/_static/documentation_options.js
  30. 2 2
      docs/build/html/contributing.html
  31. 2 2
      docs/build/html/description.html
  32. 51 3
      docs/build/html/examples.html
  33. 5 5
      docs/build/html/genindex.html
  34. 2 2
      docs/build/html/index.html
  35. 2 2
      docs/build/html/macop.html
  36. 2 9
      docs/build/html/macop/macop.algorithms.Algorithm.html
  37. 2 2
      docs/build/html/macop/macop.algorithms.mono.IteratedLocalSearch.html
  38. 2 2
      docs/build/html/macop/macop.algorithms.mono.LocalSearch.html
  39. 2 2
      docs/build/html/macop/macop.callbacks.BasicCheckpoint.html
  40. 2 2
      docs/build/html/macop/macop.callbacks.Callback.html
  41. 2 2
      docs/build/html/macop/macop.callbacks.MultiCheckpoint.html
  42. 2 2
      docs/build/html/macop/macop.callbacks.ParetoCheckpoint.html
  43. 2 2
      docs/build/html/macop/macop.evaluators.EvaluatorExample.html
  44. 2 2
      docs/build/html/macop/macop.operators.Operator.html
  45. 2 2
      docs/build/html/macop/macop.operators.crossovers.Crossover.html
  46. 2 2
      docs/build/html/macop/macop.operators.crossovers.RandomSplitCrossover.html
  47. 2 2
      docs/build/html/macop/macop.operators.crossovers.SimpleCrossover.html
  48. 2 2
      docs/build/html/macop/macop.operators.mutators.Mutation.html
  49. 2 2
      docs/build/html/macop/macop.operators.mutators.SimpleBinaryMutation.html
  50. 2 2
      docs/build/html/macop/macop.operators.mutators.SimpleMutation.html
  51. 2 2
      docs/build/html/macop/macop.operators.policies.Policy.html
  52. 2 2
      docs/build/html/macop/macop.operators.policies.RandomPolicy.html
  53. 12 6
      docs/build/html/macop/macop.operators.policies.UCBPolicy.html
  54. 2 2
      docs/build/html/macop/macop.solutions.BinarySolution.html
  55. 2 2
      docs/build/html/macop/macop.solutions.CombinatoryIntegerSolution.html
  56. 2 2
      docs/build/html/macop/macop.solutions.IntegerSolution.html
  57. 2 2
      docs/build/html/macop/macop.solutions.Solution.html
  58. BIN
      docs/build/html/objects.inv
  59. 2 2
      docs/build/html/py-modindex.html
  60. 2 2
      docs/build/html/search.html
  61. 1 1
      docs/build/html/searchindex.js
  62. 2 2
      docs/source/conf.py
  63. 52 1
      docs/source/examples.rst
  64. 5 2
      knapsackMultiExample.py
  65. 0 12
      macop/algorithms/Algorithm.py
  66. 89 0
      macop/callbacks/UCBCheckpoint.py
  67. 17 9
      macop/operators/policies/UCBPolicy.py
  68. 1 1
      setup.py

BIN
docs/build/doctrees/environment.pickle


BIN
docs/build/doctrees/examples.doctree


BIN
docs/build/doctrees/macop/macop.algorithms.Algorithm.doctree


BIN
docs/build/doctrees/macop/macop.operators.policies.UCBPolicy.doctree


+ 1 - 1
docs/build/html/.buildinfo

@@ -1,4 +1,4 @@
 # Sphinx build info version 1
 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: aa568a4b1e185e577983cc75e8b0f707
+config: 1cb30eda9fb3abf8da370bf35fda8404
 tags: 645f666f9bcd5a90fca523b33c5a78b7

+ 2 - 2
docs/build/html/_modules/index.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Overview: module code &mdash; macop v0.2.0 documentation</title>
+  <title>Overview: module code &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 14
docs/build/html/_modules/macop/algorithms/Algorithm.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.Algorithm &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.Algorithm &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           
@@ -223,18 +223,6 @@
         <span class="c1"># set as new</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">callbacks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">_callback</span><span class="p">)</span></div>
 
-<div class="viewcode-block" id="Algorithm.setCheckpoint"><a class="viewcode-back" href="../../../macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.setCheckpoint">[docs]</a>    <span class="k">def</span> <span class="nf">setCheckpoint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_callback</span><span class="p">):</span>
-        <span class="sd">&quot;&quot;&quot;Set checkpoint instance directly</span>
-<span class="sd">        Args:</span>
-<span class="sd">            _callback: {Callback} -- Callback instance used for checkpoint</span>
-<span class="sd">        &quot;&quot;&quot;</span>
-        <span class="c1"># specify current main algorithm reference if necessary</span>
-        <span class="k">if</span> <span class="n">_callback</span><span class="o">.</span><span class="n">algo</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
-            <span class="n">_callback</span><span class="o">.</span><span class="n">setAlgo</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
-
-        <span class="c1"># set as checkpoint</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span> <span class="o">=</span> <span class="n">_callback</span></div>
-
 <div class="viewcode-block" id="Algorithm.resume"><a class="viewcode-back" href="../../../macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.resume">[docs]</a>    <span class="k">def</span> <span class="nf">resume</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
         <span class="sd">&quot;&quot;&quot;Resume algorithm using Callback instances</span>
 <span class="sd">        &quot;&quot;&quot;</span>

+ 2 - 2
docs/build/html/_modules/macop/algorithms/mono/IteratedLocalSearch.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.mono.IteratedLocalSearch &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.mono.IteratedLocalSearch &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/algorithms/mono/LocalSearch.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.mono.LocalSearch &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.mono.LocalSearch &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/callbacks/BasicCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.BasicCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.BasicCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/callbacks/Callback.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.Callback &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.Callback &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/callbacks/MultiCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.MultiCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.MultiCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/callbacks/ParetoCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.ParetoCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.ParetoCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/evaluators/EvaluatorExample.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.evaluators.EvaluatorExample &mdash; macop v0.2.0 documentation</title>
+  <title>macop.evaluators.EvaluatorExample &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/Operator.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.Operator &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.Operator &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/crossovers/Crossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.Crossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.Crossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/crossovers/RandomSplitCrossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.RandomSplitCrossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.RandomSplitCrossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/crossovers/SimpleCrossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.SimpleCrossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.SimpleCrossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/mutators/Mutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.Mutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.Mutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/mutators/SimpleBinaryMutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.SimpleBinaryMutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.SimpleBinaryMutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/mutators/SimpleMutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.SimpleMutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.SimpleMutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/policies/Policy.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.policies.Policy &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.policies.Policy &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/operators/policies/RandomPolicy.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.policies.RandomPolicy &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.policies.RandomPolicy &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

Fichier diff supprimé car celui-ci est trop grand
+ 19 - 11
docs/build/html/_modules/macop/operators/policies/UCBPolicy.html


+ 2 - 2
docs/build/html/_modules/macop/solutions/BinarySolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.BinarySolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.BinarySolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/solutions/CombinatoryIntegerSolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.CombinatoryIntegerSolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.CombinatoryIntegerSolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/macop/solutions/IntegerSolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.IntegerSolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.IntegerSolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 52 - 1
docs/build/html/_sources/examples.rst.txt

@@ -254,6 +254,31 @@ In our case, we need to specify the use of checkpoint if we prefer to restart fr
     # And also the algorithm to load checkpoint if exists before running by using `load` method of callback
     algo.addCallback(callback)
 
+We can also add the `UCBCheckpoint` callback which keeps track of UCB data obtained during previous run:
+
+.. code:: python
+    
+    """
+    imports part
+    """
+    ...
+    
+    import logging
+
+    from macop.callbacks.UCBCheckpoint import UCBCheckpoint
+
+    """
+    Problem definition
+    """
+    ...
+
+    """
+    Algorithm parameters
+    """
+    ...
+
+    # add UCB Checkpoint callback to keep track of UCB statistics obtained
+    algo.addCallback(UCBCheckpoint(_every=5, _filepath='data/ucbPolicy.csv'))
 
 In this way, now we can run and obtained the best solution found in `n` evaluations
 
@@ -503,7 +528,7 @@ To keep track of our `mu` population and `pfPop` pareto front set, 2 new callbac
 
     from macop.algorithms.multi.MOEAD import MOEAD
     from macop.callbacks.MultiCheckpoint import MultiCheckpoint
-    from macop.callbacks.ParetoFront import ParetoFront
+    from macop.callbacks.ParetoCheckpoint import ParetoCheckpoint
 
     """
     Problem definition
@@ -533,6 +558,32 @@ To keep track of our `mu` population and `pfPop` pareto front set, 2 new callbac
 
 These callbacks only stores the last states of `mu` population and `pfPop`.
 
+We can also add the `UCBCheckpoint` callback which keeps track of UCB data obtained during previous run:
+
+.. code:: python
+    
+    """
+    imports part
+    """
+    ...
+    
+    import logging
+
+    from macop.callbacks.UCBCheckpoint import UCBCheckpoint
+
+    """
+    Problem definition
+    """
+    ...
+
+    """
+    Algorithm parameters
+    """
+    ...
+
+    # add UCB Checkpoint callback to keep track of UCB statistics obtained
+    algo.addCallback(UCBCheckpoint(_every=5, _filepath='data/ucbPolicy.csv'))
+
 We can now run the MOEAD algorithm instance:
 
 .. code:: python

+ 1 - 1
docs/build/html/_static/documentation_options.js

@@ -1,6 +1,6 @@
 var DOCUMENTATION_OPTIONS = {
     URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
-    VERSION: 'v0.2.0',
+    VERSION: 'v0.2.1',
     LANGUAGE: 'None',
     COLLAPSE_INDEX: false,
     FILE_SUFFIX: '.html',

+ 2 - 2
docs/build/html/contributing.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Contributing &mdash; macop v0.2.0 documentation</title>
+  <title>Contributing &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -59,7 +59,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/description.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Description &mdash; macop v0.2.0 documentation</title>
+  <title>Description &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 51 - 3
docs/build/html/examples.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Some examples &mdash; macop v0.2.0 documentation</title>
+  <title>Some examples &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           
@@ -401,6 +401,30 @@ A Callback is runned every number of evaluations but can also implement the <cit
 <span class="n">algo</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">callback</span><span class="p">)</span>
 </pre></div>
 </div>
+<p>We can also add the <cite>UCBCheckpoint</cite> callback which keeps track of UCB data obtained during previous run:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">imports part</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="kn">import</span> <span class="nn">logging</span>
+
+<span class="kn">from</span> <span class="nn">macop.callbacks.UCBCheckpoint</span> <span class="kn">import</span> <span class="n">UCBCheckpoint</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Problem definition</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Algorithm parameters</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="c1"># add UCB Checkpoint callback to keep track of UCB statistics obtained</span>
+<span class="n">algo</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">UCBCheckpoint</span><span class="p">(</span><span class="n">_every</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">_filepath</span><span class="o">=</span><span class="s1">&#39;data/ucbPolicy.csv&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
 <p>In this way, now we can run and obtained the best solution found in <cite>n</cite> evaluations</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">bestSol</span> <span class="o">=</span> <span class="n">algo</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="mi">10000</span><span class="p">)</span>
 <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Solution score is </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">evaluator</span><span class="p">(</span><span class="n">bestSol</span><span class="p">)))</span>
@@ -618,7 +642,7 @@ This is an example, we based our function using classical weighted sum, we can a
 
 <span class="kn">from</span> <span class="nn">macop.algorithms.multi.MOEAD</span> <span class="kn">import</span> <span class="n">MOEAD</span>
 <span class="kn">from</span> <span class="nn">macop.callbacks.MultiCheckpoint</span> <span class="kn">import</span> <span class="n">MultiCheckpoint</span>
-<span class="kn">from</span> <span class="nn">macop.callbacks.ParetoFront</span> <span class="kn">import</span> <span class="n">ParetoFront</span>
+<span class="kn">from</span> <span class="nn">macop.callbacks.ParetoCheckpoint</span> <span class="kn">import</span> <span class="n">ParetoCheckpoint</span>
 
 <span class="sd">&quot;&quot;&quot;</span>
 <span class="sd">Problem definition</span>
@@ -648,6 +672,30 @@ This is an example, we based our function using classical weighted sum, we can a
 </pre></div>
 </div>
 <p>These callbacks only stores the last states of <cite>mu</cite> population and <cite>pfPop</cite>.</p>
+<p>We can also add the <cite>UCBCheckpoint</cite> callback which keeps track of UCB data obtained during previous run:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">imports part</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="kn">import</span> <span class="nn">logging</span>
+
+<span class="kn">from</span> <span class="nn">macop.callbacks.UCBCheckpoint</span> <span class="kn">import</span> <span class="n">UCBCheckpoint</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Problem definition</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Algorithm parameters</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="o">...</span>
+
+<span class="c1"># add UCB Checkpoint callback to keep track of UCB statistics obtained</span>
+<span class="n">algo</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">UCBCheckpoint</span><span class="p">(</span><span class="n">_every</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">_filepath</span><span class="o">=</span><span class="s1">&#39;data/ucbPolicy.csv&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
 <p>We can now run the MOEAD algorithm instance:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">paretoFront</span> <span class="o">=</span> <span class="n">algo</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="mi">10000</span><span class="p">)</span>
 

+ 5 - 5
docs/build/html/genindex.html

@@ -9,7 +9,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Index &mdash; macop v0.2.0 documentation</title>
+  <title>Index &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -59,7 +59,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           
@@ -313,6 +313,8 @@
         <li><a href="macop/macop.callbacks.ParetoCheckpoint.html#macop.callbacks.ParetoCheckpoint.ParetoCheckpoint.every">(macop.callbacks.ParetoCheckpoint.ParetoCheckpoint attribute)</a>
 </li>
       </ul></li>
+      <li><a href="macop/macop.operators.policies.UCBPolicy.html#macop.operators.policies.UCBPolicy.UCBPolicy.exp_rate">exp_rate (macop.operators.policies.UCBPolicy.UCBPolicy attribute)</a>
+</li>
   </ul></td>
 </tr></table>
 
@@ -481,7 +483,7 @@
 <h2 id="O">O</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="macop/macop.operators.policies.UCBPolicy.html#macop.operators.policies.UCBPolicy.UCBPolicy.occurences">occurences (macop.operators.policies.UCBPolicy.UCBPolicy attribute)</a>
+      <li><a href="macop/macop.operators.policies.UCBPolicy.html#macop.operators.policies.UCBPolicy.UCBPolicy.occurrences">occurrences (macop.operators.policies.UCBPolicy.UCBPolicy attribute)</a>
 </li>
       <li><a href="macop/macop.operators.Operator.html#macop.operators.Operator.Operator">Operator (class in macop.operators.Operator)</a>
 </li>
@@ -595,8 +597,6 @@
       </ul></li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.setCheckpoint">setCheckpoint() (macop.algorithms.Algorithm.Algorithm method)</a>
-</li>
       <li><a href="macop/macop.operators.mutators.SimpleBinaryMutation.html#macop.operators.mutators.SimpleBinaryMutation.SimpleBinaryMutation">SimpleBinaryMutation (class in macop.operators.mutators.SimpleBinaryMutation)</a>
 </li>
       <li><a href="macop/macop.operators.crossovers.SimpleCrossover.html#macop.operators.crossovers.SimpleCrossover.SimpleCrossover">SimpleCrossover (class in macop.operators.crossovers.SimpleCrossover)</a>

+ 2 - 2
docs/build/html/index.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Minimalist And Customizable Optimization Package &mdash; macop v0.2.0 documentation</title>
+  <title>Minimalist And Customizable Optimization Package &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -59,7 +59,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Documentation &mdash; macop v0.2.0 documentation</title>
+  <title>Documentation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 9
docs/build/html/macop/macop.algorithms.Algorithm.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.Algorithm &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.Algorithm &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           
@@ -351,13 +351,6 @@
 <dd><p>Run the specific algorithm following number of evaluations to find optima</p>
 </dd></dl>
 
-<dl class="method">
-<dt id="macop.algorithms.Algorithm.Algorithm.setCheckpoint">
-<code class="sig-name descname">setCheckpoint</code><span class="sig-paren">(</span><em class="sig-param">_callback</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/macop/algorithms/Algorithm.html#Algorithm.setCheckpoint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#macop.algorithms.Algorithm.Algorithm.setCheckpoint" title="Permalink to this definition">¶</a></dt>
-<dd><p>Set checkpoint instance directly
-:param _callback: {Callback} – Callback instance used for checkpoint</p>
-</dd></dl>
-
 <dl class="method">
 <dt id="macop.algorithms.Algorithm.Algorithm.stop">
 <code class="sig-name descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/macop/algorithms/Algorithm.html#Algorithm.stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#macop.algorithms.Algorithm.Algorithm.stop" title="Permalink to this definition">¶</a></dt>

+ 2 - 2
docs/build/html/macop/macop.algorithms.mono.IteratedLocalSearch.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.mono.IteratedLocalSearch &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.mono.IteratedLocalSearch &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.algorithms.mono.LocalSearch.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.algorithms.mono.LocalSearch &mdash; macop v0.2.0 documentation</title>
+  <title>macop.algorithms.mono.LocalSearch &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.callbacks.BasicCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.BasicCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.BasicCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.callbacks.Callback.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.Callback &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.Callback &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.callbacks.MultiCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.MultiCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.MultiCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.callbacks.ParetoCheckpoint.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.callbacks.ParetoCheckpoint &mdash; macop v0.2.0 documentation</title>
+  <title>macop.callbacks.ParetoCheckpoint &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.evaluators.EvaluatorExample.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.evaluators.EvaluatorExample &mdash; macop v0.2.0 documentation</title>
+  <title>macop.evaluators.EvaluatorExample &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.Operator.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.Operator &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.Operator &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.crossovers.Crossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.Crossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.Crossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.crossovers.RandomSplitCrossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.RandomSplitCrossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.RandomSplitCrossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.crossovers.SimpleCrossover.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.crossovers.SimpleCrossover &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.crossovers.SimpleCrossover &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.mutators.Mutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.Mutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.Mutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.mutators.SimpleBinaryMutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.SimpleBinaryMutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.SimpleBinaryMutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.mutators.SimpleMutation.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.mutators.SimpleMutation &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.mutators.SimpleMutation &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.policies.Policy.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.policies.Policy &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.policies.Policy &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.operators.policies.RandomPolicy.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.operators.policies.RandomPolicy &mdash; macop v0.2.0 documentation</title>
+  <title>macop.operators.policies.RandomPolicy &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

Fichier diff supprimé car celui-ci est trop grand
+ 12 - 6
docs/build/html/macop/macop.operators.policies.UCBPolicy.html


+ 2 - 2
docs/build/html/macop/macop.solutions.BinarySolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.BinarySolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.BinarySolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.solutions.CombinatoryIntegerSolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.CombinatoryIntegerSolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.CombinatoryIntegerSolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.solutions.IntegerSolution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.IntegerSolution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.IntegerSolution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/macop/macop.solutions.Solution.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>macop.solutions.Solution &mdash; macop v0.2.0 documentation</title>
+  <title>macop.solutions.Solution &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -60,7 +60,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

BIN
docs/build/html/objects.inv


+ 2 - 2
docs/build/html/py-modindex.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Python Module Index &mdash; macop v0.2.0 documentation</title>
+  <title>Python Module Index &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -61,7 +61,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

+ 2 - 2
docs/build/html/search.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Search &mdash; macop v0.2.0 documentation</title>
+  <title>Search &mdash; macop v0.2.1 documentation</title>
   
 
   
@@ -59,7 +59,7 @@
             
             
               <div class="version">
-                0.2.0
+                0.2.1
               </div>
             
           

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
docs/build/html/searchindex.js


+ 2 - 2
docs/source/conf.py

@@ -23,9 +23,9 @@ copyright = '2020, Jérôme BUISINE'
 author = 'Jérôme BUISINE'
 
 # The short X.Y version
-version = '0.2.0'
+version = '0.2.1'
 # The full version, including alpha/beta/rc tags
-release = 'v0.2.0'
+release = 'v0.2.1'
 
 
 # -- General configuration ---------------------------------------------------

+ 52 - 1
docs/source/examples.rst

@@ -254,6 +254,31 @@ In our case, we need to specify the use of checkpoint if we prefer to restart fr
     # And also the algorithm to load checkpoint if exists before running by using `load` method of callback
     algo.addCallback(callback)
 
+We can also add the `UCBCheckpoint` callback which keeps track of UCB data obtained during previous run:
+
+.. code:: python
+    
+    """
+    imports part
+    """
+    ...
+    
+    import logging
+
+    from macop.callbacks.UCBCheckpoint import UCBCheckpoint
+
+    """
+    Problem definition
+    """
+    ...
+
+    """
+    Algorithm parameters
+    """
+    ...
+
+    # add UCB Checkpoint callback to keep track of UCB statistics obtained
+    algo.addCallback(UCBCheckpoint(_every=5, _filepath='data/ucbPolicy.csv'))
 
 In this way, now we can run and obtained the best solution found in `n` evaluations
 
@@ -503,7 +528,7 @@ To keep track of our `mu` population and `pfPop` pareto front set, 2 new callbac
 
     from macop.algorithms.multi.MOEAD import MOEAD
     from macop.callbacks.MultiCheckpoint import MultiCheckpoint
-    from macop.callbacks.ParetoFront import ParetoFront
+    from macop.callbacks.ParetoCheckpoint import ParetoCheckpoint
 
     """
     Problem definition
@@ -533,6 +558,32 @@ To keep track of our `mu` population and `pfPop` pareto front set, 2 new callbac
 
 These callbacks only stores the last states of `mu` population and `pfPop`.
 
+We can also add the `UCBCheckpoint` callback which keeps track of UCB data obtained during previous run:
+
+.. code:: python
+    
+    """
+    imports part
+    """
+    ...
+    
+    import logging
+
+    from macop.callbacks.UCBCheckpoint import UCBCheckpoint
+
+    """
+    Problem definition
+    """
+    ...
+
+    """
+    Algorithm parameters
+    """
+    ...
+
+    # add UCB Checkpoint callback to keep track of UCB statistics obtained
+    algo.addCallback(UCBCheckpoint(_every=5, _filepath='data/ucbPolicy.csv'))
+
 We can now run the MOEAD algorithm instance:
 
 .. code:: python

+ 5 - 2
knapsackMultiExample.py

@@ -18,6 +18,7 @@ from macop.operators.policies.UCBPolicy import UCBPolicy
 from macop.algorithms.multi.MOEAD import MOEAD
 from macop.callbacks.MultiCheckpoint import MultiCheckpoint
 from macop.callbacks.ParetoCheckpoint import ParetoCheckpoint
+from macop.callbacks.UCBCheckpoint import UCBCheckpoint
 
 if not os.path.exists('data'):
     os.makedirs('data')
@@ -70,18 +71,20 @@ def evaluator2(_solution):
 
 mo_checkpoint_path = "data/checkpointsMOEAD.csv"
 pf_checkpoint_path = "data/pfMOEAD.csv"
+ucb_checkpoint_path = "data/UCBPolicyMOEAD.csv"
 
 
 def main():
 
     operators = [SimpleBinaryMutation(), SimpleMutation(), SimpleCrossover(), RandomSplitCrossover()]
-    policy = RandomPolicy(operators)
+    policy = UCBPolicy(operators, _C=100)
 
     # pass list of evaluators
     algo = MOEAD(20, 5, init, [evaluator1, evaluator2, evaluator2, evaluator2], operators, policy, validator, _maximise=True)
-    print(algo.weights)
+    
     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)
 

+ 0 - 12
macop/algorithms/Algorithm.py

@@ -70,18 +70,6 @@ class Algorithm():
         # set as new
         self.callbacks.append(_callback)
 
-    def setCheckpoint(self, _callback):
-        """Set checkpoint instance directly
-        Args:
-            _callback: {Callback} -- Callback instance used for checkpoint
-        """
-        # specify current main algorithm reference if necessary
-        if _callback.algo is None:
-            _callback.setAlgo(self)
-
-        # set as checkpoint
-        self.checkpoint = _callback
-
     def resume(self):
         """Resume algorithm using Callback instances
         """

+ 89 - 0
macop/callbacks/UCBCheckpoint.py

@@ -0,0 +1,89 @@
+"""UCB policy Checkpoint class implementation
+"""
+
+# main imports
+import os
+import logging
+import numpy as np
+import pkgutil
+
+# module imports
+from .Callback import Callback
+from ..utils.color import macop_text, macop_line
+
+
+class UCBCheckpoint(Callback):
+    """
+    UCB checkpoint is used for loading previous UCB data and start again after loading checkpoint
+    Need to be the same operators used during previous run
+
+    Attributes:
+        algo: {Algorithm} -- main algorithm instance reference
+        every: {int} -- checkpoint frequency used (based on number of evaluations)
+        filepath: {str} -- file path where checkpoints will be saved
+    """
+    def run(self):
+        """
+        Check if necessary to do backup based on `every` variable
+        """
+        # get current population
+        currentEvaluation = self.algo.getGlobalEvaluation()
+
+        # backup if necessary
+        if currentEvaluation % self.every == 0:
+
+            logging.info("UCB Checkpoint is done into " + self.filepath)
+
+            with open(self.filepath, 'w') as f:
+
+                rewardsLine = ''
+
+                for i, r in enumerate(self.algo.policy.rewards):
+                    rewardsLine += str(r)
+
+                    if i != len(self.algo.policy.rewards) - 1:
+                        rewardsLine += ';'
+
+                f.write(rewardsLine + '\n')
+
+                occurrencesLine = ''
+
+                for i, o in enumerate(self.algo.policy.occurrences):
+                    occurrencesLine += str(o)
+
+                    if i != len(self.algo.policy.occurrences) - 1:
+                        occurrencesLine += ';'
+
+                f.write(occurrencesLine + '\n')
+
+    def load(self):
+        """
+        Load backup lines as rewards and occurrences for UCB
+        """
+        if os.path.exists(self.filepath):
+
+            logging.info('Load UCB data')
+            with open(self.filepath) as f:
+
+                lines = f.readlines()
+                # read data for each line
+                rewardsLine = lines[0].replace('\n', '')
+                occurenciesLine = lines[0].replace('\n', '')
+
+                self.algo.policy.rewards = [
+                    float(f) for f in rewardsLine.split(';')
+                ]
+                self.algo.policy.occurencies = [
+                    float(f) for f in occurenciesLine.split(';')
+                ]
+
+            print(
+                macop_text(
+                    'Load of available UCB policy data from `{}`'.format(
+                        self.filepath)))
+
+        else:
+            print(macop_text('No UCB data found, use default UCB policy'))
+            logging.info("No UCB data found...")
+
+        print(macop_line())

+ 17 - 9
macop/operators/policies/UCBPolicy.py

@@ -4,6 +4,7 @@
 import logging
 import random
 import math
+import numpy as np
 
 # module imports
 from .Policy import Policy
@@ -15,14 +16,16 @@ class UCBPolicy(Policy):
     Attributes:
         operators: {[Operator]} -- list of selected operators for the algorithm
         C: {float} -- tradeoff between EvE parameter for UCB
+        exp_rate: {float} -- exploration rate (probability to choose randomly next operator)
         rewards: {[float]} -- list of summed rewards obtained for each operator
-        occurences: {[int]} -- number of use (selected) of each operator
+        occurrences: {[int]} -- number of use (selected) of each operator
     """
-    def __init__(self, _operators, _C=100.):
+    def __init__(self, _operators, _C=100., _exp_rate=0.5):
         self.operators = _operators
         self.rewards = [0. for o in self.operators]
-        self.occurences = [0 for o in self.operators]
+        self.occurrences = [0 for o in self.operators]
         self.C = _C
+        self.exp_rate = _exp_rate
 
     def select(self):
         """Select randomly the next operator to use
@@ -31,18 +34,23 @@ class UCBPolicy(Policy):
             {Operator}: the selected operator
         """
 
-        indices = [i for i, o in enumerate(self.occurences) if o == 0]
+        indices = [i for i, o in enumerate(self.occurrences) if o == 0]
 
-        # if operator have at least be used one time
-        if len(indices) == 0:
+        # random choice following exploration rate
+        if np.random.uniform(0, 1) <= self.exp_rate:
 
+            return self.operators[random.choice(range(len(self.operators)))]
+
+        elif len(indices) == 0:
+
+            # if operator have at least be used one time
             ucbValues = []
-            nVisits = sum(self.occurences)
+            nVisits = sum(self.occurrences)
 
             for i in range(len(self.operators)):
 
                 ucbValue = self.rewards[i] + self.C * math.sqrt(
-                    math.log(nVisits) / self.occurences[i])
+                    math.log(nVisits) / (self.occurrences[i] + 0.1))
                 ucbValues.append(ucbValue)
 
             return self.operators[ucbValues.index(max(ucbValues))]
@@ -83,7 +91,7 @@ class UCBPolicy(Policy):
         if fir > 0:
             operator_index = self.operators.index(operator)
             self.rewards[operator_index] += fir
-            self.occurences[operator_index] += 1
+            self.occurrences[operator_index] += 1
 
         logging.info("---- Obtaining %s" % (_solution))
 

+ 1 - 1
setup.py

@@ -23,7 +23,7 @@ class TestCommand(distutils.command.check.check):
 
 setup(
     name='macop',
-    version='0.2.0',
+    version='0.2.1',
     description='Minimalist And Customizable Optimization Package',
     long_description=open('README.md').read(),
     long_description_content_type='text/markdown',