non-linear minimization/solver extension project for Calc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

non-linear minimization/solver extension project for Calc

oo-dev-email
I've been raising this issue recently on several OO forums and have
been invited to post this topic here.

I have been using Excel's Solver add in to optimize/minimize functions
and am surprised that there is nothing like this for OO Calc.
Specifically I am minimizing a function that represents the "residual
error" or sums of squares of errors (SSE) between a set of data and a
model for it consisting of several (four in my case) parameters. The
model is non-linear, so an iterative routine that can improve/minimize
the SSE is required.

I have found and tried several solver type add ins for Calc, all of
which claimed to be "non linear solvers" only to find that the
non-linear implementation was either missing, or was for systems of
equations with constraints (the latter is often termed "non-linear
programming"). I did eventually happen upon a post from a few years ago
by someone named Robert ??? which is an OO Basic implementation of the
Nelder-Mead Simplex algorithm. This works well, but must be called as a
function. I would like to see something similar implemented as an
extension, which would be straightforward for people to use.

I have experience with the Nelder Mead Simplex, and have written a
simulated annealing optimization program in C++ and published a paper in
which it was used for some very non-linear data fitting. Either of these
could be implemented, although the simulated annealing routine is
probably more complicated that what is really needed. If one or more
people would be willing to help develop the parameter dialog interface
and can do the bindings required to tie in the C++ code to open office
so it can become an extension I would be very willing to work with them.
I've read online about the process and it seems to be rather daunting to
me. I am really just a scientist/engineer and I cannot pull off the OO
interface on my own... I am used to writing for linux (Cygwin) and
compiling under gcc.

Anyone want to help with this or form a project team on Sourceforge or
similar?

-Charlie
Reply | Threaded
Open this post in threaded view
|

Re: non-linear minimization/solver extension project for Calc

Ariel Constenla-Haile-2
Hi,

On Thu, Dec 13, 2012 at 11:45:16AM -0800, [hidden email] wrote:
> I have experience with the Nelder Mead Simplex, and have written a
> simulated annealing optimization program in C++ and published a
> paper in which it was used for some very non-linear data fitting.
> Either of these could be implemented, although the simulated
> annealing routine is probably more complicated that what is really
> needed. If one or more people would be willing to help develop the
> parameter dialog interface

You don't need to implement a dialog, all you need to do is develop
a class that implements some interfaces
http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSolver.html
http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSolverDescription.html

In code, it's a header file and one or two sources, look at the current
linear implementation:
http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/sccomp/source/solver/

> and can do the bindings required to tie
> in the C++ code to open office so it can become an extension I would
> be very willing to work with them. I've read online about the
> process and it seems to be rather daunting to me. I am really just a
> scientist/engineer and I cannot pull off the OO interface on my
> own... I am used to writing for linux (Cygwin) and compiling under
> gcc.

Note that you can do it as an extension, without needing to compile the
whole OpenOffice code, simply install the SDK from
http://www.openoffice.org/download/other.html#tested-sdk

The SDK on Windows does not work with cygwin, simply make, zip (sed and
cat for AOO 4.0), and the MS compiler (I only tried with the 2008
Express edition).

> Anyone want to help with this or form a project team on Sourceforge
> or similar?

I can make an skeleton for the add-in extension if you want. I prefer
working in Apache Extras
http://code.google.com/a/apache-extras.org/hosting/ (it's Google Code,
if you're already familiar with it).

Of course, if you are willing to, it could be added to the application
source code (but this way, you will need a core developer, and testing
will imply compiling the whole OpenOffice source code).


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

attachment0 (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: non-linear minimization/solver extension project for Calc

Jürgen Schmidt-3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 12/13/12 9:21 PM, Ariel Constenla-Haile wrote:

> Hi,
>
> On Thu, Dec 13, 2012 at 11:45:16AM -0800, [hidden email]
> wrote:
>> I have experience with the Nelder Mead Simplex, and have written
>> a simulated annealing optimization program in C++ and published a
>> paper in which it was used for some very non-linear data fitting.
>> Either of these could be implemented, although the simulated
>> annealing routine is probably more complicated that what is
>> really needed. If one or more people would be willing to help
>> develop the parameter dialog interface
>
> You don't need to implement a dialog, all you need to do is develop
> a class that implements some interfaces
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSolver.html
>
>
>
http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSolverDescription.html

>
> In code, it's a header file and one or two sources, look at the
> current linear implementation:
> http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/sccomp/source/solver/
>
>
>
>> and can do the bindings required to tie in the C++ code to open
>> office so it can become an extension I would be very willing to
>> work with them. I've read online about the process and it seems
>> to be rather daunting to me. I am really just a
>> scientist/engineer and I cannot pull off the OO interface on my
>> own... I am used to writing for linux (Cygwin) and compiling
>> under gcc.
>
> Note that you can do it as an extension, without needing to
> compile the whole OpenOffice code, simply install the SDK from
> http://www.openoffice.org/download/other.html#tested-sdk
>
> The SDK on Windows does not work with cygwin, simply make, zip
> (sed and cat for AOO 4.0), and the MS compiler (I only tried with
> the 2008 Express edition).
>
>> Anyone want to help with this or form a project team on
>> Sourceforge or similar?
>
> I can make an skeleton for the add-in extension if you want. I
> prefer working in Apache Extras
> http://code.google.com/a/apache-extras.org/hosting/ (it's Google
> Code, if you're already familiar with it).
>
> Of course, if you are willing to, it could be added to the
> application source code (but this way, you will need a core
> developer, and testing will imply compiling the whole OpenOffice
> source code).

or starting with a Java test first which should be the easiest one
using the NetBeans plugin.

I found
http://commons.apache.org/math/apidocs/org/apache/commons/math/optimization/direct/NelderMeadSimplex.html

But if you are interested to dive deeper in the code it would be
perfect to have it in the core directly later ;-)

Building AOO on Linux should be possible, it is probably the easiest
platform to get started with and when you already have experience here.

Anyway welcome at Apache OpenOffice and feel free to ask further questions

Juergen




-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBCgAGBQJQyv6rAAoJEM/u8xZRtf3on8EP/2GS5bCF6pv/gybhgm/5YWey
EnMnE5WRLxRrqK+PpFqhmm7jhUmjohOpDhreSh+nUDj+LU5fei7wMRMy1qTklmXx
S5ByzdbOxeRKIKRFomdbO3egVO7rvVqYY3eArjKtgsVkIW67XsBprOn6PEW7GgUi
mqKDCPEz+jeh02TrymFgWUAB2Qq4mTU5Vw40FUb0ayOvS+xHJkXN9+fBCpTfvHuG
SnG6HybdsWU3f2c3TPJ3R758kNQVN6ywtsFJqQz3hVdC5Z0P4CZFBFLqSNEOW/UK
i6Wf9iIbXJ+KGONOUPYbcMFTH8pge3Q/wfa7xzEcW6PLzzOmHPZqEvONw3hsL6cx
KLdZh9y2rKyyDji3wXOTXlQgD2/sDFY6QOi7n4y1cp175n1M2soKVjxBUZbGglEO
tvN0g0X72+aS/YaJIbbY0K3ZQi/0ydm6Eh0ZaiPouP0X3UmfADobSbey8SEiRCng
AGixYYZe7hX7gP0ZgKQ2Ez8m1vV5E7CbwNPFUQy5GMHT7QSrVz3ZKG24OACFdtUX
2AUoOkMhT1YkKEb3D9/qfGiD1plkqn+Hz54GUOD7Ax6SH4a3a2WF9DNXb7Zz95gH
lI49Fx3Mp5Q9/cJhkWmvxyukeOmdO2lhpnp20N4R0TD7AnxWpwhUCgZTSiWgRu60
c2jP7B11uqUKGvHx7y7i
=Jzok
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: non-linear minimization/solver extension project for Calc

oo-dev-email
On 14-12-2012 02:25, Jürgen Schmidt wrote:

> I found
>
> http://commons.apache.org/math/apidocs/org/apache/commons/math/optimization/direct/NelderMeadSimplex.html
>
> But if you are interested to dive deeper in the code it would be
> perfect to have it in the core directly later ;-)
>
> Building AOO on Linux should be possible, it is probably the easiest
> platform to get started with and when you already have experience
> here.
>
> Anyway welcome at Apache OpenOffice and feel free to ask further
> questions
>
> Juergen
>

Thanks for replying with this link. I am not at all familiar with this
stuff, but this is essentially it. How does this class get implemented
into something and end user can access?
Reply | Threaded
Open this post in threaded view
|

Re: non-linear minimization/solver extension project for Calc

Jürgen Schmidt-3


Am Freitag, 14. Dezember 2012 um 18:56 schrieb [hidden email]:

> On 14-12-2012 02:25, Jürgen Schmidt wrote:
> > I found
> >  
> > http://commons.apache.org/math/apidocs/org/apache/commons/math/optimization/direct/NelderMeadSimplex.html
> >  
> > But if you are interested to dive deeper in the code it would be
> > perfect to have it in the core directly later ;-)
> >  
> > Building AOO on Linux should be possible, it is probably the easiest
> > platform to get started with and when you already have experience  
> > here.
> >  
> > Anyway welcome at Apache OpenOffice and feel free to ask further  
> > questions
> >  
> > Juergen
>  
> Thanks for replying with this link. I am not at all familiar with this  
> stuff, but this is essentially it. How does this class get implemented  
> into something and end user can access?
>  
>  

Ariel gave already the link to the XSolver, XSolverDescription interfaces. See also the Solver service. You have to implement a new UNO component implementing this interfaces. Packaged as oxt and deployed it should appear in the solver dialog as further solver engine. Maybe some further config files are necessary, I haven't checked the code in detail. Use NetBeans and the OpenOffice API plugin to play with it and to get experience with the whole stuff.

Juergen