Skip to content

Commit

Permalink
Перевод комментариев в разделе iOpt на английский для документации
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtanyuk committed Oct 9, 2023
1 parent 2e634ae commit 8ebe4bb
Show file tree
Hide file tree
Showing 22 changed files with 377 additions and 377 deletions.
40 changes: 20 additions & 20 deletions iOpt/evolvent/evolvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@


class Evolvent:
"""Класс разверток
r"""Class Evolvent
:param lower_bound_of_float_variables: массив для левых (нижних) границ, А.
:param lower_bound_of_float_variables: array for lower bounds, А.
:type lower_bound_of_float_variables: np.ndarray(shape = (1), dtype = np.double).
:param upper_bound_of_float_variables: массив для правых (верхних) границ, В.
:param upper_bound_of_float_variables: array for upper bounds, В.
:type upper_bound_of_float_variables: np.ndarray(shape = (1), dtype = np.double).
:param number_of_float_variables: размерность задачи (N).
:type number_of_float_variables: int
:param evolvent_density: плотность развертки (m).
:param number_of_float_variables: dimension (N).
:type number_of_float_variables: int.
:param evolvent_density: evolvent density (m).
:type evolvent_density: int
"""

Expand Down Expand Up @@ -42,11 +42,11 @@ def set_bounds(self,
lower_bound_of_float_variables: np.ndarray(shape=(1), dtype=np.double) = [],
upper_bound_of_float_variables: np.ndarray(shape=(1), dtype=np.double) = []
):
"""Установка граничных значений
r"""Set bounds
:param lower_bound_of_float_variables: массив для левых (нижних) границ, А.
:param lower_bound_of_float_variables: array for lower bounds, А.
:type lower_bound_of_float_variables: np.ndarray(shape = (1), dtype = np.double).
:param upper_bound_of_float_variables: массив для правых (верхних) границ, В.
:param upper_bound_of_float_variables: array for upper bounds, В.
:type upper_bound_of_float_variables: np.ndarray(shape = (1), dtype = np.double).
"""

Expand All @@ -56,11 +56,11 @@ def set_bounds(self,
def get_image(self,
x: np.double
) -> np.ndarray(shape=(1), dtype=np.double):
"""Получить образ (x->y)
r"""Get image (x->y)
:param x: значение x.
:param x: value of *x*.
:type x: np.double.
:return: массив значений *y*
:return: array of values *y*.
:rtype: np.ndarray(shape = (1), dtype = np.double).
"""
Expand All @@ -72,11 +72,11 @@ def get_image(self,
def get_inverse_image(self,
y: np.ndarray(shape=(1), dtype=np.double)
) -> np.double:
"""Получить обратное значение образа (y->x)
r"""Get inverse image (y->x)
:param y: значение y.
:type y: np.ndarray(shape = (1), dtype = np.double)
:return: значение *x*
:param y: value of *y*.
:type y: np.ndarray(shape = (1), dtype = np.double).
:return: value of *x*.
:rtype: np.double:.
"""
Expand All @@ -89,11 +89,11 @@ def get_inverse_image(self,
def get_preimages(self,
y: np.ndarray(shape=(1), dtype=np.double),
) -> np.double:
"""Получить обратное значение образа (y->x)
r"""Get inverse image (y->x)
:param y: значение y.
:type y: np.ndarray(shape = (1), dtype = np.double)
:return: значение *x*
:param y: value of *y*.
:type y: np.ndarray(shape = (1), dtype = np.double).
:return: value of *x*.
:rtype: np.double:.
"""
Expand Down
18 changes: 9 additions & 9 deletions iOpt/method/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def __init__(self,
parameters: SolverParameters
):
r"""
Конструктор класса Calculator
Constructor of class Calculator
:param evaluate_method: метод вычислений, проводящий поисковые испытания по заданным правилам.
:param parameters: параметры решения задачи оптимизации.
:param evaluate_method: a computational method that performs search tests according to specified rules.
:param parameters: solution parameters of the optimisation problem.
"""
self.evaluate_method = evaluate_method
self.parameters = parameters
Expand All @@ -35,19 +35,19 @@ def __init__(self,
initargs=(self.evaluate_method,))

r"""
Инициализация метода вычислений в каждом процессе из пула процессов Calculator.Pool
Initialisation of the calculation method in each process from the process pool Calculator.Pool
:param evaluate_method: метод вычислений, проводящий поисковые испытания по заданным правилам.
:param evaluate_method: a computational method that performs search tests according to specified rules.
"""

@staticmethod
def worker_init(evaluate_method: ICriterionEvaluateMethod):
Calculator.evaluate_method = evaluate_method

r"""
Метод проведения испытаний в процессе из пула процессов Calculator.Pool
Method of testing in a process from a pool of processes Calculator.Pool
:param point: точка проведения испытания
:param point: test point
"""

@staticmethod
Expand All @@ -60,9 +60,9 @@ def worker(point: SearchDataItem) -> SearchDataItem:
return point

r"""
Метод проведения испытаний для множества точек
Test method for multiple points
:param points: точки проведения испытаний
:param points: test points
"""

def calculate_functionals_for_items(self, points: list[SearchDataItem]) -> list[SearchDataItem]:
Expand Down
24 changes: 12 additions & 12 deletions iOpt/method/index_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class IndexMethod(Method):
"""
Класс Method содержит реализацию Алгоритма Глобального Поиска
The Method class contains an implementation of the Global Search Algorithm
"""

def __init__(self,
Expand All @@ -29,11 +29,11 @@ def __init__(self,

def calculate_functionals(self, point: SearchDataItem) -> SearchDataItem:
r"""
Проведение поискового испытания в заданной точке.
Performing a search test at a given point.
:param point: точка, в которой надо провести испытание.
:param point: the point at which the test is to be performed.
:return: точка, в которой сохранены результаты испытания.
:return: the point at which the test results are saved.
"""
try:
number_of_constraints = self.task.problem.number_of_constraints
Expand All @@ -56,10 +56,10 @@ def calculate_functionals(self, point: SearchDataItem) -> SearchDataItem:

def calculate_m(self, curr_point: SearchDataItem, left_point: SearchDataItem) -> None:
r"""
Вычисление оценки константы Гельдера между между curr_point и left_point.
Computing an estimate of the Gelder constant between curr_point and left_point.
:param curr_point: правая точка интервала
:param left_point: левая точка интервала
:param curr_point: right interval point
:param left_point: left interval point
"""
# Обратить внимание на вычисление расстояния, должен использоваться метод CalculateDelta
if curr_point is None:
Expand Down Expand Up @@ -98,10 +98,10 @@ def calculate_m(self, curr_point: SearchDataItem, left_point: SearchDataItem) ->

def calculate_global_r(self, curr_point: SearchDataItem, left_point: SearchDataItem) -> None:
r"""
Вычисление глобальной характеристики интервала [left_point, curr_point].
Calculating the global characteristic of an interval [left_point, curr_point].
:param curr_point: правая точка интервала.
:param left_point: левая точка интервала.
:param curr_point: right point of the interval.
:param left_point: left interval point.
"""

# Сюда переедет целиком calculate_global_r из Method, а там останется только случай с равными индексами
Expand Down Expand Up @@ -144,9 +144,9 @@ def recalc_all_characteristics(self) -> None:

def update_optimum(self, point: SearchDataItem) -> None:
r"""
Обновляет оценку оптимума.
Updates the estimate of the optimum.
:param point: точка нового испытания.
:param point: the point of a new trial.
"""

if self.best is None or self.best.get_index() < point.get_index() or (
Expand Down
14 changes: 7 additions & 7 deletions iOpt/method/index_method_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class IndexMethodCalculator(ICriterionEvaluateMethod):
"""
Класс Method содержит реализацию Алгоритма Глобального Поиска
The Method class contains an implementation of the Global Search Algorithm
"""

def __init__(self,
Expand All @@ -18,11 +18,11 @@ def __init__(self,

def calculate_functionals(self, point: SearchDataItem) -> SearchDataItem:
r"""
Проведение поискового испытания в заданной точке.
Performing a search test at a given point.
:param point: точка, в которой надо провести испытание.
:param point: the point at which the test is to be performed.
:return: точка, в которой сохранены результаты испытания.
:return: the point at which the test results are saved.
"""
number_of_constraints = self.task.problem.number_of_constraints
for i in range(number_of_constraints):
Expand All @@ -40,10 +40,10 @@ def calculate_functionals(self, point: SearchDataItem) -> SearchDataItem:

def copy_functionals(self, dist_point: SearchDataItem, src_point: SearchDataItem):
r"""
Копирование поискового испытания.
Copying the search test.
:param dist_point: точка, в которую копируются значения испытаний.
:param src_point: точка c результатами испытаний.
:param dist_point: point to which the test values are copied.
:param src_point: point with test results.
"""

dist_point.function_values = copy.deepcopy(src_point.function_values)
Expand Down
2 changes: 1 addition & 1 deletion iOpt/method/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Listener:
"""
Базовый класс слушателя событий.
Event listener base class.
"""

def before_method_start(self, method: Method):
Expand Down
20 changes: 10 additions & 10 deletions iOpt/method/local_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class LocalTaskWrapper:
"""
Класс LocalTaskWrapper (название временное) оборачивает вычисление функции для дальнейшего применения локальных методов.
The LocalTaskWrapper class (the name is temporary) wraps the function computation for further application of local methods.
"""

def __init__(self, task: OptimizationTask, discrete_variables=None, max_calcs=-1):
Expand All @@ -20,16 +20,16 @@ def __init__(self, task: OptimizationTask, discrete_variables=None, max_calcs=-1

def evaluate_function(self, y: List[float]) -> float:
"""
Метод вычисляет значение целевой функции
The method calculates the value of the target function
:param y: Точка в которой нужно вычислить значение функции
:param y: The point at which you need to calculate the value of the function
:return: возвращает значение целевой функции или
sys.float_info.max, если:
точка лежит за областью поиска
ИЛИ не были выполнены ограничения
ИЛИ было выкинуто исключение (функция не может быть посчитана в этой точке)
ИЛИ число вычислений превысило лимит (если он задан)
:return: returns the value of the target function or
sys.float_info.max, if:
the point lies outside the search area
OR the restrictions have not been met
OR an exception was thrown (the function cannot be calculated at this point)
OR the number of calculations has exceeded the limit (if set)
"""
point = Point(y, self.discrete_variables)
function_value = FunctionValue(FunctionType.OBJECTIV)
Expand Down Expand Up @@ -60,7 +60,7 @@ def evaluate_function(self, y: List[float]) -> float:

class HookeJeevesOptimizer:
"""
Класс HookeJeevesOptimizer реализует метод Хука-Дживса.
The HookeJeevesOptimizer class implements the Hooke Jeeves method.
"""

def __init__(self, func: Callable[[List[float]], float], start_point: Iterable[float],
Expand Down
Loading

0 comments on commit 8ebe4bb

Please sign in to comment.