Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel optimizer #247

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

Parallel optimizer #247

wants to merge 17 commits into from

Conversation

kasyanovse
Copy link
Collaborator

@kasyanovse kasyanovse commented Dec 7, 2023

WIP

Продолжение работы #199.

Этап 1. Воссоздание существующего генетического оптимизатора с использованием нового подхода

  • Реализовать основные классы (39b07fe, 2e2a318, 7a220f8)
  • Сделать обертки адаптивных параметров под новый оптимизатор (34f83e7, 32dcdb4)
  • Переписать генетические операторы под новый оптимизатор (c5e7589, )
  • Переписать адаптивные параметры
  • Собрать аналог существующего оптимизатора
  • Тесты
    • Модуль с Mock-объектами
    • Тесты для каждого метода
    • На одинаковый результат для одно- и многопотока
    • На корректность работы при выполнении различных критериев (остановка по предельному числу итераций и т.д.)
  • Докстринги (afc608b, ), typehints

Этап 2. Добавление бандитов для мутаций

  • Переписать бандитов под новый оптимизатор
  • Добавить бандитов в новый оптимизатор

@kasyanovse kasyanovse added research Experiments, hypothesis, research development adaptive Related to R&D of Adaptive features of the algorithm opt core Related to core logic of optimizer labels Dec 7, 2023
@kasyanovse kasyanovse self-assigned this Dec 7, 2023
@pep8speaks
Copy link

pep8speaks commented Dec 7, 2023

Hello @kasyanovse! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1:1: F401 'abc.abstractmethod' imported but unused
Line 2:1: F401 'collections.deque' imported but unused
Line 3:1: F401 'dataclasses.dataclass' imported but unused
Line 4:1: F401 'multiprocessing.managers.DictProxy' imported but unused
Line 5:1: F401 'typing.Dict' imported but unused
Line 5:1: F401 'typing.List' imported but unused
Line 5:1: F401 'typing.Callable' imported but unused
Line 10:1: F401 'golem.core.optimisers.common_optimizer.node.Node' imported but unused
Line 13:1: F401 'golem.core.optimisers.common_optimizer.scheme.Scheme' imported but unused
Line 14:1: F401 'golem.core.optimisers.common_optimizer.stage.Stage' imported but unused
Line 15:1: F401 'golem.core.optimisers.common_optimizer.task.Task' imported but unused
Line 15:1: F401 'golem.core.optimisers.common_optimizer.task.TaskStatusEnum' imported but unused
Line 17:1: F401 'golem.core.optimisers.graph.OptGraph' imported but unused
Line 18:1: F401 'golem.core.optimisers.objective.ObjectiveFunction' imported but unused
Line 20:1: F401 'golem.core.optimisers.opt_history_objects.opt_history.OptHistory' imported but unused
Line 22:1: F401 'golem.core.optimisers.optimizer.GraphOptimizer' imported but unused
Line 24:1: F401 'golem.core.optimisers.timer.OptimisationTimer' imported but unused

Line 1:1: F401 'abc.abstractmethod' imported but unused
Line 2:1: F401 'collections.deque' imported but unused
Line 4:1: F401 'typing.Callable' imported but unused
Line 7:1: F401 'golem.core.optimisers.common_optimizer.node.Node' imported but unused
Line 8:1: F401 'golem.core.optimisers.common_optimizer.old_config.default_stages' imported but unused
Line 9:1: F401 'golem.core.optimisers.common_optimizer.scheme.Scheme' imported but unused
Line 10:1: F401 'golem.core.optimisers.common_optimizer.stage.Stage' imported but unused
Line 11:1: F401 'golem.core.optimisers.common_optimizer.task.Task' imported but unused
Line 11:1: F401 'golem.core.optimisers.common_optimizer.task.TaskStatusEnum' imported but unused
Line 12:1: F401 'golem.core.optimisers.genetic.operators.operator.EvaluationOperator' imported but unused
Line 13:1: F401 'golem.core.optimisers.graph.OptGraph' imported but unused
Line 14:1: F401 'golem.core.optimisers.objective.ObjectiveFunction' imported but unused
Line 15:1: F401 'golem.core.optimisers.opt_history_objects.individual.Individual' imported but unused
Line 18:1: F401 'golem.core.optimisers.optimizer.GraphOptimizer' imported but unused
Line 19:1: F401 'golem.core.optimisers.populational_optimizer.PopulationalOptimizer' imported but unused
Line 20:1: F401 'golem.core.optimisers.timer.OptimisationTimer' imported but unused
Line 39:1: W391 blank line at end of file

Line 3:1: F401 'copy.deepcopy' imported but unused
Line 4:1: F401 'enum.Enum' imported but unused
Line 4:1: F401 'enum.auto' imported but unused
Line 8:1: F401 'numpy as np' imported but unused
Line 9:1: F401 'typing.Optional' imported but unused
Line 9:1: F401 'typing.Tuple' imported but unused
Line 9:1: F401 'typing.List' imported but unused
Line 31:1: E303 too many blank lines (3)
Line 40:1: E302 expected 2 blank lines, found 1
Line 49:1: E302 expected 2 blank lines, found 1
Line 52:1: E305 expected 2 blank lines after class or function definition, found 1
Line 75:1: E302 expected 2 blank lines, found 1
Line 86:1: E302 expected 2 blank lines, found 1
Line 98:1: E305 expected 2 blank lines after class or function definition, found 1
Line 114:1: E302 expected 2 blank lines, found 0
Line 118:1: E305 expected 2 blank lines after class or function definition, found 1
Line 125:1: E303 too many blank lines (3)
Line 149:1: W391 blank line at end of file

Line 11:36: F821 undefined name 'CommonOptimizerParameters'
Line 18:45: F821 undefined name 'CommonOptimizerParameters'

Line 3:1: F401 'golem.core.optimisers.genetic.operators.mutation.Mutation as OldMutation' imported but unused
Line 7:36: F821 undefined name 'CommonOptimizerParameters'
Line 12:45: F821 undefined name 'CommonOptimizerParameters'
Line 15:1: E305 expected 2 blank lines after class or function definition, found 1
Line 15:1: E402 module level import not at top of file
Line 15:1: F401 'golem.core.optimisers.fitness.null_fitness' imported but unused
Line 16:1: E302 expected 2 blank lines, found 0

Line 7:1: F401 'golem.core.optimisers.common_optimizer.task.Task' imported but unused
Line 8:1: F401 'golem.core.optimisers.genetic.operators.base_mutations.MutationTypesEnum' imported but unused
Line 15:36: F821 undefined name 'CommonOptimizerParameters'
Line 22:45: F821 undefined name 'CommonOptimizerParameters'

Line 7:36: F821 undefined name 'CommonOptimizerParameters'
Line 14:45: F821 undefined name 'CommonOptimizerParameters'

Line 7:1: E303 too many blank lines (3)
Line 8:36: F821 undefined name 'CommonOptimizerParameters'
Line 14:45: F821 undefined name 'CommonOptimizerParameters'

Line 6:1: E302 expected 2 blank lines, found 1
Line 7:36: F821 undefined name 'CommonOptimizerParameters'
Line 13:45: F821 undefined name 'CommonOptimizerParameters'

Line 7:36: F821 undefined name 'CommonOptimizerParameters'
Line 14:45: F821 undefined name 'CommonOptimizerParameters'

Line 7:1: E303 too many blank lines (3)
Line 8:36: F821 undefined name 'CommonOptimizerParameters'
Line 15:45: F821 undefined name 'CommonOptimizerParameters'

Line 7:1: E303 too many blank lines (3)
Line 8:36: F821 undefined name 'CommonOptimizerParameters'
Line 13:45: F821 undefined name 'CommonOptimizerParameters'

Line 8:36: F821 undefined name 'CommonOptimizerParameters'
Line 14:45: F821 undefined name 'CommonOptimizerParameters'

Line 1:1: F401 'copy.deepcopy' imported but unused
Line 2:1: F401 'random.choice' imported but unused
Line 4:1: F401 'typing.Optional' imported but unused
Line 4:1: F401 'typing.Dict' imported but unused
Line 4:1: F401 'typing.Callable' imported but unused
Line 7:1: F401 'golem.core.optimisers.common_optimizer.task.Task' imported but unused
Line 8:1: F401 'golem.core.optimisers.genetic.operators.base_mutations.base_mutations_repo' imported but unused
Line 8:1: F401 'golem.core.optimisers.genetic.operators.base_mutations.MutationTypesEnum' imported but unused
Line 9:1: F401 'golem.core.optimisers.graph.OptGraph' imported but unused
Line 10:1: F401 'golem.core.optimisers.opt_history_objects.individual.Individual' imported but unused
Line 11:1: F401 'golem.core.optimisers.opt_history_objects.parent_operator.ParentOperator' imported but unused
Line 15:36: F821 undefined name 'CommonOptimizerParameters'
Line 20:45: F821 undefined name 'CommonOptimizerParameters'
Line 47:1: W391 blank line at end of file

Line 28:1: E302 expected 2 blank lines, found 0
Line 32:1: E305 expected 2 blank lines after class or function definition, found 1
Line 37:1: E302 expected 2 blank lines, found 1
Line 39:45: F821 undefined name 'CommonOptimizerParameters'
Line 43:1: E305 expected 2 blank lines after class or function definition, found 1
Line 54:1: E302 expected 2 blank lines, found 1
Line 61:1: E302 expected 2 blank lines, found 1
Line 66:1: E305 expected 2 blank lines after class or function definition, found 1
Line 74:45: F821 undefined name 'CommonOptimizerParameters'
Line 78:1: E305 expected 2 blank lines after class or function definition, found 1
Line 81:1: E302 expected 2 blank lines, found 1
Line 85:1: E305 expected 2 blank lines after class or function definition, found 1
Line 88:1: W391 blank line at end of file

Line 3:1: F401 'collections.deque' imported but unused
Line 4:1: F401 'copy.copy' imported but unused
Line 38:19: F821 undefined name 'Queue'
Line 39:22: F821 undefined name 'Queue'
Line 97:17: F841 local variable 'gen' is assigned to but never used

Line 6:1: F401 'golem.utilities.utilities.determine_n_jobs' imported but unused

Line 33:46: F821 undefined name 'CommonOptimizerParameters'
Line 33:76: F821 undefined name 'CommonOptimizerParameters'
Line 35:31: F821 undefined name 'CommonOptimizerParameters'

Line 4:1: F401 'typing.Any' imported but unused
Line 18:45: F821 undefined name 'CommonOptimizerParameters'
Line 26:1: E303 too many blank lines (3)
Line 39:45: F821 undefined name 'CommonOptimizerParameters'

Line 1:1: F401 'typing.Any' imported but unused
Line 1:1: F401 'typing.Dict' imported but unused
Line 5:1: F401 'golem.core.optimisers.optimizer.OptimizationParameters' imported but unused
Line 5:1: F401 'golem.core.optimisers.optimizer.GraphGenerationParams' imported but unused
Line 5:1: F401 'golem.core.optimisers.optimizer.AlgorithmParameters' imported but unused
Line 11:1: F401 'golem.core.optimisers.genetic.operators.mutation.Mutation as OldMutation' imported but unused
Line 21:36: F821 undefined name 'CommonOptimizerParameters'
Line 30:45: F821 undefined name 'CommonOptimizerParameters'
Line 30:77: F821 undefined name 'CommonOptimizerParameters'

Comment last updated at 2023-12-14 12:40:45 UTC

@Lopa10ko Lopa10ko self-assigned this Dec 7, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2023

Codecov Report

Attention: 387 lines in your changes are missing coverage. Please review.

Comparison is base (46b53a4) 71.94% compared to head (16a7a3e) 68.57%.
Report is 2 commits behind head on main.

Files Patch % Lines
golem/core/optimisers/common_optimizer/runner.py 0.00% 78 Missing ⚠️
golem/core/optimisers/common_optimizer/config.py 0.00% 77 Missing ⚠️
...lem/core/optimisers/common_optimizer/old_config.py 0.00% 57 Missing ⚠️
...re/optimisers/common_optimizer/common_optimizer.py 0.00% 54 Missing ⚠️
golem/core/optimisers/common_optimizer/task.py 0.00% 35 Missing ⚠️
...misers/common_optimizer/common_optimizer_params.py 0.00% 32 Missing ⚠️
golem/core/optimisers/common_optimizer/scheme.py 0.00% 21 Missing ⚠️
golem/core/optimisers/common_optimizer/stage.py 0.00% 18 Missing ⚠️
golem/core/optimisers/common_optimizer/node.py 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #247      +/-   ##
==========================================
- Coverage   71.94%   68.57%   -3.37%     
==========================================
  Files         136      145       +9     
  Lines        8127     8532     +405     
==========================================
+ Hits         5847     5851       +4     
- Misses       2280     2681     +401     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maypink maypink mentioned this pull request Dec 19, 2023
8 tasks
@kasyanovse
Copy link
Collaborator Author

ИМХО, этот PR на стадии MVP. Не хватает точных замеров прироста производительности в разных задачах, адаптированных под этот алгоритм мутаций (сейчас тут реализованы обертки) и нормальной системы кеширования.

А вообще, возможностей для дальнейшего развития тут так много, что проще с нуля написать.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adaptive Related to R&D of Adaptive features of the algorithm opt core Related to core logic of optimizer research Experiments, hypothesis, research development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants