Tuesday, October 5, 2010

IPOPT and F#

Theoretically, the C# interface that I developed for IPOPT should make it possible to access IPOPT from all .NET languages. To illustrate this, I recently implemented the basic HS071 example in C# and VB.NET versions.

As a proof-of-concept and as a first attempt to learn F#, I have now also implemented the HS071 example in F#. The F# source code can be found here. This is my first F# program ever, so I am sure it can be substantially improved. Nonetheless, it did compile and efficiently solved the HS071 example. Needless to say, I am pleased to have reached this far :-)

I have not yet packaged the F# example in a regular csipopt release, but the latest revision of the source code can be downloaded via a Subversion client. For further instructions, see this page.

Wednesday, May 26, 2010

IPOPT C# interface - now on Google code!

To make the C# interface to IPOPT more easily accessible, I have now created a code hosting project on Google Code, called csipopt.

After uploading the code, I also managed to solve one of the issues that I listed in the previous post, namely the inaccessibility of the log file.

Remains to be seen if the code hosting will enable further interest in the interface.

Thursday, May 20, 2010

IPOPT revisited

Why complicate things? In a few recent posts I outlined a way to use IPOPT from C#. To begin with, I created a DLL using MinGW and MSYS (described here), and I then called this DLL from C# using P/Invoke (here and here).

However, there is no need to build your own DLL, the considerate IPOPT maintainers have already done this for us! Pre-compiled DLL libraries (and include files for C/C++ users) are found here.

The binaries of the most recent IPOPT version (3.8.1), have been compiled with Visual Studio 2008 (C/C++) and Intel Fortran 8, if I understand correctly. As a test, I have taken the release version of Ipopt38.dll from the 32-bit distribution instead of the csipopt.dll I recently built, and called it from my C# interface. The new DLL works just fine, only faster...

I have noticed two issues, which I am yet to investigate further:

1. When using the debug DLL, I get an exception regarding the callback delegates. When using the release library, I do not encounter this problem. As far as I have been able to tell, data is consistently maintained throughout the optimization when using the release version.

2. The output file from IPOPT is inaccessible to other C# code, even after I have completed the optimization. I have not yet been able to determine if this is purely a timing issue, or if I am not releasing resources correctly in my C# interface.

Finally, I want to direct a sincere thank you to Ramnadh, who commented upon my first post on this matter, asking whether I had managed to build a corresponding DLL in Visual Studio. This comment lead me to looking at the pre-compiled binaries, which in the end turned out to be so successful. Thanks, Ramnadh!

Saturday, May 15, 2010


When I participated in the Swedish Radiotherapy Physicists' meeting in Kalmar earlier this year, Alan Nahum talked about a software for collecting and analyzing large amounts of radiotherapy treatment and response data, which has been developed by former colleagues to Alan.

The software is denoted VODCA, and more information can be found here. Very interesting project, I will try to keep a close eye on this one.

Open source radiotherapy optimization

I have recently spotted an open source attempt on radiotherapy optimization, namely the PheonixRT project. Source code is available here, and a wiki page is available here.

In particular, I find the approach of using differential dose-volume histograms in the objective function interesting. I am not convinced that this approach is easily extended to pure dose-volume objectives (e.g. maximum 30% of the volume should receive 40 Gy or more). Nonetheless, I think it is worth to explore this approach further to see if it can lead to smoother objective function formulations.

The optimization method is patented. How well does this rhyme with providing the code as open source?

Friday, May 14, 2010

Docking controls in WPF

I have recently used the Dockpanel Suite, developed by Weifen Luo, for managing the main window of the radiation commissioning software I have developed. The Dockpanel Suite is aimed for Windows Forms. There is a more recent Windows Presentation Foundation alternative WPF Docking also developed by Weifen Luo, albeit not open source.
Fortunately, there seems to be an open-source alternative: AvalonDock, which is available at Microsoft's Codeplex site.
I will further investigate if AvalonDock is a sufficient replacement for the Dockpanel Suite when moving into the WPF world.