Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
YamLyubov committed Nov 27, 2023
1 parent c736ee6 commit 8b12370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 0 additions & 5 deletions docs/source/api/tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ You can tune all parameters of graph nodes simultaneously using ``SimultaneousTu
.. note::
``IOptTuner`` implements deterministic algorithm.

For now ``IOptTuner`` can not be constrained by time, so constrain execution by number of iterations.

Also ``IOptTuner`` can optimise only `continuous` and `discrete` parameters but not `categorical` ones.
`Categorical` parameters will be ignored while tuning.

``IOptTuner`` is implemented using `IOpt library`_. See the `documentation`_ (in Russian) to learn more about
the optimisation algorithm.

Expand Down
11 changes: 6 additions & 5 deletions golem/core/tuning/iopt_tuner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from copy import deepcopy
from dataclasses import dataclass, field
from datetime import timedelta
from random import choice
from typing import List, Dict, Generic, Tuple, Any, Optional

import numpy as np
Expand Down Expand Up @@ -147,14 +146,15 @@ def _tune(self, graph: DomainGraphForTune, show_progress: bool = True) -> Domain

has_parameters_to_optimize = (len(problem_parameters.discrete_parameters_names) > 0 or
len(problem_parameters.float_parameters_names) > 0)
objectives_number = len(ensure_wrapped_in_sequence(self.init_metric))
is_multi_objective = objectives_number > 1
if self._check_if_tuning_possible(graph, has_parameters_to_optimize):
self.objectives_number = len(ensure_wrapped_in_sequence(self.init_metric))
is_multi_objective = self.objectives_number > 1

if self._check_if_tuning_possible(graph, has_parameters_to_optimize, supports_multi_objective=True):
if initial_parameters:
initial_point = Point(**initial_parameters)
self.solver_parameters.start_point = initial_point

problem = GolemProblem(graph, self.objective_evaluate, problem_parameters, objectives_number)
problem = GolemProblem(graph, self.objective_evaluate, problem_parameters, self.objectives_number)
solver = Solver(problem, parameters=self.solver_parameters)

if show_progress:
Expand All @@ -177,6 +177,7 @@ def _tune(self, graph: DomainGraphForTune, show_progress: bool = True) -> Domain
self.was_tuned = True
else:
tuned_graphs = graph

return tuned_graphs

def _get_parameters_for_tune(self, graph: OptGraph) -> Tuple[IOptProblemParameters, dict]:
Expand Down

0 comments on commit 8b12370

Please sign in to comment.