industrial-optimization-group / DESDEO

An open source framework for interactive multiobjective optimization methods
https://desdeo.it.jyu.fi
30 stars 23 forks source link

Tensor variables are causing conflicts with current database code #147

Open juropo opened 3 months ago

juropo commented 3 months ago

At least the SolutionArchive class in desdeo/api/db_models.py is expecting decision variable values to be stored as an array of floats. With the introduction of tensor variables an array of floats feels even less of an ideal format for storing these values than it did before.

Of course it is possible to just force any kind of combination on n-dimensional arrays into a single array of numbers, but that makes reading those numbers later quite difficult.

I would like to store the decision variable values as json instead. That way we could effectively use dicts to store them, and the multidimensionality would no longer cause problems. Even the values stored to the database would be somewhat human readable.

To get the NIMBUS method working in the api and ui, I have a version of the code that just flattens all the arrays into a single array, like I said above, this does not feel like an ideal solution.

maihoangbichtram commented 3 months ago

I changed the column type to custom type as json as in Gnimbus It can save both variables and tensor variables.