CadetProcess.optimization issue

Expected behavior.

Looks like something went wrong after the last updates of the Cadet-Process dependencies. I used this fragment of code for a while for some optimization:

from CADETProcess.optimization import U_NSGA3, NelderMead
#optimizer = U_NSGA3()
optimizer = NelderMead()
optimizer.n_cores = 4

results = optimizer.optimize(
    optimization_problem,
    use_checkpoint=False,
    #x0 = x0
)

Actual behavior

Now it stops with the following message:

---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
Cell In[3], line 58
     55 optimizer = NelderMead()
     56 optimizer.n_cores = 4
---> 58 results = optimizer.optimize(
     59     optimization_problem,
     60     use_checkpoint=False,
     61     #x0 = [*column.binding_model.adsorption_rate, *column.binding_model.desorption_rate, *column.binding_model.capacity, *keq, *kkin]
     62     x0 = x0
     63 )
     64 #langm3_LDF[F] = results

File ~/miniforge3/envs/cadet/lib/python3.12/site-packages/CADETProcess/optimization/optimizer.py:273, in OptimizerBase.optimize(self, optimization_problem, x0, save_results, results_directory, use_checkpoint, overwrite_results_directory, exist_ok, log_level, reinit_cache, delete_cache, *args, **kwargs)
    270 plt.switch_backend('agg')
    272 start = time.time()
--> 273 self.run(self.optimization_problem, x0, *args, **kwargs)
    274 time_elapsed = time.time() - start
    276 self.results.time_elapsed = time_elapsed

File ~/miniforge3/envs/cadet/lib/python3.12/site-packages/CADETProcess/optimization/scipyAdapter.py:134, in SciPyInterface.run(self, optimization_problem, x0)
    132     warnings.filterwarnings('ignore', category=OptimizeWarning)
    133     warnings.filterwarnings('ignore', category=RuntimeWarning)
--> 134     scipy_results = optimize.minimize(
    135         objective_function,
...
    873         value,
    874     ),
    875 )

OperationalError: no such column: "size" - should this be a string literal in single-quotes?

How to produce bug (including a minimal reproducible example)

I used a macOS miniforge python distribution, freshly created conda environment, populated only with the minimum packages required (see the attachment) with cadet-cli v 5.0.3 self-compiled.

Minimal reproducible example (from Optimizer — CADET-Process 0.10.0 documentation):

from CADETProcess.optimization import OptimizationProblem

def multi_objective_func(x):
    f1 = x[0]**2 + x[1]**2
    f2 = (x[0] - 1)**2 + x[1]**2
    return f1, f2

optimization_problem = OptimizationProblem('moo')

optimization_problem.add_variable('x_0', lb=-5, ub=5)
optimization_problem.add_variable('x_1', lb=-5, ub=5)

optimization_problem.add_objective(multi_objective_func, n_objectives=2)
optimizer.n_cores = 4
optimization_results = optimizer.optimize(optimization_problem, save_results=False)

File produced by conda env export > environment.yml

environment.yml (6.56 KB)

Hello and welcome to the Forum!

Thank you for the detailed error report.

It’s a problem with the version 3.49.1 of libsqlite which released yesterday. For now, you can fix this by running conda install -y libsqlite==3.48.0 and we will let you know when we find a better fix.

If that doesn’t work, please let me know!

1 Like