used the function nconf in IMSL library to solve a constrained nonlinear optimization problem. I simplified the problem to describe the error occurred.
The objective function is log(x1 * x2 - x3 ^ 2). The constrain is x1 * x2 - x3 ^ 2 > 0. The fortran code is as followed.
program main use IMSL integer IBTYPE, IPRINT, M, MAXITN, ME, N parameter (IBTYPE = 0, IPRINT = 0, M = 1, MAXITN = 100, ME = 0, N = 3) real FVALUE, X(N), XGUESS(N), XLB(N), XSCALE(N), XUB(N) external FCN data XGUESS/10.0E0, 10.0E0, 2.0E0/, XSCALE/3*1.0E0/ data XLB/1.0E-6, 1.0E-6, 1E-6/, XUB/50, 50, 50/ open(44, file = "test.txt", status = "unknown") call NCONF(FCN, M, ME, N, XGUESS, IBTYPE, XLB, XUB, XSCALE, IPRINT, MAXITN, X, FVALUE) write(*, *) X end program subroutine FCN(M, ME, N, X, ACTIVE, F, G) integer M, ME, N real X(3), F, G(*) logical ACTIVE(*) ACTIVE(1) = .TRUE. IF(ACTIVE(1)) G(1) = X(1) * x(2) - x(3) ** 2 write(44, *) x F = log(x(1) * x(2) - x(3) ** 2) write(44, *) F return end subroutine
When I ran the code, the constraint doesn't work. nconf do search a (x1, x2, x3) that makes x1 * x2 - x3 ^ 2 < 0.x1 * x2 - x3 ^ 2 < 0 is in the log function . It can't be negative. If the constrain works, x1 * x2 - x3 ^ 2 should not be negative.
I don't know how the nconf function search point x and how the constrain works.