cureos / csipopt

.NET interface to Ipopt non-linear optimizer
http://code.google.com/p/csipopt/
Eclipse Public License 1.0
19 stars 11 forks source link

SolveProblem_ExactHessian_NumberOfIterationsLessThanOrEqualToHessianApprox unit test failing in Debug/x86 mode #4

Closed cureos closed 12 years ago

cureos commented 12 years ago
System.AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Cureos.Numerics.IpoptAdapter.IpoptSolve(IntPtr ipopt_problem, Double[] x, Double[] g, ref Double obj_val, Double[] mult_g, Double[] mult_x_L, Double[] mult_x_U, IntPtr user_data)
at Cureos.Numerics.IpoptProblem.SolveProblem(Double[] x, ref Double obj_val, Double[] g, Double[] mult_g, Double[] mult_x_L, Double[] mult_x_U) in IpoptProblem.cs: line 574
at Cureos.Numerics.HS040NativeTests.SolveProblem_ExactHessian_NumberOfIterationsLessThanOrEqualToHessianApprox() in HS040NativeTests.cs: line 94
cureos commented 12 years ago

I used the 3.9.2 Ipopt DLL, debug, x86 version.

cureos commented 12 years ago

There might be a problem with the Debug, x86 Ipopt DLL? The above unit test is now succeeding, whereas the SolveProblem_StandardOptions_OptimalObjectiveValueReturned is now instead failing (only in Debug/x86 mode) with the following report:

SolveProblem_StandardOptions_OptimalObjectiveValueReturned : Failed  
Expected: 17.014017299999999d +/- 1.9999999999999999E-07d
But was:  16.109692919198878d
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.AssertDoublesAreEqual(Double expected, Double actual, Double delta, String message, Object[] args)
at NUnit.Framework.Assert.AreEqual(Double expected, Double actual, Double delta)
at Cureos.Numerics.HS071NativeTests.SolveProblem_StandardOptions_OptimalObjectiveValueReturned() in HS071NativeTests.cs: line 64 
cureos commented 12 years ago

Alternatively, the unit test is aborted altogether. The failure only seems to arise when running the unit tests as a suite (concurrency issues)? When running the unit test separately, it passes.

cureos commented 12 years ago

The issue appears to be Ipopt*.DLL dependent. Have tested 3.8.1 DLL:s, and these do not yield any error in any configuration. The 3.9.1 DLL:s also yield no error in any configuration, except that x64/Debug results in C++ runtime error for most tests (interestingly enough not for the HS071 tests...) Based on this investigation, I am urged to conclude that the issue is within the compilation of the Ipopt DLL:s and not csipopt. I will for now consider this issue completed. The recommendation is to use Release Ipopt DLL:s in production code involving csipopt.