diff --git a/docs/source/tutorials/index.rst b/docs/source/tutorials/index.rst
index fed3c4f8c..accffdfb9 100644
--- a/docs/source/tutorials/index.rst
+++ b/docs/source/tutorials/index.rst
@@ -5,5 +5,5 @@ Tutorials
:glob:
:maxdepth: 1
- optimizers
- tuners
+ optimisation
+ tuning
diff --git a/docs/source/tutorials/optimizers.rst b/docs/source/tutorials/optimisation.rst
similarity index 67%
rename from docs/source/tutorials/optimizers.rst
rename to docs/source/tutorials/optimisation.rst
index 9330ce464..abfb3e1f1 100644
--- a/docs/source/tutorials/optimizers.rst
+++ b/docs/source/tutorials/optimisation.rst
@@ -1,10 +1,13 @@
.. role:: raw-html-m2r(raw)
:format: html
-Optimizers
-==========
+Optimisation
+============
-To solve the optimization problem, 4 optimizers are available in GEFEST - 2 native and 2 based on GOLEM.
+Optimisers summary
+------------------
+
+To solve the optimisation problem, 4 optimisers are available in GEFEST - 1 native and 2 based on GOLEM.
All of them have a single interface and can be imported from ``gefest.tools.optimizers``.
.. list-table:: Optimizers comparation
@@ -12,62 +15,60 @@ All of them have a single interface and can be imported from ``gefest.tools.opti
* -
- ``BaseGA``
- - ``SPEA2``
- ``StandardOptimizer``
- ``SurrogateOptimizer``
* - **Backend**
- - GEFEST
- GEFEST
- GOLEM
- GOLEM
* - **Muti objective**
- - :raw-html-m2r:`No
`
- :raw-html-m2r:`Yes
`
- :raw-html-m2r:`Yes
`
- :raw-html-m2r:`Yes
`
* - **Evolutionary schemes**
- - :raw-html-m2r:`No
`
- :raw-html-m2r:`No
`
- :raw-html-m2r:`Yes
`
- :raw-html-m2r:`Yes
`
* - **Adaptive mutation strategies**
- - :raw-html-m2r:`No
`
- :raw-html-m2r:`No
`
- :raw-html-m2r:`Yes
`
- :raw-html-m2r:`Yes
`
- * - **Surrogate optimization**
- - :raw-html-m2r:`No
`
+ * - **Surrogate optimisation**
- :raw-html-m2r:`No
`
- :raw-html-m2r:`No
`
- :raw-html-m2r:`Yes
`
-Some details
-------------
``BaseGA`` implements the base genetic algorithm, that performs generation of the initial population,
crossover and mutation operations, fitness estimation and selection.
Each of the steps is encapsulated in a separate executor, which allows you to change the logic of individual steps.
-Thus, BaseGA essentially only implements the sequence of their call.
-
-``SPEA2`` implements Strength Pareto Evolutionary Algorithm 2 for multiobjective optimization.
+Thus, BaseGA essentially only implements the sequence of their call.
-``StandardOptimizer`` is a wrapper for GOLEM`s ``EvoGraphOptimizer`` optimizer.
+``StandardOptimizer`` is a wrapper for GOLEM`s ``EvoGraphOptimizer`` optimiser.
It allows to select different evolutionary schemes, adaptive mutation strategies and some other features.
-To use multiobjective optimization set `golem_selection_type` in ``OptimizationParams`` config to 'spea2'.
+To use multiobjective optimisation set `golem_selection_type` in ``OptimizationParams`` config to 'spea2'.
``SurrogateOptimizer`` is the extension of ``StandardOptimizer`` with the ability
to use a surrogate model to evaluate fitness along with the main estimator.
-How to run
-----------
+Selectors summary
+-----------------
+
+``OptimizationParams`` have 3 parameters to configure selection strategy:
+ * ``golem_selection_type`` defines which selection function will be used by GOLEM optimisers. Available values: 'spea2' for multi objective and 'tournament' for single objective problems.
+ * ``selector`` defines which selection function will be used by GEFEST for single objective problems and also for multi objective fitnesses if it possible. Available values: 'tournament_selection' and 'roulette_selection'.
+ * ``multiobjective_selector`` defines which selection function will be used by GEFEST for multiobjective problems. Available values: 'spea2' and 'moead'.
-Easiest way to run optimizer described in :ref:`quickstart`.
+How to optimise
+---------------
+
+Easiest way to run optimiser described in :ref:`quickstart`.
If you want to get some more control you can do it in code by import corresponding classes:
.. code-block:: python
- from gefest.tools.optimizers BaseGA, SPEA2, StandardOptimizer, SurrogateOptimizer
+ from gefest.tools.optimizers BaseGA, StandardOptimizer, SurrogateOptimizer
from gefest.core.configs.optimization_params import OptimizationParams
from gefest.core.geometry.datastructs.structure import Structure
@@ -76,3 +77,6 @@ If you want to get some more control you can do it in code by import correspondi
optimizer = BaseGA(opt_params)
optimized_population = optimizer.optimize(n_steps=42)
+
+By default initial population generates automatically with sampler from `opt_params`.
+It also can be provided as optional argument for optimiser constructor.
diff --git a/docs/source/tutorials/tuners.rst b/docs/source/tutorials/tuning.rst
similarity index 96%
rename from docs/source/tutorials/tuners.rst
rename to docs/source/tutorials/tuning.rst
index af74332c6..298f87d85 100644
--- a/docs/source/tutorials/tuners.rst
+++ b/docs/source/tutorials/tuning.rst
@@ -1,9 +1,12 @@
.. role:: raw-html-m2r(raw)
:format: html
-Tuners
+Tuning
======
+Tuners
+------
+
GEFEST provides api for 4 tuners from `GOLEM `_\ :
.. list-table:: Tuners comparation
@@ -19,7 +22,7 @@ GEFEST provides api for 4 tuners from `GOLEM `_
- `Optuna `_
- `Hyperopt `_
@@ -30,11 +33,10 @@ GEFEST provides api for 4 tuners from `GOLEM No`
- :raw-html-m2r:`No
`
-
How to tune
-----------
-To initialize tuner and run tuning, similarly to the optimizers, you need an ``OptimizationParams``
+To initialize tuner and run tuning, similarly to the optimisers, you need an ``OptimizationParams``
with defined ``TunerParams`` and also one or more ``Structure`` objects.
More details about ``OptimizationParams`` you can find in `cases` and `API referece` sections of this documentation.
diff --git a/gefest/tools/optimizers/golem_optimizer/standard.py b/gefest/tools/optimizers/golem_optimizer/standard.py
index 75320676d..901788852 100644
--- a/gefest/tools/optimizers/golem_optimizer/standard.py
+++ b/gefest/tools/optimizers/golem_optimizer/standard.py
@@ -2,6 +2,8 @@
from typing import TYPE_CHECKING
+from gefest.core.geometry import Structure
+
if TYPE_CHECKING:
from gefest.core.configs.optimization_params import OptimizationParams
@@ -23,7 +25,7 @@ class StandardOptimizer(Optimizer):
"""
- def __init__(self, opt_params: OptimizationParams, **kwargs) -> None:
+ def __init__(self, opt_params: OptimizationParams, initial_population=None, **kwargs) -> None:
super().__init__(opt_params.log_dispatcher, **kwargs)
self.opt_params = opt_params
self.objective = Objective(
@@ -33,9 +35,14 @@ def __init__(self, opt_params: OptimizationParams, **kwargs) -> None:
self.requirements = map_into_graph_requirements(opt_params)
self.ggp = map_into_graph_generation_params(opt_params)
self.gpa = map_into_gpa(opt_params)
- self.initial_pop = list(
- map(opt_params.golem_adapter.adapt, opt_params.sampler(opt_params.pop_size)),
- )
+
+ if initial_population:
+ self.initial_pop = initial_population
+ else:
+ self.initial_pop: list[Structure] = list(
+ map(opt_params.golem_adapter.adapt, opt_params.sampler(opt_params.pop_size)),
+ )
+
self.__standard_opt = EvoGraphOptimizer(
objective=self.objective,
initial_graphs=self.initial_pop,
diff --git a/gefest/tools/optimizers/golem_optimizer/surrogate.py b/gefest/tools/optimizers/golem_optimizer/surrogate.py
index f9a29aae9..e07b7468d 100644
--- a/gefest/tools/optimizers/golem_optimizer/surrogate.py
+++ b/gefest/tools/optimizers/golem_optimizer/surrogate.py
@@ -25,7 +25,7 @@ class SurrogateOptimizer(Optimizer):
"""
- def __init__(self, opt_params: OptimizationParams, **kwargs) -> None:
+ def __init__(self, opt_params: OptimizationParams, initial_population=None, **kwargs) -> None:
super().__init__(opt_params.log_dispatcher, **kwargs)
self.opt_params = opt_params
self.objective = Objective(
@@ -35,9 +35,14 @@ def __init__(self, opt_params: OptimizationParams, **kwargs) -> None:
self.requirements = map_into_graph_requirements(opt_params)
self.ggp = map_into_graph_generation_params(opt_params)
self.gpa = map_into_gpa(opt_params)
- self.initial_pop = list(
- map(opt_params.golem_adapter.adapt, opt_params.sampler(opt_params.pop_size)),
- )
+
+ if initial_population:
+ self.initial_pop = initial_population
+ else:
+ self.initial_pop: list[Structure] = list(
+ map(opt_params.golem_adapter.adapt, opt_params.sampler(opt_params.pop_size)),
+ )
+
self.__surrogate_opt = SurrogateEachNgenOptimizer(
objective=self.objective,
initial_graphs=self.initial_pop,