43 INTEGER,
Dimension(:),
Pointer :: cntvect
50 real*8 time0, time1, time2
55 coi_error = coi_createfort( cntvect )
73 coi_error = max( coi_error,
coidef_numnz( cntvect, n*n ) )
85 coi_error = max( coi_error,
coidef_optfile( cntvect,
'mp_lincns2.opt' ) )
96#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
97 coi_error = max( coi_error,
coidef_license( cntvect, license_int_1, license_int_2, license_int_3, license_text) )
100 If ( coi_error .ne. 0 )
THEN
102 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
104 call flog(
"Skipping Solve due to setup errors", 1 )
109 time0 = omp_get_wtime()
111 time1 = omp_get_wtime() - time0
114 write(*,*)
'Single Thread: End of LinCns2. Return code=',coi_error
116 If ( coi_error /= 0 )
then
117 call flog(
"Single Thread: Errors encountered during solution", 1 )
118 elseif ( stacalls == 0 .or. solcalls == 0 )
then
119 call flog(
"Single Thread: Status or Solution routine was not called", 1 )
120 elseif ( mstat /= 15 .or. sstat /= 1 )
then
121 call flog(
"Single Thread: The model or solver status was not (15,1) as expected", 1 )
122 elseif (
miter /= 1 )
then
123 call flog(
"Single Thread: The iteration count was not 1 as expected", 1 )
129 time0 = omp_get_wtime()
131 time2 = omp_get_wtime() - time0
134 write(*,*)
'Multiple Threads: End of LinCns2. Return code=',coi_error
136 If ( coi_error /= 0 )
then
137 call flog(
"Multiple Threads: Errors encountered during solution", 1 )
138 elseif ( stacalls == 0 .or. solcalls == 0 )
then
139 call flog(
"Multiple Threads: Status or Solution routine was not called", 1 )
140 elseif ( mstat /= 15 .or. sstat /= 1 )
then
141 call flog(
"Multiple Threads: The model or solver status was not (15,1) as expected", 1 )
142 elseif (
miter /= 1 )
then
143 call flog(
"Multiple Threads: The iteration count was not 1 as expected", 1 )
146 if ( coi_free( cntvect ) /= 0 )
call flog(
"Error while freeing control vector", 1 )
149 write(*,
"('Time for single thread',f10.3)") time1
150 write(*,
"('Time for multi thread',f10.3)") time2
151 write(*,
"('Speedup ',f10.3)") time1/time2
152 write(*,
"('Efficiency ',f10.3)") time1/time2/omp_get_max_threads()
154 call flog(
"Successful Solve", 0 )
166 colsta, rowno, value, nlflag, n, m, nz, usrmem )
171 integer,
intent (in) :: n
172 integer,
intent (in) :: m
173 integer,
intent (in) :: nz
174 real*8,
intent (in out),
dimension(n) :: lower
175 real*8,
intent (in out),
dimension(n) :: curr
176 real*8,
intent (in out),
dimension(n) :: upper
177 integer,
intent (in out),
dimension(n) :: vsta
179 integer,
intent (out),
dimension(m) ::
type
180 integer,
intent (in out),
dimension(m) :: esta
182 real*8,
intent (in out),
dimension(m) :: rhs
183 integer,
intent (in out),
dimension(n+1) :: colsta
184 integer,
intent (out),
dimension(nz) :: rowno
185 integer,
intent (in out),
dimension(nz) :: nlflag
186 real*8,
intent (in out),
dimension(nz) ::
value
219 value(k) = 2.0d0**(-abs(i+j-(n+1)))
220 rhs(j) = rhs(j) + value(k)
230Integer Function lincns_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
240 INTEGER,
Intent(IN) :: n, m
241 INTEGER,
Intent(IN),
Dimension(N) :: xbas, xsta
242 INTEGER,
Intent(IN),
Dimension(M) :: ybas, ysta
243 real*8,
Intent(IN),
Dimension(N) :: xval, xmar
244 real*8,
Intent(IN),
Dimension(M) :: yval, ymar
245 real*8,
Intent(IN OUT) :: usrmem(*)
248 CHARACTER*5,
Parameter,
Dimension(4) :: stat = (/
'Lower',
'Upper',
'Basic',
'Super' /)
254 WRITE(10,
"(/' Variable Solution value Reduced cost B-stat')")
256 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, xval(i), xmar(i), stat(1+xbas(i))
257 If ( abs(xval(i)-1.d0) > 1.d-7 )
then
258 write(10,*)
'**** Bad solution value'
264 WRITE(10,
"(/' Constrnt Activity level Marginal cost B-stat')")
266 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, yval(i), ymar(i), stat(1+ybas(i))
269 solcalls = solcalls + 1
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 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_threads(cntvect, threads)
number of threads allowed internally in CONOPT.
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_numnz(cntvect, numnz)
defines the number of nonzero elements in the Jacobian.
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 coi_solve(cntvect)
method for starting the solving process of CONOPT.
integer function lincns_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
integer function lincns_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
program lincns
Main program. A simple setup and call of CONOPT.
subroutine flog(msg, code)