11#if defined(_WIN32) && !defined(_WIN64)
12#define dec_directives_win32
31#ifdef dec_directives_win32
42 INTEGER,
Dimension(:),
Pointer :: cntvect
51 real*8 time0, time1, time2
72 coi_error = max( coi_error,
coidef_numnz( cntvect, n*n ) )
84 coi_error = max( coi_error,
coidef_optfile( cntvect,
'mp_lincns.opt' ) )
95#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
96 coi_error = max( coi_error,
coidef_license( cntvect, conopt_license_int_1, conopt_license_int_2, conopt_license_int_3, conopt_license_text) )
99 If ( coi_error .ne. 0 )
THEN
101 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
103 call flog(
"Skipping Solve due to setup errors", 1 )
108 time0 = omp_get_wtime()
110 time1 = omp_get_wtime() - time0
113 write(*,*)
'Single Thread: End of LinCns. Return code=',coi_error
115 If ( coi_error /= 0 )
then
116 call flog(
"Single Thread: Errors encountered during solution", 1 )
117 elseif ( stacalls == 0 .or. solcalls == 0 )
then
118 call flog(
"Single Thread: Status or Solution routine was not called", 1 )
119 elseif ( mstat /= 15 .or. sstat /= 1 )
then
120 call flog(
"Single Thread: The model or solver status was not (15,1) as expected", 1 )
121 elseif (
miter /= 1 )
then
122 call flog(
"Single Thread: The iteration count was not 1 as expected", 1 )
128 time0 = omp_get_wtime()
130 time2 = omp_get_wtime() - time0
133 write(*,*)
'Multiple Threads: End of LinCns. Return code=',coi_error
135 If ( coi_error /= 0 )
then
136 call flog(
"Multiple Threads: Errors encountered during solution", 1 )
137 elseif ( stacalls == 0 .or. solcalls == 0 )
then
138 call flog(
"Multiple Threads: Status or Solution routine was not called", 1 )
139 elseif ( mstat /= 15 .or. sstat /= 1 )
then
140 call flog(
"Multiple Threads: The model or solver status was not (15,1) as expected", 1 )
141 elseif (
miter /= 1 )
then
142 call flog(
"Multiple Threads: The iteration count was not 1 as expected", 1 )
145 if (
coi_free( cntvect ) /= 0 )
call flog(
"Error while freeing control vector", 1 )
148 write(*,
"('Time for single thread',f10.3)") time1
149 write(*,
"('Time for multi thread',f10.3)") time2
150 write(*,
"('Speedup ',f10.3)") time1/time2
151 write(*,
"('Efficiency ',f10.3)") time1/time2/omp_get_max_threads()
153 call flog(
"Successful Solve", 0 )
165 colsta, rowno, value, nlflag, n, m, nz, usrmem )
166#ifdef dec_directives_win32
170 integer,
intent (in) :: n
171 integer,
intent (in) :: m
172 integer,
intent (in) :: nz
173 real*8,
intent (in out),
dimension(n) :: lower
174 real*8,
intent (in out),
dimension(n) :: curr
175 real*8,
intent (in out),
dimension(n) :: upper
176 integer,
intent (in out),
dimension(n) :: vsta
178 integer,
intent (out),
dimension(m) ::
type
179 integer,
intent (in out),
dimension(m) :: esta
181 real*8,
intent (in out),
dimension(m) :: rhs
182 integer,
intent (in out),
dimension(n+1) :: colsta
183 integer,
intent (out),
dimension(nz) :: rowno
184 integer,
intent (in out),
dimension(nz) :: nlflag
185 real*8,
intent (in out),
dimension(nz) ::
value
220 value(k) = (-1)**(i+j)*max(1.d-4, 2.0d0**(-abs(i+j-(n+1))))
221 rhs(j) = rhs(j) + value(k)
231Integer Function lincns_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
232#ifdef dec_directives_win32
241 INTEGER,
Intent(IN) :: n, m
242 INTEGER,
Intent(IN),
Dimension(N) :: xbas, xsta
243 INTEGER,
Intent(IN),
Dimension(M) :: ybas, ysta
244 real*8,
Intent(IN),
Dimension(N) :: xval, xmar
245 real*8,
Intent(IN),
Dimension(M) :: yval, ymar
246 real*8,
Intent(IN OUT) :: usrmem(*)
249 CHARACTER*5,
Parameter,
Dimension(4) :: stat = (/
'Lower',
'Upper',
'Basic',
'Super' /)
255 WRITE(10,
"(/' Variable Solution value Reduced cost B-stat')")
257 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, xval(i), xmar(i), stat(1+xbas(i))
258 If ( abs(xval(i)-1.d0) > 1.d-7 )
then
259 write(10,*)
'**** Bad solution value'
265 WRITE(10,
"(/' Constrnt Activity level Marginal cost B-stat')")
267 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, yval(i), ymar(i), stat(1+ybas(i))
270 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(c_int) function coidef_message(cntvect, coi_message)
define callback routine for handling messages returned during the solution process.
integer(c_int) function coidef_solution(cntvect, coi_solution)
define callback routine for returning the final solution values.
integer(c_int) function coidef_status(cntvect, coi_status)
define callback routine for returning the completion status.
integer(c_int) function coidef_readmatrix(cntvect, coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
integer(c_int) function coidef_errmsg(cntvect, coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
integer(c_int) function coidef_optfile(cntvect, optfile)
define callback routine for defining an options file.
integer(c_int) function coidef_triord(cntvect, coi_triord)
define callback routine for providing the triangular order information.
integer(c_int) function coidef_license(cntvect, licint1, licint2, licint3, licstring)
define the License Information.
integer(c_int) function coidef_square(cntvect, square)
square models.
integer(c_int) function coidef_threads(cntvect, threads)
number of threads allowed internally in CONOPT.
integer(c_int) function coidef_numvar(cntvect, numvar)
defines the number of variables in the model.
integer(c_int) function coidef_numcon(cntvect, numcon)
defines the number of constraints in the model.
integer(c_int) function coidef_numnlnz(cntvect, numnlnz)
defines the Number of Nonlinear Nonzeros.
integer(c_int) function coidef_numnz(cntvect, numnz)
defines the number of nonzero elements in the Jacobian.
integer(c_int) function coi_create(cntvect)
initializes CONOPT and creates the control vector.
integer(c_int) function coi_free(cntvect)
frees the control vector.
integer(c_int) 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)