Bug 134529 - [ENHANCEMENT] Save Solver configurations into the ODS file for each sheet
Summary: [ENHANCEMENT] Save Solver configurations into the ODS file for each sheet
Status: RESOLVED DUPLICATE of bug 38948
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.0.0.beta1+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks: Solver
  Show dependency treegraph
 
Reported: 2020-07-05 15:18 UTC by Rafael Lima
Modified: 2021-07-25 20:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2020-07-05 15:18:54 UTC
I have been using LibreOffice Calc for linear optimization with CoinMP. However, it does not save solver settings onto the ODS file. Hence, whenever I close and reopen the file, I have to configure the solver all over again.

This is a major problem when working with optimization, because the normal workflow is to create a model sheet, save it and then send to other people to load data and execute the model. But if the model is not persistent in the file, it breaks the workflow.

I am submitting this as an enhancement request instead of a bug report because I think LibreOffice has not tried to implement this feature yet. But I would like to emphasize its importance, because the use of spreadsheets for optimization has become very popular in the last few years. I think this is an area where LibreOffice can be superior to all other office suites.
Comment 1 Buovjaga 2021-03-11 08:27:41 UTC
Solver is an extension. I'm not sure how to treat this. Asking design team for help.
Comment 2 Rafael Lima 2021-03-11 14:48:41 UTC
(In reply to Buovjaga from comment #1)
> Solver is an extension. I'm not sure how to treat this. Asking design team
> for help.

Actually, only the Non-Linear solver is implemented as an extension, which is installed by default.

The linear solvers and the swarm solver are implemented in C++. The solvers are located in the following files:
 /core/hwpfilter/source/solver.cxx
 /core/sccomp/source/solver/LpsolveSolver.cxx
 /core/sccomp/source/solver/CoinMPSolver.cxx
 /core/sccomp/source/solver/SolverComponent.cxx
 /core/sccomp/source/solver/SwarmSolver.cxx

What needs to be done is to save, for each sheet, the solver configurations filled in by the user, so that when the file is saved, closed, and reopened, the settings can be recovered when the user goes to Tools -> Solver again.

In short, I'm proposing to implement the same method MS Excel uses to deal with solver configuration.

I have a great interest in this being implemented, because I use the Solver all the time in my classes. If someone can supervise/guide me, I volunteer to implement this feature.

My main concern is how to save these settings in the ODF format.
Comment 3 raal 2021-03-11 18:36:47 UTC

*** This bug has been marked as a duplicate of bug 38948 ***
Comment 4 Tomaz Vajngerl 2021-03-13 05:11:19 UTC
All solvers use the same UNO API for the parameters (a solver defines which parameters it has), so you would just have to remember those parameters and save them in an ODF file.  

I would start with changing the UI and add the functionality, so you can use saved parameters, then save the parameters to a file into user profile folder so they survive the restart and then think about adding it into a ODS file.
Comment 5 Tomaz Vajngerl 2021-03-13 05:13:10 UTC
> The linear solvers and the swarm solver are implemented in C++. The solvers
> are located in the following files:
>  /core/hwpfilter/source/solver.cxx
>  /core/sccomp/source/solver/LpsolveSolver.cxx
>  /core/sccomp/source/solver/CoinMPSolver.cxx
>  /core/sccomp/source/solver/SolverComponent.cxx
>  /core/sccomp/source/solver/SwarmSolver.cxx
> 

hwpfilter/source/solver.cxx has nothing to do with Calc solvers :)
Comment 6 Heiko Tietze 2021-03-15 09:51:44 UTC
(In reply to Tomaz Vajngerl from comment #4)
> I would start with changing the UI... save the parameters to a file...

We started with a three-column layout that could be useful here too. Left is a list box with a couple of pre- and user-defined options, you can add and remove. In the (large) middle column the individual attributes are listed as loaded from the preset left-hand. And, if applicable, we show a preview right-hand.

The dialog has some more usability traps, like a dynamical list of attributes which spoils the scrollbar and this tiny, not resizable "Options..." dialog with a huge amount of complicated options. If these options are global it needs a different place, could be a dedicated command/dialog or a Tools > Options tab.
Comment 7 Todor Balabanov 2021-07-25 20:11:39 UTC
One way to be done is by the Export/Import button in the solver settings dialog. Most of the settings can be exported as a regular sheet. The import can be done from the same sheet.

These are the common variables that need saving:

targetedit		m_xEdObjectiveCell		aObjRange		aObjective
max				m_xRbMax
min				m_xRbMin
value			m_xRbValue
valueedit		m_xEdTargetValue
changeedit		m_xEdVariableCells		aVarRanges		aVariables
ref1edit		m_xEdLeft1								aConstraints
op1list			m_xLbOp1
val1edit		m_xEdRight1
ok				m_xBtnSolve				BtnHdl			CallSolver()
close			m_xBtnClose				BtnHdl
				m_xBtnResetAll