Преглед на файлове

start of MOEAD implementation

Jérôme BUISINE преди 3 години
родител
ревизия
f358eca024

BIN
docs/build/doctrees/environment.pickle


BIN
docs/build/doctrees/examples.doctree


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


+ 5 - 16
docs/build/html/_modules/macop/algorithms/Algorithm.html

@@ -172,8 +172,7 @@
 <span class="sd">        maximise: {bool} -- specify kind of optimization problem </span>
 <span class="sd">        currentSolution: {Solution} -- current solution managed for current evaluation</span>
 <span class="sd">        bestSolution: {Solution} -- best solution found so far during running algorithm</span>
-<span class="sd">        callbacks: {[Callback]} -- list of Callback class implementation to </span>
-<span class="sd">        checkpoint: {Callback} -- Callback class implementation to keep track of algorithm and restart</span>
+<span class="sd">        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and when initializing algorithm</span>
 <span class="sd">        parent: {Algorithm} -- parent algorithm reference in case of inner Algorithm instance (optional)</span>
 <span class="sd">    &quot;&quot;&quot;</span>
     <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
@@ -191,7 +190,6 @@
         <span class="bp">self</span><span class="o">.</span><span class="n">policy</span> <span class="o">=</span> <span class="n">_policy</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">validator</span> <span class="o">=</span> <span class="n">_validator</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">callbacks</span> <span class="o">=</span> <span class="p">[]</span>
-        <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span> <span class="o">=</span> <span class="kc">None</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">bestSolution</span> <span class="o">=</span> <span class="kc">None</span>
 
         <span class="c1"># by default</span>
@@ -238,21 +236,12 @@
         <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 checkpoint instance</span>
+        <span class="sd">&quot;&quot;&quot;Resume algorithm using Callback instances</span>
 <span class="sd">        &quot;&quot;&quot;</span>
-        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
-            <span class="nb">print</span><span class="p">(</span><span class="n">macop_line</span><span class="p">())</span>
-            <span class="nb">print</span><span class="p">(</span>
-                <span class="n">macop_text</span><span class="p">(</span>
-                    <span class="s2">&quot;Need to `addCheckpoint` or `setCheckpoint` is you want to use this process&quot;</span>
-                <span class="p">))</span>
 
-        <span class="k">else</span><span class="p">:</span>
-            <span class="nb">print</span><span class="p">(</span><span class="n">macop_line</span><span class="p">())</span>
-            <span class="nb">print</span><span class="p">(</span>
-                <span class="n">macop_text</span><span class="p">(</span><span class="s1">&#39;Checkpoint found from `</span><span class="si">{}</span><span class="s1">` file.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
-                    <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span><span class="o">.</span><span class="n">filepath</span><span class="p">)))</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span><span class="o">.</span><span class="n">load</span><span class="p">()</span></div>
+        <span class="c1"># load every callback if many things are necessary to do before running algorithm</span>
+        <span class="k">for</span> <span class="n">callback</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">callbacks</span><span class="p">:</span>
+            <span class="n">callback</span><span class="o">.</span><span class="n">load</span><span class="p">()</span></div>
 
 <div class="viewcode-block" id="Algorithm.initRun"><a class="viewcode-back" href="../../../macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.initRun">[docs]</a>    <span class="k">def</span> <span class="nf">initRun</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
         <span class="sd">&quot;&quot;&quot;</span>

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

@@ -191,9 +191,8 @@
         <span class="c1"># by default use of mother method to initialize variables</span>
         <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">_evaluations</span><span class="p">)</span>
 
-        <span class="c1"># enable checkpoint for ILS</span>
-        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
-            <span class="bp">self</span><span class="o">.</span><span class="n">resume</span><span class="p">()</span>
+        <span class="c1"># enable resuming for ILS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resume</span><span class="p">()</span>
 
         <span class="c1"># passing global evaluation param from ILS</span>
         <span class="n">ls</span> <span class="o">=</span> <span class="n">LocalSearch</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initializer</span><span class="p">,</span>
@@ -204,10 +203,6 @@
                          <span class="bp">self</span><span class="o">.</span><span class="n">maximise</span><span class="p">,</span>
                          <span class="n">_parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
 
-        <span class="c1"># set same checkpoint if exists</span>
-        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
-            <span class="n">ls</span><span class="o">.</span><span class="n">setCheckpoint</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">checkpoint</span><span class="p">)</span>
-
         <span class="c1"># add same callbacks</span>
         <span class="k">for</span> <span class="n">callback</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">callbacks</span><span class="p">:</span>
             <span class="n">ls</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="n">callback</span><span class="p">)</span>

+ 5 - 0
docs/build/html/_modules/macop/callbacks/BasicCheckpoint.html

@@ -234,6 +234,11 @@
                 <span class="bp">self</span><span class="o">.</span><span class="n">algo</span><span class="o">.</span><span class="n">bestSolution</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">solutionData</span><span class="p">)</span>
                 <span class="bp">self</span><span class="o">.</span><span class="n">algo</span><span class="o">.</span><span class="n">bestSolution</span><span class="o">.</span><span class="n">score</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
 
+            <span class="nb">print</span><span class="p">(</span><span class="n">macop_line</span><span class="p">())</span>
+            <span class="nb">print</span><span class="p">(</span>
+                <span class="n">macop_text</span><span class="p">(</span><span class="s1">&#39;Checkpoint found from `</span><span class="si">{}</span><span class="s1">` file.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">filepath</span><span class="p">)))</span>
+
             <span class="nb">print</span><span class="p">(</span>
                 <span class="n">macop_text</span><span class="p">(</span><span class="s1">&#39;Restart algorithm from evaluation </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="bp">self</span><span class="o">.</span><span class="n">algo</span><span class="o">.</span><span class="n">numberOfEvaluations</span><span class="p">)))</span>

+ 15 - 7
docs/build/html/_sources/examples.rst.txt

@@ -201,7 +201,7 @@ We can now instanciate our algorithm. We use the Iterated Local Search in this e
     ...
 
     if not os.path.exists('data'):
-    os.makedirs('data')
+        os.makedirs('data')
 
     # logging configuration
     logging.basicConfig(format='%(asctime)s %(message)s', filename='data/example.log', level=logging.DEBUG)
@@ -209,9 +209,12 @@ We can now instanciate our algorithm. We use the Iterated Local Search in this e
     algo = ILS(init, evaluator, operators, policy, validator, _maximise=True)
 
 The algorithm is now well defined and is ready to run ! But one thing can be done, and it's very interesting to avoir restart from scratch the algorithm run.
-The use of checkpoint is available in `macop`. A `BasicCheckpoint` class let the algorithm save at `every` evaluations the best solution found.
+The use of checkpoint is available in `macop`. A `BasicCheckpoint` class let the algorithm save at `every` evaluations the best solution found. This class is based on callback process. 
+A Callback is runned every number of evaluations but can also implement the `load` method in order to to specific instrusctions when initializing algorithm.
+
+It's important to note, we can add any number of callbacks we want. For tabu search as example, we need to store many solutions.
 
-We need to specify the use of checkpoint if we prefer to restart from.
+In our case, we need to specify the use of checkpoint if we prefer to restart from.
 
 .. code:: python
     
@@ -223,7 +226,7 @@ We need to specify the use of checkpoint if we prefer to restart from.
     import logging
 
     from macop.algorithms.mono.IteratedLocalSearch import IteratedLocalSearch as ILS
-    from macop.checkpoints.BasicCheckpoint import BasicCheckpoint
+    from macop.callbacks.BasicCheckpoint import BasicCheckpoint
 
     """
     Problem definition
@@ -236,15 +239,20 @@ We need to specify the use of checkpoint if we prefer to restart from.
     ...
 
     if not os.path.exists('data'):
-    os.makedirs('data')
+        os.makedirs('data')
 
     # logging configuration
     logging.basicConfig(format='%(asctime)s %(message)s', filename='data/example.log', level=logging.DEBUG)
 
     algo = ILS(init, evaluator, operators, policy, validator, _maximise=True)
 
-    # we specify the checkpoint class directly, the frequency and the path we want to save algorithm evolution
-    algo.addCheckpoint(_class=BasicCheckpoint, _every=5, _filepath='data/checkpoint.csv')
+    # create instance of BasicCheckpoint callback
+    callback = BasicCheckpoint(_every=5, _filepath='data/checkpoint.csv')
+
+    # Add this callback instance into list of callback
+    # It tells the algorithm to apply this callback every 5 evaluations
+    # And also the algorithm to load checkpoint if exists before running by using `load` method of callback
+    algo.addCallback(callback)
 
 
 In this way, now we can run and obtained the best solution found in `n` evaluations

Файловите разлики са ограничени, защото са твърде много
+ 14 - 7
docs/build/html/examples.html


+ 1 - 3
docs/build/html/genindex.html

@@ -249,11 +249,9 @@
 </li>
       <li><a href="macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.callbacks">callbacks (macop.algorithms.Algorithm.Algorithm attribute)</a>
 </li>
-      <li><a href="macop/macop.algorithms.Algorithm.html#macop.algorithms.Algorithm.Algorithm.checkpoint">checkpoint (macop.algorithms.Algorithm.Algorithm attribute)</a>
+      <li><a href="macop/macop.algorithms.mono.IteratedLocalSearch.html#macop.algorithms.mono.IteratedLocalSearch.IteratedLocalSearch.checkpoint">checkpoint (macop.algorithms.mono.IteratedLocalSearch.IteratedLocalSearch attribute)</a>
 
       <ul>
-        <li><a href="macop/macop.algorithms.mono.IteratedLocalSearch.html#macop.algorithms.mono.IteratedLocalSearch.IteratedLocalSearch.checkpoint">(macop.algorithms.mono.IteratedLocalSearch.IteratedLocalSearch attribute)</a>
-</li>
         <li><a href="macop/macop.algorithms.mono.LocalSearch.html#macop.algorithms.mono.LocalSearch.LocalSearch.checkpoint">(macop.algorithms.mono.LocalSearch.LocalSearch attribute)</a>
 </li>
       </ul></li>

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

@@ -241,13 +241,7 @@
 <dl class="attribute">
 <dt id="macop.algorithms.Algorithm.Algorithm.callbacks">
 <code class="sig-name descname">callbacks</code><a class="headerlink" href="#macop.algorithms.Algorithm.Algorithm.callbacks" title="Permalink to this definition">¶</a></dt>
-<dd><p>{[Callback]} – list of Callback class implementation to</p>
-</dd></dl>
-
-<dl class="attribute">
-<dt id="macop.algorithms.Algorithm.Algorithm.checkpoint">
-<code class="sig-name descname">checkpoint</code><a class="headerlink" href="#macop.algorithms.Algorithm.Algorithm.checkpoint" title="Permalink to this definition">¶</a></dt>
-<dd><p>{Callback} – Callback class implementation to keep track of algorithm and restart</p>
+<dd><p>{[Callback]} – list of Callback class implementation to do some instructions every number of evaluations and when initializing algorithm</p>
 </dd></dl>
 
 <dl class="attribute">
@@ -348,7 +342,7 @@
 <dl class="method">
 <dt id="macop.algorithms.Algorithm.Algorithm.resume">
 <code class="sig-name descname">resume</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/macop/algorithms/Algorithm.html#Algorithm.resume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#macop.algorithms.Algorithm.Algorithm.resume" title="Permalink to this definition">¶</a></dt>
-<dd><p>Resume algorithm using Callback checkpoint instance</p>
+<dd><p>Resume algorithm using Callback instances</p>
 </dd></dl>
 
 <dl class="method">

BIN
docs/build/html/objects.inv


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
docs/build/html/searchindex.js


+ 15 - 7
docs/source/examples.rst

@@ -201,7 +201,7 @@ We can now instanciate our algorithm. We use the Iterated Local Search in this e
     ...
 
     if not os.path.exists('data'):
-    os.makedirs('data')
+        os.makedirs('data')
 
     # logging configuration
     logging.basicConfig(format='%(asctime)s %(message)s', filename='data/example.log', level=logging.DEBUG)
@@ -209,9 +209,12 @@ We can now instanciate our algorithm. We use the Iterated Local Search in this e
     algo = ILS(init, evaluator, operators, policy, validator, _maximise=True)
 
 The algorithm is now well defined and is ready to run ! But one thing can be done, and it's very interesting to avoir restart from scratch the algorithm run.
-The use of checkpoint is available in `macop`. A `BasicCheckpoint` class let the algorithm save at `every` evaluations the best solution found.
+The use of checkpoint is available in `macop`. A `BasicCheckpoint` class let the algorithm save at `every` evaluations the best solution found. This class is based on callback process. 
+A Callback is runned every number of evaluations but can also implement the `load` method in order to to specific instrusctions when initializing algorithm.
+
+It's important to note, we can add any number of callbacks we want. For tabu search as example, we need to store many solutions.
 
-We need to specify the use of checkpoint if we prefer to restart from.
+In our case, we need to specify the use of checkpoint if we prefer to restart from.
 
 .. code:: python
     
@@ -223,7 +226,7 @@ We need to specify the use of checkpoint if we prefer to restart from.
     import logging
 
     from macop.algorithms.mono.IteratedLocalSearch import IteratedLocalSearch as ILS
-    from macop.checkpoints.BasicCheckpoint import BasicCheckpoint
+    from macop.callbacks.BasicCheckpoint import BasicCheckpoint
 
     """
     Problem definition
@@ -236,15 +239,20 @@ We need to specify the use of checkpoint if we prefer to restart from.
     ...
 
     if not os.path.exists('data'):
-    os.makedirs('data')
+        os.makedirs('data')
 
     # logging configuration
     logging.basicConfig(format='%(asctime)s %(message)s', filename='data/example.log', level=logging.DEBUG)
 
     algo = ILS(init, evaluator, operators, policy, validator, _maximise=True)
 
-    # we specify the checkpoint class directly, the frequency and the path we want to save algorithm evolution
-    algo.addCheckpoint(_class=BasicCheckpoint, _every=5, _filepath='data/checkpoint.csv')
+    # create instance of BasicCheckpoint callback
+    callback = BasicCheckpoint(_every=5, _filepath='data/checkpoint.csv')
+
+    # Add this callback instance into list of callback
+    # It tells the algorithm to apply this callback every 5 evaluations
+    # And also the algorithm to load checkpoint if exists before running by using `load` method of callback
+    algo.addCallback(callback)
 
 
 In this way, now we can run and obtained the best solution found in `n` evaluations

+ 0 - 3
knapsackExample.py

@@ -70,9 +70,6 @@ def main():
     # add callback into callback list
     algo.addCallback(callback)
 
-    # set this callback as checkpoint too
-    algo.setCheckpoint(callback)
-
     bestSol = algo.run(1000)
 
     print('Solution score is {}'.format(evaluator(bestSol)))

+ 1 - 1
knapsackMultiExample.py

@@ -76,7 +76,7 @@ def main():
 
     # pass list of evaluators
     algo = MOEAD(20, 5, init, [evaluator1, evaluator2], operators, policy, validator, _maximise=True)
-    algo.addCheckpoint(_class=BasicCheckpoint, _every=5, _filepath=filepath)
+    algo.addCallback(MultiCheckpoint(_every=5, _filepath=filepath))
 
     bestSol = algo.run(1000)
     bestSol = algo.run(1000)

+ 5 - 16
macop/algorithms/Algorithm.py

@@ -19,8 +19,7 @@ class Algorithm():
         maximise: {bool} -- specify kind of optimization problem 
         currentSolution: {Solution} -- current solution managed for current evaluation
         bestSolution: {Solution} -- best solution found so far during running algorithm
-        callbacks: {[Callback]} -- list of Callback class implementation to 
-        checkpoint: {Callback} -- Callback class implementation to keep track of algorithm and restart
+        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and `load` when initializing algorithm
         parent: {Algorithm} -- parent algorithm reference in case of inner Algorithm instance (optional)
     """
     def __init__(self,
@@ -38,7 +37,6 @@ class Algorithm():
         self.policy = _policy
         self.validator = _validator
         self.callbacks = []
-        self.checkpoint = None
         self.bestSolution = None
 
         # by default
@@ -85,21 +83,12 @@ class Algorithm():
         self.checkpoint = _callback
 
     def resume(self):
-        """Resume algorithm using Callback checkpoint instance
+        """Resume algorithm using Callback instances
         """
-        if self.checkpoint is None:
-            print(macop_line())
-            print(
-                macop_text(
-                    "Need to `addCheckpoint` or `setCheckpoint` is you want to use this process"
-                ))
 
-        else:
-            print(macop_line())
-            print(
-                macop_text('Checkpoint found from `{}` file.'.format(
-                    self.checkpoint.filepath)))
-            self.checkpoint.load()
+        # load every callback if many things are necessary to do before running algorithm
+        for callback in self.callbacks:
+            callback.load()
 
     def initRun(self):
         """

+ 3 - 8
macop/algorithms/mono/IteratedLocalSearch.py

@@ -21,7 +21,7 @@ class IteratedLocalSearch(Algorithm):
         maximise: {bool} -- specify kind of optimization problem 
         currentSolution: {Solution} -- current solution managed for current evaluation
         bestSolution: {Solution} -- best solution found so far during running algorithm
-        checkpoint: {Checkpoint} -- Checkpoint class implementation to keep track of algorithm and restart
+        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and `load` when initializing algorithm
     """
     def run(self, _evaluations, _ls_evaluations=100):
         """
@@ -38,9 +38,8 @@ class IteratedLocalSearch(Algorithm):
         # by default use of mother method to initialize variables
         super().run(_evaluations)
 
-        # enable checkpoint for ILS
-        if self.checkpoint is not None:
-            self.resume()
+        # enable resuming for ILS
+        self.resume()
 
         # passing global evaluation param from ILS
         ls = LocalSearch(self.initializer,
@@ -51,10 +50,6 @@ class IteratedLocalSearch(Algorithm):
                          self.maximise,
                          _parent=self)
 
-        # set same checkpoint if exists
-        if self.checkpoint is not None:
-            ls.setCheckpoint(self.checkpoint)
-
         # add same callbacks
         for callback in self.callbacks:
             ls.addCallback(callback)

+ 1 - 1
macop/algorithms/mono/LocalSearch.py

@@ -20,7 +20,7 @@ class LocalSearch(Algorithm):
         maximise: {bool} -- specify kind of optimization problem 
         currentSolution: {Solution} -- current solution managed for current evaluation
         bestSolution: {Solution} -- best solution found so far during running algorithm
-        checkpoint: {Checkpoint} -- Checkpoint class implementation to keep track of algorithm and restart
+        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and `load` when initializing algorithm
     """
     def run(self, _evaluations):
         """

+ 38 - 23
macop/algorithms/multi/MOEAD.py

@@ -10,6 +10,15 @@ import numpy as np
 from ..Algorithm import Algorithm
 from .MOSubProblem import MOSubProblem
 
+def moEvaluator(_solution, _evaluator, _weights):
+
+    scores = [ eval(_solution) for eval in _evaluator ]
+
+    # associate objectives scores to solution
+    _solution.scores = scores
+
+    return sum([scores[i] for i, w in enumerate(_weights) ])
+
 
 class MOEAD(Algorithm):
     """Multi-Ojective Evolutionary Algorithm with Scalar Decomposition
@@ -25,7 +34,7 @@ class MOEAD(Algorithm):
         maximise: {bool} -- specify kind of optimization problem 
         currentSolution: {Solution} -- current solution managed for current evaluation
         bestSolution: {Solution} -- best solution found so far during running algorithm
-        checkpoint: {Checkpoint} -- Checkpoint class implementation to keep track of algorithm and restart
+        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and `load` when initializing algorithm
     """
     def __init__(self,
                  _mu,
@@ -44,8 +53,7 @@ class MOEAD(Algorithm):
         self.operators = _operators
         self.policy = _policy
         self.validator = _validator
-        self.checkpoint = None
-        self.bestSolution = None
+        self.callbacks = []
 
         # by default
         self.numberOfEvaluations = 0
@@ -66,6 +74,7 @@ class MOEAD(Algorithm):
 
         if _mu < _T:
             raise ValueError('`mu` cannot be less than `T`')
+
         self.mu = _mu
         self.T = _T
 
@@ -82,34 +91,25 @@ class MOEAD(Algorithm):
         for i in range(self.mu):
 
             # compute weight sum from solution
-            sub_evaluator = lambda _solution: sum(
-                list([
-                    eval(_solution) * weights[i][w_i]
-                    for w_i, eval in enumerate(_evaluator)
-                ]))
+            sub_evaluator = lambda _solution: moEvaluator(_solution, _evaluator, weights[i])
 
+            # intialize each sub problem
             subProblem = MOSubProblem(i, weights[i], _initalizer,
                                       sub_evaluator, _operators, _policy,
                                       _validator, _maximise, self)
+
             self.subProblems.append(subProblem)
 
         self.population = [None for n in range(self.mu)]
-
-        # no need to initialize using sub problem
-        # self.initRun()
+        self.refPoint = (0., 0.)
+        
 
     def initRun(self):
         """
         Method which initialiazes or re-initializes the whole algorithm context specifically for MOEAD
         """
-
-        self.currentSolution = self.initializer()
-
-        # evaluate current solution
-        self.subProblems[0].run(1)
-
-        # keep in memory best known solution (current solution)
-        self.bestSolution = self.subProblems[0].bestSolution
+        # initialization is done during run method
+        pass
 
     def run(self, _evaluations):
         """
@@ -125,9 +125,8 @@ class MOEAD(Algorithm):
         # by default use of mother method to initialize variables
         super().run(_evaluations)
 
-        # enable checkpoint for MOEAD
-        if self.checkpoint is not None:
-            self.resume()
+        # enable callback resume for MOEAD
+        self.resume()
 
         # initialize each sub problem
         for i in range(self.mu):
@@ -142,13 +141,18 @@ class MOEAD(Algorithm):
 
                 # run 1 iteration into sub problem `i`
                 self.subProblems[i].run(1)
+                spBestSolution = self.subProblems[i].bestSolution
+
+                self.updateMinRefPoint(spBestSolution)
+
+
 
                 # stop algorithm if necessary
                 if self.stop():
                     break
 
         logging.info("End of %s, best solution found %s" %
-                     (type(self).__name__, self.bestSolution))
+                     (type(self).__name__, self.population))
 
         self.end()
 
@@ -179,3 +183,14 @@ class MOEAD(Algorithm):
         for direction in range(self.mu - dmax, self.mu):
             for i in range(self.mu - self.T, self.mu):
                 self.neighbors[direction].append(i)
+
+
+    def updateMinRefPoint(self, _solution):
+        pass
+
+    def nonDominated():
+        pass
+
+    def __str__(self):
+        return "%s using %s" % (type(self).__name__, type(
+            self.population).__name__)

+ 1 - 1
macop/algorithms/multi/MOSubProblem.py

@@ -22,7 +22,7 @@ class MOSubProblem(Algorithm):
         maximise: {bool} -- specify kind of optimization problem 
         currentSolution: {Solution} -- current solution managed for current evaluation
         bestSolution: {Solution} -- best solution found so far during running algorithm
-        checkpoint: {Checkpoint} -- Checkpoint class implementation to keep track of algorithm and restart
+        callbacks: {[Callback]} -- list of Callback class implementation to do some instructions every number of evaluations and `load` when initializing algorithm
     """
     def __init__(self,
                  _index,

+ 5 - 0
macop/callbacks/BasicCheckpoint.py

@@ -81,6 +81,11 @@ class BasicCheckpoint(Callback):
                 self.algo.bestSolution.data = np.array(solutionData)
                 self.algo.bestSolution.score = float(data[2])
 
+            print(macop_line())
+            print(
+                macop_text('Checkpoint found from `{}` file.'.format(
+                    self.filepath)))
+
             print(
                 macop_text('Restart algorithm from evaluation {}.'.format(
                     self.algo.numberOfEvaluations)))

+ 1 - 1
macop/callbacks/MultiCheckpoint.py

@@ -11,7 +11,7 @@ from .Callback import Callback
 from ..utils.color import macop_text, macop_line
 
 
-class BasicCheckpoint(Callback):
+class MultiCheckpoint(Callback):
     """
     BasicCheckpoint is used for loading previous computations and start again after loading checkpoint