This project is read-only.

Error with dll

Aug 22, 2015 at 11:19 PM
Hi, i cant seem to make this library work in my project, im using visual studio 2013.
I dont think i'll get any help though, this project seems abandoned :/
Aug 23, 2015 at 11:02 AM
The project is not abandoned, but is in a more-or-less finished state (and the fundamental mathematics is also more-or-less stable last time I checked), thus the lack of commits recently.

It's difficult to tell what your problem is with no information whatsoever. Maybe you're using the 32 bit DLLs but compiling 64 bit code? In that case the DLLs should be replaced.
Aug 23, 2015 at 4:43 PM
Well there are some issues in the issue tracker than have not been answered and they are from 2013.
There is very little documentation regarding installation. There isnt a nuget package.
I have everything in 32 bits.
There are 3 projects: FuncLib, FuncLibConsole and FuncLibIpopt
Where do i get the dll from and whats the difference?
First I tried adding the reference to FuncLib.dll in FuncLib folder.
The i runned this code to test:
// Variables. The string names are added for convenience when printing out the optimal point with Evaluation.ToString().
Variable x = new Variable("x");
Variable y = new Variable("y");

// Rosenbrock optimization test function.
Function f = Function.Sqr(1.0 - x) + 100.0 * Function.Sqr(y - Function.Sqr(x));

// Use the BFGS optimizer.
Optimizer o = new BfgsOptimizer();

// Specify variables and the objective function.
o.Variables.Add(x, y);
o.ObjectiveFunction = f;

// Start the optimizer from a random point.
Random r = new Random(1);
OptimizerResult or = (OptimizerResult) o.Run(x | r.NextDouble(), y | r.NextDouble());
Console.WriteLine(or.OptimalValue);
I get the following exception:
An unhandled exception of type 'System.BadImageFormatException' occurred in Program.exe
Additional information: Could not load file or assembly 'FuncLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Then i tried dlls in FuncLibIpopt: i add funcLib.dll, funcLibIpopt.dll, and i cant add ipopt39.dll nor IpOptFSS39.dll because the IDE says they are not valid assemblys
I get same exception.
Aug 23, 2015 at 5:01 PM
Also the version i get from the big Download button in the main page is ancient.
Aug 23, 2015 at 5:11 PM
Got it! i was building with the "any CPU" target platform.
And the library needs especifically the "x86" target.
Question. How to make it work with any cpu ?
Marked as answer by Chagui on 8/23/2015 at 5:32 PM
Aug 23, 2015 at 5:29 PM
Good. This is an open source project. Feel free to add any feature you like and submit them back.

The Ipopt DLLs are either 32 bit or 64 bit, unfortunately, and cannot be automatically chosen by the Visual Basic build process without dirty hacks. Maybe I'll change the references to 64 bit DLLs as that platform seem to be dominating now.
Aug 24, 2015 at 1:45 AM
Ok, thank you. I'll see what i can do about it.
I suggest you consider submitting your project to GitHub. Its more friendly when it comes to collaboration.
Also, i really suggest you submit the proyect to nuget.
Dec 16, 2016 at 7:27 AM
Hi,
I am desperately trying to make FuncLib work on VS 2015 but I get the same errors as Chagui and I can't find a how to make it work.

I downloaded FuncLib 0.4 from the website, then found a more recent version on http://www.java2s.com/Open-Source/CSharp_Free_Code/Numerical_Library/Download_FuncLib.htm.

I always get the following error message: Unable to load DLL 'Ipopt39': The specified module could not be found.

Could you please help me?

Thanks you