Is there any way to save a solver model in Calc? (again)

I know it was already asked (a long time ago). Problem still exists. If you use quite complex solver settings, which goes with the file you are using (i mean the solver settings are kind of part of the file to be used), it is impossible to save the solver settings, which re-start entirely blank each time you save + close the file and reopen it. Very frustrating. thanks for any help.

Have you considered running solver via a macro. Have a look at @Lupp’s solver macro example on the OO Forum:

https://forum.openoffice.org//en/forum/viewtopic.php?f=20&t=102512

I would like to emphasize again that the mentioned macro isn’t mine.
Unfortunately I didn’t save information about the origin and my memory didn’t keep it.
See the disclaimer I appended to the post @joshua4 pointed to under === Editing ===. .
Judging from the style I suppose the code to have been published somewhere by Andrew Pitonyak, but it isn’t contained in one of the two texts of his I often visit -and many authors write in a similar style regarding the reputation of Andrew .

1 Like

tdf#38948 (since 2011).

If we accept the need of user code for the short while till the above linked request will be dispatched, we still have some issues:

  1. The solver dialog keeps its last used settings somewhere for a next run, but doesn’t save these settings to the file.
  2. It is unknown to me (and probably to many) how to get these settings if we want to write them to any place (cells) for persistence.
  3. I don’t even know how to get the current settings while the Solve dialog is running.
  4. If I create solver settings by user code (and run the solver) these settings are not memorized.
  5. Thus we seem to need to create persistent groups of settings without the help of the standard dialog.

Do you, @sokol92 know remedy for this?

Dear @Lupp, if I knew, I would close the above bug. :slightly_smiling_face:
It would probably be possible to use sheet names to save the Solver parameters (similar to Excel). But there is Bugzilla for discussing bugs.

Thanks. I never considered to contribute to the “holy code”, but what I asked for would help to create a really functional workaround.
The remedy I hoped you might know would allow to save settings from the dialog to the sheet (or even to some other persistent storage) by user code. How to create a solver from stored settings was already demonstrated.

I’ve looked at the above example using the LpsolveSolver service and I like it. Still, I do not lose hope that methods for writing and reading parameters will be added to the service.

After another wasted hour I can tell that both the NLP solvers seem to suffer from a broken java suppport. They don’t accept assignments to their structured properties by Basic code.
Ordinary set/get methods dont exist, a direct assignment is only accepted for the simple (scalar) properties and throws a non-uno-error/nullpointer from Jave otherwise, and the attempt to use solver.setPropertyValue(propName, newValue) results in an error without any info though the com.sun.star.beans.PropertySet service is claimed to be supported.
No chance to get the workaround I aimed at.

See also https://bugs.documentfoundation.org/show_bug.cgi?id=70399.
I would assume that nobody will fix the above mentioned issue as long as this enhancement is open.