49 INTEGER :: numcallback
50 INTEGER,
Dimension(:),
Pointer :: cntvect
57 Allocate( cntvect(numcallback) )
72 coi_error = max( coi_error,
coidef_numcon( cntvect, 1 + 6 * t ) )
78 coi_error = max( coi_error,
coidef_numnz( cntvect, 17 * t + 4 * (t-1) ) )
98 coi_error = max( coi_error,
coidef_optfile( cntvect,
'test.opt' ) )
110#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
111 coi_error = max( coi_error,
coidef_license( cntvect, license_int_1, license_int_2, license_int_3, license_text) )
114 If ( coi_error .ne. 0 )
THEN
116 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
118 call flog(
"Skipping Solve due to setup errors", 1 )
126 write(*,*)
'End of Pinsquare Model. Return code=',coi_error
128 If ( coi_error /= 0 )
then
129 call flog(
"Errors encountered during solution", 1 )
131 call flog(
"Status or Solution routine was not called", 1 )
133 call flog(
"The model or solver status was not (16,1) as expected", 1 )
136 if ( coi_free(cntvect) /= 0 )
call flog(
"Error while freeing control vector",1)
138 call flog(
"Successful Solve", 0 )
150 colsta, rowno, value, nlflag, n, m, nz, usrmem )
156 integer,
intent (in) :: n
157 integer,
intent (in) :: m
158 integer,
intent (in) :: nz
159 real*8,
intent (in out),
dimension(n) :: lower
160 real*8,
intent (in out),
dimension(n) :: curr
161 real*8,
intent (in out),
dimension(n) :: upper
162 integer,
intent (in out),
dimension(n) :: vsta
164 integer,
intent (out),
dimension(m) ::
type
165 integer,
intent (in out),
dimension(m) :: esta
167 real*8,
intent (in out),
dimension(m) :: rhs
168 integer,
intent (in out),
dimension(n+1) :: colsta
169 integer,
intent (out),
dimension(nz) :: rowno
170 integer,
intent (in out),
dimension(nz) :: nlflag
171 real*8,
intent (in out),
dimension(nz) ::
value
174 Integer :: it, is, i, icol, iz
201 curr(is+4) = curr(is+1) - curr(is+3)
202 if ( it .gt. 1 )
then
203 curr(is+5) = curr(is+5-7) - curr(is+4)
205 curr(is+5) = 500.d0 - curr(is+4)
211 lower(is+6) = curr(is+6)
212 upper(is+6) = curr(is+6)
243 rhs(is+1) = 1.d0+2.3d0*1.015d0**(it-1)
248 rhs(2) = rhs(2) + 0.87d0*18.d0
252 rhs(3) = 0.75d0*6.5d0
307 if ( it .lt. t )
then
325 if ( it .lt. t )
then
348 if ( it .lt. t )
then
382 if ( it .lt. t )
then
409 value(iz) = 1.05d0**(1-it)
430Integer Function pin_fdeval( x, g, jac, rowno, jcnm, mode, ignerr, errcnt, &
431 n, nz, thread, usrmem )
437 integer,
intent (in) :: n
438 integer,
intent (in) :: rowno
439 integer,
intent (in) :: nz
440 real*8,
intent (in),
dimension(n) :: x
441 real*8,
intent (in out) :: g
442 real*8,
intent (in out),
dimension(n) :: jac
443 integer,
intent (in),
dimension(nz) :: jcnm
445 integer,
intent (in) :: mode
447 integer,
intent (in) :: ignerr
449 integer,
intent (in out) :: errcnt
451 integer,
intent (in) :: thread
462 if ( rowno == (it-1)*6+3 )
then
466 h1 = (1.1d0+0.1d0*x(is+6))
467 h2 = 1.02d0**(-x(is+2)/7.d0)
468 if ( mode == 1 .or. mode == 3 )
then
471 if ( mode == 2 .or. mode == 3 )
then
472 jac(is+2) = h1*h2*log(1.02d0)/7.d0
473 jac(is+6) = -h2*0.1d0
475 elseif ( rowno == (it-1)*6+7 )
then
479 if ( mode == 1 .or. mode == 3 )
then
480 g = -x(is+4)*(x(is+6)-250.d0/x(is+5))
482 if ( mode == 2 .or. mode == 3 )
then
483 jac(is+4) = -(x(is+6)-250.d0/x(is+5))
484 jac(is+5) = -x(is+4)*250d0/x(is+5)**2
492 write(*,*)
'Error. FDEval called with rowno=',rowno
499Integer Function pin_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
509 INTEGER,
Intent(IN) :: n, m
510 INTEGER,
Intent(IN),
Dimension(N) :: xbas, xsta
511 INTEGER,
Intent(IN),
Dimension(M) :: ybas, ysta
512 real*8,
Intent(IN),
Dimension(N) :: xval, xmar
513 real*8,
Intent(IN),
Dimension(M) :: yval, ymar
514 real*8,
Intent(IN OUT) :: usrmem(*)
515 character*6,
parameter,
dimension(7) :: vname = (/
'td ',
'cs ',
's ',
'd ',
'r ',
'p ',
'rev '/)
516 character*6,
parameter,
dimension(6) :: ename = (/
'tddef ',
'sdef ',
'csdef ',
'ddef ',
'rdef ',
'revdef'/)
519 CHARACTER*5,
Parameter,
Dimension(4) :: stat = (/
'Lower',
'Upper',
'Basic',
'Super' /)
521 WRITE(10,
"(/' Variable Solution value Reduced cost B-stat'/)")
526 WRITE(10,
"(1X,A6,i2,1p,E20.6,E16.6,4X,A5 )") vname(i1), it, xval(i), xmar(i), stat(1+xbas(i))
530 WRITE(10,
"(/' Constrnt Activity level Marginal cost B-stat'/)")
532 WRITE(10,
"(1x,'Objective',1P,E19.6,E16.6,4X,A5 )") yval(i), ymar(i), stat(1+ybas(i))
536 WRITE(10,
"(1x,A6,i2,1P,E20.6,E16.6,4X,A5 )") ename(i1),it, yval(i), ymar(i), stat(1+ybas(i))
integer function std_status(modsta, solsta, iter, objval, usrmem)
integer function std_message(smsg, dmsg, nmsg, llen, usrmem, msgv)
integer function std_triord(mode, type, status, irow, icol, inf, value, resid, usrmem)
integer function std_errmsg(rowno, colno, posno, msglen, usrmem, msg)
integer function pin_fdeval(x, g, jac, rowno, jcnm, mode, ignerr, errcnt, n, nz, thread, usrmem)
Compute nonlinear terms and non-constant Jacobian elements.
integer function pin_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
integer function pin_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
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_triord(cntvect, coi_triord)
define callback routine for providing the triangular order information.
integer function coidef_square(cntvect, square)
square models.
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)
program pinsquare
Main program. A simple setup and call of CONOPT.