[Solved] Help writing non-linear solver extension for Calc

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Help writing non-linear solver extension for Calc

Postby CLaub » Fri Dec 07, 2012 6:29 pm

I am appealing to readers here for help in the form of direct assistance, or pointing me to people or resources who might assist me. I am a scientist who has developed an optimization code based on simulated annealing and have worked with the Nelder Mead downhill simplex method. There does not seem to be a good general non-linear solver extension available for Calc, and I would like to create one from my work. I don't have the experience developing things on the OpenOffice end. I have read through some docs available online, but would really like to partner up with someone who has more experience in this area. My code is written in C++ and compiled with gcc. I would like everything to be under a very open license in the spirit of Open Office.

Please let me know if there is a person or group who can help with the development of the Calc interface for my code. Thanks

-CL
Last edited by CLaub on Tue Dec 11, 2012 7:28 pm, edited 2 times in total.
as of DEC2012 currently running: OpenOffice 3.4 on Windows Vista
CLaub
 
Posts: 4
Joined: Fri Dec 07, 2012 6:20 pm

Re: need HELP writing non-linear solver extension for Calc

Postby Villeroy » Fri Dec 07, 2012 6:55 pm

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: need HELP writing non-linear solver extension for Calc

Postby CLaub » Fri Dec 07, 2012 7:01 pm

Villeroy, Thanks for your reply.

I have already tried all of these except the EuroSolver Pro (which is not free).

None of them will solve my non-linear minimization problem.

Please note that I am not looking for a non-linear programming (systems of non-linear equations with constraints) solver. I need and want to create and extension that is optimizing a single "merit function" (for example a sum of squares of error) for a non-linear function in several variables. An example of the application would be curve fitting, or fitting a function to a set of data.
as of DEC2012 currently running: OpenOffice 3.4 on Windows Vista
CLaub
 
Posts: 4
Joined: Fri Dec 07, 2012 6:20 pm

Re: Help writing non-linear solver extension for Calc

Postby CLaub » Sat Dec 08, 2012 2:19 am

Well, it's not an extension, but I did find some OO Basic code that runs a Nelder-Mead Simplex non-linear minimization routine:
http://www.oooforum.org/forum/viewtopic.phtml?t=92089

It's actually pretty easy to implement: You open the OO Basic macro editor and paste in the code. Click Save.

To run the solver, use Tools>Macros>Run Macro and navigate to the macro name: MVOstart. This opens the dialog box and then you can start optimizing!

I tried this out and it works as advertised. But I would still like to write something like this to do simulated annealing using the code I developed previously...

-CL
as of DEC2012 currently running: OpenOffice 3.4 on Windows Vista
CLaub
 
Posts: 4
Joined: Fri Dec 07, 2012 6:20 pm

Re: Help writing non-linear solver extension for Calc

Postby Villeroy » Sun Dec 09, 2012 11:54 am

You have the algorithms written in some programming language.
You have the open source office suite with similar open source extensions and tons of documentation.
You are knowledgable about spreadsheets (data types, referencing, number formats under different locales).
Now it is your turn to combine all this and write your extension.
No, it is not trivial.
Yes, you can ask concrete questions here.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Help writing non-linear solver extension for Calc

Postby MrProgrammer » Mon Dec 10, 2012 5:50 pm

CLaub wrote:I am appealing to readers here for help in … pointing me to … resources [that] might assist me.
OpenOffice.org (OOo) Calc Add-in How-to
Developer's Guide: Extensions
Programmer’s Tutorial
Application Programming Interface Reference
Mr. Programmer
AOO 4.1.7 Build 9800 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3982
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Help writing non-linear solver extension for Calc

Postby CLaub » Mon Dec 10, 2012 8:58 pm

Thanks for the suggestions and the links. After reading through this, it still seems to be a daunting task.

I am now considering using a similar approach to the author of the Nelder Mead code that I linked to above. This would require a re-write of my application in OO Basic, meaning it must be used as a macro function... but it has already shown me how to create an input parameter dialog box, etc. and I think I would be comfortable working in this programming environment.

Are macros incorporated into and distributed as part of the Calc spreadsheet file?

-CL
as of DEC2012 currently running: OpenOffice 3.4 on Windows Vista
CLaub
 
Posts: 4
Joined: Fri Dec 07, 2012 6:20 pm

Re: Help writing non-linear solver extension for Calc

Postby MrProgrammer » Tue Dec 11, 2012 7:02 am

I'm really not the right person to answer this question, since I've only written a few simple macros and no extensions, but here's my answer based on what I've read in the forum.

CLaub wrote:Are macros incorporated into and distributed as part of the Calc spreadsheet file?
They could be. See Developers Guide > OpenOffice.org Basic > Advanced Library Organization > General Structure. The dialog is Tools > Macros > Organize Macros > OpenOffice Basic.

CLaub wrote:This would require a re-write of my application in OO Basic …
While you might need a front end written in Basic, I believe you can call your C++ routine from Basic and do most of the work there. I'm pretty sure this technique is discussed in the Macros and UNO API forum. Basic is a rather primitive language, best suited for simple tasks. For anything complex, use another language. Look first for posts on C++, but you'll have to do a web search for C++ site:openoffice.org since the search in this forum doesn't index the term "C++". If that doesn't help, look for posts on Python, not because you want to use that language, but because I believe you'll learn how to call another language from Basic. Others no doubt can help more than I. If it turns out that you can't call C++ from Basic, convert your code from C++ to Python, not C++ to Basic.

If no one else responds, I'd suggest posting a new question like "Can I call C++ from Basic?"
Mr. Programmer
AOO 4.1.7 Build 9800 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3982
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: [SOLVED] Help writing non-linear solver extension for Ca

Postby hanya » Tue Dec 11, 2012 7:48 pm

If no one else responds, I'd suggest posting a new question like "Can I call C++ from Basic?"
Windows environment supports declare statement but it depends on the library to access. The program written in C++ as standalone executable, it can be called through command line but the shell function of the Basic does not support standard input, so it should be connected with local file. If the library is packed as dynamic or static library, it can be wrapped as UNO component that can be called by any other language binding between UNO and target language if it is there. This way can be adapted to other language such as Java.
About a month ago, the following issue is opened with the patch to support declare command on other UNIX like environment: https://issues.apache.org/ooo/show_bug.cgi?id=112064
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: [SOLVED] Help writing non-linear solver extension for Ca

Postby robweir » Tue Dec 11, 2012 9:00 pm

CLaub wrote:I am appealing to readers here for help in the form of direct assistance, or pointing me to people or resources who might assist me. I am a scientist who has developed an optimization code based on simulated annealing and have worked with the Nelder Mead downhill simplex method. There does not seem to be a good general non-linear solver extension available for Calc, and I would like to create one from my work. I don't have the experience developing things on the OpenOffice end. I have read through some docs available online, but would really like to partner up with someone who has more experience in this area. My code is written in C++ and compiled with gcc. I would like everything to be under a very open license in the spirit of Open Office.

Please let me know if there is a person or group who can help with the development of the Calc interface for my code. Thanks

-CL


Hi CL,

Maybe I can help with your question.

The linear solver we have built in to Calc is based on code from the COIN-OR project: http://www.coin-or.org/index.html

They have some other solvers, as well, but we have not looked into integrated them yet. Having a similar interface across possible solvers would make the UI as well as the coding more consistent.

If you want to discuss more, I invite you to join our API mailing list. This is the list we use to discuss coding OpenOffice extensions. To join the list send an email to api-subscribe@openoffice.apache.org. And once you are subscribed you can post by sending an email to api@openoffice.apache.org.

Regards,

-Rob
OOo 3.3.0 through AOO 4.0.1 on Windows XP/7/8/8.1 and Ubuntu 12.04
Apache OpenOffice Committer/PMC
robweir
 
Posts: 51
Joined: Tue Feb 14, 2012 10:10 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests