64 INTEGER :: numcallback
65 INTEGER,
Dimension(:),
Pointer :: cntvect
73 Allocate( cntvect(numcallback) )
84 coi_error = max( coi_error,
coidef_optfile( cntvect,
'pen02.opt' ) )
95#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
96 coi_error = max( coi_error,
coidef_license( cntvect, license_int_1, license_int_2, license_int_3, license_text) )
99 If ( coi_error .ne. 0 )
THEN
101 write(*,*)
'**** Fatal Error while loading CONOPT4 Callback routines.'
103 call flog(
"Skipping Solve due to setup errors", 1 )
114 If ( coi_error /= 0 )
then
115 call flog(
"Case 1: Errors encountered during solution", 1 )
117 call flog(
"Case 1: Status or Solution routine was not called", 1 )
118 elseif (
sstat /= 1 )
then
119 call flog(
"Case 1: Solver Status was not 1 as expected.", 1 )
126 coi_error = max( coi_error,
coidef_itlim( cntvect, 1 ) )
128 If ( coi_error /= 0 )
then
129 call flog(
"Case 2: Errors encountered during solution", 1 )
131 call flog(
"Case 2: Status or Solution routine was not called", 1 )
132 elseif (
sstat /= 2 )
then
133 call flog(
"Case 2: Solver Status was not 2 as expected.", 1 )
140 coi_error = max( coi_error,
coidef_itlim( cntvect, 4 ) )
142 If ( coi_error /= 0 )
then
143 call flog(
"Case 3: Errors encountered during solution", 1 )
145 call flog(
"Case 3: Status or Solution routine was not called", 1 )
146 elseif (
sstat /= 2 )
then
147 call flog(
"Case 3: Solver Status was not 2 as expected.", 1 )
154 coi_error = max( coi_error,
coidef_itlim( cntvect, 10000 ) )
156 If ( coi_error /= 0 )
then
157 call flog(
"Case 4: Errors encountered during solution", 1 )
159 call flog(
"Case 4: Status or Solution routine was not called", 1 )
160 elseif (
sstat /= 1 )
then
161 call flog(
"Case 4: Solver Status was 1 not as expected.", 1 )
165 write(*,*)
'End of pen02 example. Return code=',coi_error
167 if ( coi_free(cntvect) /= 0 )
call flog(
"Error while freeing control vector",1)
169 call flog(
"Successful Solve", 0 )
181 colsta, rowno, value, nlflag, n, m, nz, &
188 integer,
intent (in) :: n
189 integer,
intent (in) :: m
190 integer,
intent (in) :: nz
191 real*8,
intent (in out),
dimension(n) :: lower
192 real*8,
intent (in out),
dimension(n) :: curr
193 real*8,
intent (in out),
dimension(n) :: upper
194 integer,
intent (in out),
dimension(n) :: vsta
196 integer,
intent (out),
dimension(m) ::
type
197 integer,
intent (in out),
dimension(m) :: esta
199 real*8,
intent (in out),
dimension(m) :: rhs
200 integer,
intent (in out),
dimension(n+1) :: colsta
201 integer,
intent (out),
dimension(nz) :: rowno
202 integer,
intent (in out),
dimension(nz) :: nlflag
203 real*8,
intent (in out),
dimension(nz) ::
value
215 if ( casenum == 1 )
Then
342Integer Function pen02_fdeval( x, g, jac, rowno, jcnm, mode, ignerr, errcnt, &
343 n, nz, thread, usrmem )
348 integer,
intent (in) :: n
349 integer,
intent (in) :: rowno
350 integer,
intent (in) :: nz
351 real*8,
intent (in),
dimension(n) :: x
352 real*8,
intent (in out) :: g
353 real*8,
intent (in out),
dimension(n) :: jac
354 integer,
intent (in),
dimension(nz) :: jcnm
356 integer,
intent (in) :: mode
358 integer,
intent (in) :: ignerr
360 integer,
intent (in out) :: errcnt
362 integer,
intent (in) :: thread
366 if ( rowno .eq. 1 )
then
371 elseif ( rowno .eq. 2 )
then
377 if ( mode .eq. 1 .or. mode .eq. 3 )
then
378 g = x(1)**2 + x(2)**2 + x(3)**2
383 if ( mode .eq. 2 .or. mode .eq. 3 )
then
388 elseif ( rowno .eq. 3 )
then
394 if ( mode .eq. 1 .or. mode .eq. 3 )
then
395 g = x(1)**3 + x(2)**3 + x(3)**3
400 if ( mode .eq. 2 .or. mode .eq. 3 )
then
401 jac(1) = 3.d0*x(1)**2
402 jac(2) = 3.d0*x(2)**2
403 jac(3) = 3.d0*x(3)**2
405 elseif ( rowno .eq. 4 )
then
411 if ( mode .eq. 1 .or. mode .eq. 3 )
then
412 g = x(2)**2 + x(3)**3
417 if ( mode .eq. 2 .or. mode .eq. 3 )
then
419 jac(3) = 3.d0*x(3)**2
421 elseif ( rowno .eq. 4 )
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)
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_itlim(cntvect, itlim)
define the Iteration Limit.
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.
subroutine flog(msg, code)
integer function pen02_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
program pen02
Main program. A simple setup and call of CONOPT.
integer function pen02_fdeval(x, g, jac, rowno, jcnm, mode, ignerr, errcnt, n, nz, thread, usrmem)
Compute nonlinear terms and non-constant Jacobian elements.