47 Integer,
save :: seed = 12359
49 seed = mod(seed*1027+25,1048576)
50 rndx = float(seed)/float(1048576)
62 real*8,
Parameter :: xtarg = -1.0
63 real*8,
Parameter :: noise = 1.0
64 Real,
External :: Rndx
73 o = o + a(i,k,j) * xtarg + b(i,k,j) * xtarg**2
75 obs(i,k) = o + noise * rndx()
112 INTEGER :: numcallback
113 INTEGER,
Dimension(:),
Pointer :: cntvect
125 Allocate( cntvect(numcallback) )
136 coi_error = max( coi_error,
coidef_optfile( cntvect,
'Minimax07.opt' ) )
148#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
149 coi_error = max( coi_error,
coidef_license( cntvect, license_int_1, license_int_2, license_int_3, license_text) )
152 If ( coi_error .ne. 0 )
THEN
154 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
156 call flog(
"Skipping Solve due to setup errors", 1 )
168 write(*,*)
'End of Minimax07 example 1. Return code=',coi_error
170 If ( coi_error /= 0 )
then
171 call flog(
"Errors encountered during solution", 1 )
173 call flog(
"Status or Solution routine was not called", 1 )
174 elseif ( .not. (
sstat == 1 .and.
mstat == 2 ) )
then
175 call flog(
"Solver or Model status was not as expected (1,2)", 1 )
182 if ( coi_free(cntvect) /= 0 )
call flog(
"Error while freeing control vector",1)
184 call flog(
"Successful Solve", 0 )
196 colsta, rowno, value, nlflag, n, m, nz, &
203 integer,
intent (in) :: n
204 integer,
intent (in) :: m
205 integer,
intent (in) :: nz
206 real*8,
intent (in out),
dimension(n) :: lower
207 real*8,
intent (in out),
dimension(n) :: curr
208 real*8,
intent (in out),
dimension(n) :: upper
209 integer,
intent (in out),
dimension(n) :: vsta
211 integer,
intent (out),
dimension(m) ::
type
212 integer,
intent (in out),
dimension(m) :: esta
214 real*8,
intent (in out),
dimension(m) :: rhs
215 integer,
intent (in out),
dimension(n+1) :: colsta
216 integer,
intent (out),
dimension(nz) :: rowno
217 integer,
intent (in out),
dimension(nz) :: nlflag
218 real*8,
intent (in out),
dimension(nz) ::
value
221 Integer :: i, j, k, l, nzc
275 do i = 3*
nobs*dimk+1, 3*
nobs*dimk+dimk
282 type(3*
nobs*dimk+dimk+1) = 3
312 rowno(nzc) = k+dimk*(i-1)
316 rowno(nzc) = 3*
nobs*dimk+k
324 colsta(
dimx*dimk+k+dimk*(i-1)) = nzc
325 rowno(nzc) = k+dimk*(i-1)
329 rowno(nzc) =
nobs*dimk+k+dimk*(i-1)
333 rowno(nzc) = 2*
nobs*dimk+k+dimk*(i-1)
342 rowno(nzc) =
nobs*dimk+k+dimk*(i-1)
346 rowno(nzc) = 2*
nobs*dimk+k+dimk*(i-1)
353 rowno(nzc) =
nobs*dimk+k+1+dimk*(i-1)
356 rowno(nzc) = 2*
nobs*dimk+k+1+dimk*(i-1)
361 rowno(nzc) = 3*
nobs*dimk+dimk+1
366 colsta(
dimx*dimk+
nobs*dimk+dimk+1) = nzc
379Integer Function mm_fdeval( x, g, jac, rowno, jcnm, mode, ignerr, errcnt, &
380 n, nzc, thread, usrmem )
386 integer,
intent (in) :: n
387 integer,
intent (in) :: rowno
388 integer,
intent (in) :: nzc
389 real*8,
intent (in),
dimension(n) :: x
390 real*8,
intent (in out) :: g
391 real*8,
intent (in out),
dimension(n) :: jac
392 integer,
intent (in),
dimension(nzc) :: jcnm
394 integer,
intent (in) :: mode
396 integer,
intent (in) :: ignerr
398 integer,
intent (in out) :: errcnt
400 integer,
intent (in) :: thread
407 if ( rowno .le.
nobs*dimk )
then
415 i = (dimk+rowno-1)/dimk
417 if ( mode .eq. 1 .or. mode .eq. 3 )
then
421 s = s + a(i,k,j)*x(l) + b(i,k,j)*x(l)**2
428 if ( mode .eq. 2 .or. mode .eq. 3 )
then
431 jac(l) = a(i,k,j) + 2.d0*b(i,k,j)*x(l)
434 Else if ( rowno .le. 2*
nobs*dimk )
then
435 i = (dimk+rowno-
nobs*dimk-1)/dimk
436 k = rowno-
nobs*dimk-dimk*(i-1)-1
437 if ( mode .eq. 1 .or. mode .eq. 3 )
then
440 if ( mode .eq. 2 .or. mode .eq. 3 )
then
443 Else if ( rowno .le. 3*
nobs*dimk )
then
444 i = (dimk+rowno-2*
nobs*dimk-1)/dimk
445 k = rowno-2*
nobs*dimk-dimk*(i-1)-1
446 if ( mode .eq. 1 .or. mode .eq. 3 )
then
449 if ( mode .eq. 2 .or. mode .eq. 3 )
then
integer function std_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
integer function std_status(modsta, solsta, iter, objval, usrmem)
subroutine checkdual(case, minmax)
integer function std_message(smsg, dmsg, nmsg, llen, usrmem, msgv)
integer function std_errmsg(rowno, colno, posno, msglen, usrmem, msg)
integer function coidef_fdeval(cntvect, coi_fdeval)
define callback routine for performing function and derivative evaluations.
integer function coidef_errmsg(cntvect, coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
integer function coidef_message(cntvect, coi_message)
define callback routine for handling messages returned during the solution process.
integer function coidef_readmatrix(cntvect, coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
integer function coidef_status(cntvect, coi_status)
define callback routine for returning the completion status.
integer function coidef_solution(cntvect, coi_solution)
define callback routine for returning the final solution values.
integer function coidef_optfile(cntvect, optfile)
define callback routine for defining an options file.
integer function coidef_debugfv(cntvect, debugfv)
turn Debugging of FDEval on and off.
integer function coidef_license(cntvect, licint1, licint2, licint3, licstring)
define the License Information.
integer function coidef_numvar(cntvect, numvar)
defines the number of variables in the model.
integer function coidef_objcon(cntvect, objcon)
defines the Objective Constraint.
integer function coidef_numnz(cntvect, numnz)
defines the number of nonzero elements in the Jacobian.
integer function coidef_optdir(cntvect, optdir)
defines the Optimization Direction.
integer function coidef_numnlnz(cntvect, numnlnz)
defines the Number of Nonlinear Nonzeros.
integer function coidef_numcon(cntvect, numcon)
defines the number of constraints in the model.
integer function coidef_size()
returns the size the Control Vector must have, measured in standard Integer units.
integer function coidef_inifort(cntvect)
initialisation method for Fortran applications.
integer function coi_solve(cntvect)
method for starting the solving process of CONOPT.
void defdata()
Defines the data for the problem.
float rndx()
Defines a pseudo random number between 0 and 1.
program minimax07
Main program. A simple setup and call of CONOPT.
integer function mm_fdeval(x, g, jac, rowno, jcnm, mode, ignerr, errcnt, n, nz, thread, usrmem)
Compute nonlinear terms and non-constant Jacobian elements.
integer function mm_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
integer, parameter minimize
subroutine flog(msg, code)