diff --git a/CADETProcess/optimization/optimizationProblem.py b/CADETProcess/optimization/optimizationProblem.py index cbe27860..64a68aa3 100644 --- a/CADETProcess/optimization/optimizationProblem.py +++ b/CADETProcess/optimization/optimizationProblem.py @@ -308,7 +308,7 @@ def variables_dict(self): @property def variable_values(self): """list: Values of optimization variables.""" - return [var.value for var in self.variables] + return np.array([var.value for var in self.variables]) def add_variable( self, name, evaluation_objects=-1, parameter_path=None, @@ -561,7 +561,7 @@ def get_dependent_values(self, x): Parameters ---------- - x : list + x : array_like Value of the optimization variables in untransformed space. Raises @@ -571,7 +571,7 @@ def get_dependent_values(self, x): Returns ------- - x : list + x : np.ndarray Value of all optimization variables in untransformed space. """ @@ -596,7 +596,7 @@ def get_independent_values(self, x): Parameters ---------- - x : list + x : array_like Value of all optimization variables. Works for transformed and untransformed space. @@ -607,7 +607,7 @@ def get_independent_values(self, x): Returns ------- - x_independent : list + x_independent : np.ndarray Values of all independent optimization variables. """ @@ -622,7 +622,7 @@ def get_independent_values(self, x): if variable.is_independent: x_independent.append(value) - return x_independent + return np.array(x_independent) @untransforms def set_variables(self, x, evaluation_objects=-1): @@ -678,7 +678,7 @@ def _evaluate_individual(self, eval_funs, x, force=False): Returns ------- - results : list + results : np.ndarray Values of the evaluation functions at point x. See Also @@ -721,12 +721,12 @@ def _evaluate_population(self, eval_fun, population, force=False, parallelizatio Raises ------ CADETProcessError - DESCRIPTION. + If dictcache is used for parallelized evaluation. Returns ------- - results : list - DESCRIPTION. + results : np.ndarray + Results of the evaluation functions. """ if parallelization_backend is None: @@ -765,8 +765,8 @@ def _evaluate(self, x, func, force=False): Returns ------- - results : TYPE - DESCRIPTION. + results : np.ndarray + Results of the evaluation functions. """ self.logger.debug(f'evaluate {str(func)} at {x}') @@ -1043,7 +1043,7 @@ def evaluate_objectives(self, x, force=False): Returns ------- - f : list + f : np.ndarray Values of the objective functions at point x. See Also @@ -1083,7 +1083,7 @@ def evaluate_objectives_population( Returns ------- - results : list + results : np.ndarray Objective function values. See Also @@ -1112,7 +1112,7 @@ def objective_jacobian(self, x, ensure_minimization=False, dx=1e-3): Returns ------- - jacobian: list + jacobian: np.array Value of the partial derivatives at point x. See Also @@ -1298,7 +1298,7 @@ def evaluate_nonlinear_constraints(self, x, force=False): Returns ------- - g : list + g : np.ndarray Nonlinear constraint function values. See Also @@ -1334,7 +1334,7 @@ def evaluate_nonlinear_constraints_population(self, population, force=False, par Returns ------- - results : list + results : np.ndarray Nonlinear constraints. See Also @@ -1417,7 +1417,7 @@ def evaluate_nonlinear_constraints_violation_population( Returns ------- - results : list + results : np.ndarray Nonlinear constraints violation. See Also @@ -1651,11 +1651,6 @@ def evaluate_callbacks_population( Runner to use for the evaluation of the population in sequential or parallel mode. - Returns - ------- - results : list - Nonlinear constraint function values. - See Also -------- add_callback @@ -1802,7 +1797,7 @@ def evaluate_meta_scores(self, x, force=False): Returns ------- - m : list + m : np.ndarray Meta scores. See Also @@ -1835,7 +1830,7 @@ def evaluate_meta_scores_population(self, population, force=False, parallelizati sequential or parallel mode. Returns ------- - results : list + results : np.ndarray Meta scores. See Also @@ -1917,7 +1912,7 @@ def evaluate_multi_criteria_decision_functions(self, pareto_population): Returns ------- - x_pareto : list + x_pareto : np.ndarray Value of the optimization variables. See Also @@ -2281,7 +2276,7 @@ def evaluate_linear_constraints(self, x): Returns ------- - constraints: np.array + constraints: np.ndarray Value of the linear constraints at point x See Also @@ -2618,7 +2613,7 @@ def transform(self, x_independent): Returns ------- - list + np.ndarray Optimization variables in transformed parameter space. """ x_independent = np.array(x_independent) @@ -2631,7 +2626,7 @@ def transform(self, x_independent): for value, var in zip(ind, self.independent_variables) ] - return transform.reshape(x_independent.shape).tolist() + return transform.reshape(x_independent.shape) def untransform(self, x_transformed): """Untransform the optimization variables from transformed parameter space. @@ -2643,7 +2638,7 @@ def untransform(self, x_transformed): Returns ------- - list + np.ndarray Optimization variables in untransformed parameter space. """ x_transformed = np.array(x_transformed) @@ -2656,7 +2651,7 @@ def untransform(self, x_transformed): for value, var in zip(ind, self.independent_variables) ] - return untransform.reshape(x_transformed.shape).tolist() + return untransform.reshape(x_transformed.shape) @property def cached_steps(self): @@ -3081,7 +3076,7 @@ def check_individual(self, x, silent=False): Parameters ---------- - x : list + x : array_like Value of the optimization variables in untransformed space. Returns