Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7002 Discussions

strnlspbc_solve() changes all x values to nan; strnlsp_solve() hangs.

sgaumer
Beginner
1,008 Views

Reopening https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/strnlspbc-solve-changes-all-x-values-to-nan/m-p/1435190/highlight/true#M33945.

Code is in 05710106 and 05711432

During the RCI loop, strnlspbc_solve() can suddenly change all the x parameter values to nan.

 

For example, below is a sequence of what happens with the (13) x values. The solver doesn't recover from this.

 

Is this a feature? NaN is certainly outside the bounds. Is this the solver's way of saying that it cannot converge? Is it guaranteed that all the values will be nan? Are there other pathological values that the solver can set? What's the best way to check for this condition and handle it?

Thank you.

P.S. This situation is way better than the unbounded version, strnlsp_solve(), which hangs internally and never returns.

-----------------------------------

1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1331.94,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1329.27,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1143.58,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1141.3,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9493,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9274,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.95872,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.93883,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77698,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77343,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.5697,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56656,0,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0.001,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,-0.001,3159.36,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3162.52,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3156.2,6.06169,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06775,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.05563,5.05123,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05628,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.04618,1.78558,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78737,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78379,1.70316,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70486,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70146,0
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,0.001
1330.6,1142.44,10.9383,9.94877,1.77521,1.56813,0,3159.36,6.06169,5.05123,1.78558,1.70316,-0.001
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1071.48,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1069.34,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,325.139,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.489,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.7319,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.71246,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.4025,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.38372,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.03118,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02712,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.52079,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51775,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.228072,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227616,1904.56,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1906.46,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1902.65,6.4404,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.44685,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.43396,4.79253,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79733,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.78774,2.37283,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.3752,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37045,2.31391,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31622,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31159,0.0743298
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0744041
1070.41,324.814,9.72218,9.39311,2.02915,1.51927,0.227844,1904.56,6.4404,4.79253,2.37283,2.31391,0.0742555
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
987.461,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
985.488,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.824,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.072,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7859,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7623,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8681,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8463,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06667,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06454,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.942109,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.940226,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-1.00039,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.998387,2246.47,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2248.72,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2244.22,6.43891,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.44535,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43247,5.11562,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.12074,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11051,2.5202,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.52272,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.51768,3.40577,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40918,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40237,0.269949
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.270219
986.475,376.448,11.7741,10.8572,1.06561,0.941168,-0.999386,2246.47,6.43891,5.11562,2.5202,3.40577,0.269679
nan,nan,nan,nan,nan,nan,nan,nan,nan,nan,nan,nan,nan



0 Kudos
1 Solution
VidyalathaB_Intel
Moderator
706 Views

Hi Scott,

 

Thanks for your patience.

 

Our investigation shows that the reason behind getting NaN's is because of the below line 

float coeff1 = 1.f / 2.f / (1.f - x[RHO1I] * x[RHO1I]); in the code.

The value of coeff1 is the infinity when x[6] is set to -1 or 1. Division by zero might happen with x[12] (coeff2 is the infinity when fabs[x[12] ==1 since the admissible range for x[12] is [-1, 1]) .

strnlspbc_solve is a reverse-communication interface and it's impossible to control NaN's propagation in the your supplied function.

At each iteration, the trust region solver computes another vector 'delta x' and then it computes some value f( x ) - f( x + delta x ) where f is computed with the help of the user supplied function and hence doesn't have any control over delta x.

 

So except for setting eps_jac = 5e-6 there exist two other workarounds to get a solution.

 

1. to change lower and upper bounds for x[6] and x[12] and excludes the values where the user's objective function can be inf or nan.

2. To change expressions for computing coeff1 and coeff2

 

Please do let us know if you have any concerns.

 

Regards,

Vidya

 

View solution in original post

0 Kudos
4 Replies
VidyalathaB_Intel
Moderator
951 Views

Hi Scott,


Thanks for reaching out to us again.

I tested the reproducer codes provided in 05676034.

As you mentioned testing the example of the bounds-constrained version gives NaN in ?trnlsp_solve, 0 output

whereas testing the example of the unbounded version hangs and never returns.

We are working on this issue and will get back to you soon with the details on this.

Meanwhile, you can try testing the examples codes provided here C:\Program Files (x86)\Intel\oneAPI\mkl\2023.0.0\examples\examples_core_c\c\nonlinear_solvers\source and see if that helps.


Regards,

Vidya.


0 Kudos
VidyalathaB_Intel
Moderator
840 Views

Hi Scott,

 

Apologies for the delay.

 

We are working on your issue, meanwhile could you please try increasing the accuracy to eps_jac = 5e-6 for the bounded version and eps_jac = 1e-5 for the unbounded version and let us know if the issue can be worked around for time being?

 

Please let us know if you have any issues in doing so.

 

Regards,

Vidya.

 

0 Kudos
VidyalathaB_Intel
Moderator
707 Views

Hi Scott,

 

Thanks for your patience.

 

Our investigation shows that the reason behind getting NaN's is because of the below line 

float coeff1 = 1.f / 2.f / (1.f - x[RHO1I] * x[RHO1I]); in the code.

The value of coeff1 is the infinity when x[6] is set to -1 or 1. Division by zero might happen with x[12] (coeff2 is the infinity when fabs[x[12] ==1 since the admissible range for x[12] is [-1, 1]) .

strnlspbc_solve is a reverse-communication interface and it's impossible to control NaN's propagation in the your supplied function.

At each iteration, the trust region solver computes another vector 'delta x' and then it computes some value f( x ) - f( x + delta x ) where f is computed with the help of the user supplied function and hence doesn't have any control over delta x.

 

So except for setting eps_jac = 5e-6 there exist two other workarounds to get a solution.

 

1. to change lower and upper bounds for x[6] and x[12] and excludes the values where the user's objective function can be inf or nan.

2. To change expressions for computing coeff1 and coeff2

 

Please do let us know if you have any concerns.

 

Regards,

Vidya

 

0 Kudos
VidyalathaB_Intel
Moderator
660 Views

Hi Scott,


As the issue is addressed we are closing this case. Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.


Regards,

Vidya.


0 Kudos
Reply