Skip to content

Commit

Permalink
Fixed a bug with initializing unused discrete parameters (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevIlyaG authored Jun 26, 2024
1 parent 5c7315a commit ef55f68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions iOpt/method/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def first_iteration(self) -> list[SearchDataItem]:

# Генерация 3х точек 0, 0.5, 1. Значение функции будет вычисляться только в точке 0.5.
# Интервал задаётся правой точкой, т.е. будут интервалы только для 0.5 и 1
left = SearchDataItem(Point(self.evolvent.get_image(0.0), None), 0.,
left = SearchDataItem(Point(self.evolvent.get_image(0.0), []), 0.,
function_values=[FunctionValue()] * self.numberOfAllFunctions)
right = SearchDataItem(Point(self.evolvent.get_image(1.0), None), 1.0,
right = SearchDataItem(Point(self.evolvent.get_image(1.0), []), 1.0,
function_values=[FunctionValue()] * self.numberOfAllFunctions)

items: list[SearchDataItem] = []
Expand All @@ -102,7 +102,7 @@ def first_iteration(self) -> list[SearchDataItem]:
number_of_point: int = self.parameters.number_of_parallel_points - 1
h: float = 1.0 / (number_of_point + 1)

ystart_point = Point(copy.copy(self.parameters.start_point.float_variables), None)
ystart_point = Point(copy.copy(self.parameters.start_point.float_variables), [])
xstart_point = self.evolvent.get_inverse_image(self.parameters.start_point.float_variables)

itemstart_point = SearchDataItem(ystart_point, xstart_point,
Expand All @@ -112,7 +112,7 @@ def first_iteration(self) -> list[SearchDataItem]:

for i in range(number_of_point):
x = h * (i + 1)
y = Point(self.evolvent.get_image(x), None)
y = Point(self.evolvent.get_image(x), [])
item = SearchDataItem(y, x,
function_values=[FunctionValue()] * self.numberOfAllFunctions)
if x < xstart_point < h * (i + 2):
Expand All @@ -131,7 +131,7 @@ def first_iteration(self) -> list[SearchDataItem]:

for i in range(number_of_point):
x = h * (i + 1)
y = Point(self.evolvent.get_image(x), None)
y = Point(self.evolvent.get_image(x), [])
item = SearchDataItem(y, x,
function_values=[FunctionValue()] * self.numberOfAllFunctions)
items.append(item)
Expand Down

0 comments on commit ef55f68

Please sign in to comment.