diff --git a/CADETProcess/optimization/optimizer.py b/CADETProcess/optimization/optimizer.py index dbd3a8c2e..7f5f6759f 100644 --- a/CADETProcess/optimization/optimizer.py +++ b/CADETProcess/optimization/optimizer.py @@ -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 @@ -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