Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28455 Discussions

BCONF cannot find the the true solution to a function minization problem

yuezhanwei
Beginner
370 Views
I use BCONF to solve a value minization problem for a two dimentional function. The function value is quite flat along one dimension. The difference over a big range is close to the 1.0E-15. BSCONF cannot find the true solution. Instead, I always just got the initial guess, no matter what that value is. I set the following parameter, but it does not help. Can someone help me with this problem? Thank you.
RPARAM(1) = 1.0E-16
RPARAM(2) = 1.0E-16
The code I used is

XGUESS = (/b_p, 2.E0/)
XSCALE = (/1.E0,0.01E0/)
XLB = (/B_min, S_min/)
XUB = (/B_max, S_max/)
FSCALE = 1.E0
ITP = 0;
CALL DU4INF (IPARAM, RPARAM)
IPARAM(1) = 1;
RPARAM(1) = 1.0E-16
RPARAM(2) = 1.0E-16
RPARAM(6) = 1.0E8
CALL D_BCONF(FirmValue, 0, XLB, XUB, X, XGUESS=XGUESS,XSCALE=XSCALE, RPARAM=rparam, & FVALUE=F)

Another question is that when I inclue IPARAM, defined as integer, I got an error,

CALL D_BCONF(FirmValue, 0, XLB, XUB, X, XGUESS=XGUESS,XSCALE=XSCALE, IPARAM=iparam, & RPARAM=rparam, FVALUE=F)

The error is:
error #6633: The type of the actual argument differs from the type of the dummy argument. [IPARAM]


An example of the function values over some grid points is
-0.117351401842974
-0.117351401842976
-0.117351401842978
-0.117351401842980
-0.117351401842980
-0.117351401842980
-0.117351401842980
-0.117351401842978
-0.117351401842977
-0.117351401842974
0 Kudos
1 Solution
Arjen_Markus
Honored Contributor I
370 Views
If the range of the function you want to minimise is so small, then you can not expect any
solution to be found! The variation is almost as small as the smallest variation you can have:

1.0d0+epsilon(1.0d0) /= 1.0d0

but

1.0d0+0.5*epsilon(1.0d0) can not be distinguished from 1.0d0.

So, unless you canchange the function in some wayso that the variation becomes clearer,
your onlyhope is to use quadruple precision.

Here is an example:

f(x) =exp(-1.0e-15*x**2)

with xwithin the range -1 to 1

This will most probably cause the same problems. If you modify the function, say,
minimise log(f(x)) or approximate f(x)-1 via the Taylor series, then the relative variation
will be much larger.

But: be careful! You can not simply do: g(x) = f(x)-1 because of rounding errors.
You will have to transform the function itself.

(I probably express myself in a very unclear way, but I have no time now to elaborate)

Regards,

Arjen

View solution in original post

0 Kudos
2 Replies
Arjen_Markus
Honored Contributor I
371 Views
If the range of the function you want to minimise is so small, then you can not expect any
solution to be found! The variation is almost as small as the smallest variation you can have:

1.0d0+epsilon(1.0d0) /= 1.0d0

but

1.0d0+0.5*epsilon(1.0d0) can not be distinguished from 1.0d0.

So, unless you canchange the function in some wayso that the variation becomes clearer,
your onlyhope is to use quadruple precision.

Here is an example:

f(x) =exp(-1.0e-15*x**2)

with xwithin the range -1 to 1

This will most probably cause the same problems. If you modify the function, say,
minimise log(f(x)) or approximate f(x)-1 via the Taylor series, then the relative variation
will be much larger.

But: be careful! You can not simply do: g(x) = f(x)-1 because of rounding errors.
You will have to transform the function itself.

(I probably express myself in a very unclear way, but I have no time now to elaborate)

Regards,

Arjen
0 Kudos
yuezhanwei
Beginner
370 Views
Thanks. This is a smart idea. I have transformed the function so that the range is much bigger.

Now my problem is probably with using BCONF. I still cannot find the true solution even though the function value ranges is the following. My code is

XGUESS = (/b_p, 2.E0/)
XSCALE = (/1.E0,0.01E0/)
XLB = (/B_min, S_min/)
XUB = (/B_max, S_max/)
FSCALE = 1.E0
ITP = 0;
CALL DU4INF (IPARAM, RPARAM)
IPARAM(1) = 1;
RPARAM(1) = 1.0E-16
RPARAM(2) = 1.0E-16
RPARAM(6) = 1.0E8
CALL D_BCONF(FirmValue, 0, XLB, XUB, X, XGUESS=XGUESS,XSCALE=XSCALE,RPARAM=rparam)
CALL ERSET (0, 1, 0)



-17.824207645
-17.824207879
-17.824208079
-17.824208246
-17.824208380
-17.824208481
-17.824208549
-17.824208583
-17.824208584
-17.824208551
-17.824208486
-17.82420839
-17.82420826
-17.82420809
-17.82420789
0 Kudos
Reply