Friday, 16 Nov 2007
Friday, 16 Nov 2007
Currently, several solver components for Calc are available (with different capabilities and different licenses), and OOo 3.0 is scheduled to contain another one in the default installation. Some areas, like non-linear models, are still open, so more solver implementations may appear in the future.
Instead of having a variety of “Solver xyz” entries in the “Tools” menu, each with their own dialog, it seems better to select between the implementations in a single dialog. So that's what we are doing: There's going to be a UNO service “com.sun.star.sheet.Solver” for the core implementation, without UI, and a dialog within the “sc” module to specify model parameters, and select between different service implementations. Future components will be able to implement just that service, and be called from the common dialog. The dialog design isn't final yet, but it will look similar to this (the images in the specification will be updated if the design is changed):
The “Options” button will open an options dialog where you can select an implementation and the options needed for that implementation.
The Solver service will be something like this, plus an XPropertySet for the options (note: even more preliminary than the dialog design):
enum SolverConstraintOperator
{
LESS_EQUAL,
GREATER_EQUAL,
EQUAL,
INTEGER,
BINARY
};
struct SolverConstraint
{
com::sun::star::table::CellAddress Left;
SolverConstraintOperator Operator;
any Right;
};
interface XSolver: com::sun::star::uno::XInterface
{
[attribute] XSpreadsheetDocument Document;
[attribute] com::sun::star::table::CellAddress Objective;
[attribute] sequence< com::sun::star::table::CellAddress > Variables;
[attribute] sequence< SolverConstraint > Constraints;
[attribute] boolean Maximize;
void solve();
[attribute, readonly] boolean Success;
[attribute, readonly] double ResultValue;
[attribute, readonly] sequence< double > Solution;
};
service Solver: XSolver;
|
As an added benefit, since the service implementation is available from outside the solver dialog, you will be able to easily use solver functionality from macros or other components.
Implementation will be in the child workspace “calcsolver”, and there's also a wiki page. Feedback is welcome on the sc-dev mailing list.
tags: api calc openoffice.org spreadsheet
Comments