Skip to content

Commit

Permalink
Small fix: adjust variable types in optimizer.check_x0
Browse files Browse the repository at this point in the history
  • Loading branch information
r.jaepel committed Jan 15, 2024
1 parent a0b56e8 commit ce4206e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CADETProcess/optimization/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ def check_x0(self, optimization_problem, x0):
flag = True

shape = np.array(x0).shape

is_x0_1d = len(shape) == 1

x0 = np.array(x0, ndmin=2)

n_dependent_variables = optimization_problem.n_dependent_variables
Expand All @@ -383,13 +386,17 @@ def check_x0(self, optimization_problem, x0):
warnings.warn(
"x0 contains dependent values. Will recompute dependencies for consistency."
)
x0 = np.array(x0)

for x in x0:
if not optimization_problem.check_individual(x, get_dependent_values=True):
flag = False
break

x0 = x0.reshape(shape).tolist()
if is_x0_1d:
x0 = x0[0]

x0 = x0.tolist()

return flag, x0

Expand Down

0 comments on commit ce4206e

Please sign in to comment.