16#if defined(_WIN32) && !defined(_WIN64)
17#define dec_directives_win32
36#ifdef dec_directives_win32
47 INTEGER,
Dimension(:),
Pointer :: cntvect
54 real*8 time0, time1, time2
77 coi_error = max( coi_error,
coidef_numnz( cntvect, n*n ) )
89 coi_error = max( coi_error,
coidef_optfile( cntvect,
'mp_lincns2.opt' ) )
100#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
101 coi_error = max( coi_error,
coidef_license( cntvect, conopt_license_int_1, conopt_license_int_2, conopt_license_int_3, conopt_license_text) )
104 If ( coi_error .ne. 0 )
THEN
106 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
108 call flog(
"Skipping Solve due to setup errors", 1 )
113 time0 = omp_get_wtime()
115 time1 = omp_get_wtime() - time0
118 write(*,*)
'Single Thread: End of LinCns2. Return code=',coi_error
120 If ( coi_error /= 0 )
then
121 call flog(
"Single Thread: Errors encountered during solution", 1 )
122 elseif ( stacalls == 0 .or. solcalls == 0 )
then
123 call flog(
"Single Thread: Status or Solution routine was not called", 1 )
124 elseif ( mstat /= 15 .or. sstat /= 1 )
then
125 call flog(
"Single Thread: The model or solver status was not (15,1) as expected", 1 )
126 elseif (
miter /= 1 )
then
127 call flog(
"Single Thread: The iteration count was not 1 as expected", 1 )
133 time0 = omp_get_wtime()
135 time2 = omp_get_wtime() - time0
138 write(*,*)
'Multiple Threads: End of LinCns2. Return code=',coi_error
140 If ( coi_error /= 0 )
then
141 call flog(
"Multiple Threads: Errors encountered during solution", 1 )
142 elseif ( stacalls == 0 .or. solcalls == 0 )
then
143 call flog(
"Multiple Threads: Status or Solution routine was not called", 1 )
144 elseif ( mstat /= 15 .or. sstat /= 1 )
then
145 call flog(
"Multiple Threads: The model or solver status was not (15,1) as expected", 1 )
146 elseif (
miter /= 1 )
then
147 call flog(
"Multiple Threads: The iteration count was not 1 as expected", 1 )
150 if (
coi_free( cntvect ) /= 0 )
call flog(
"Error while freeing control vector", 1 )
153 write(*,
"('Time for single thread',f10.3)") time1
154 write(*,
"('Time for multi thread',f10.3)") time2
155 write(*,
"('Speedup ',f10.3)") time1/time2
156 write(*,
"('Efficiency ',f10.3)") time1/time2/omp_get_max_threads()
158 call flog(
"Successful Solve", 0 )
170 colsta, rowno, value, nlflag, n, m, nz, usrmem )
171#ifdef dec_directives_win32
175 integer,
intent (in) :: n
176 integer,
intent (in) :: m
177 integer,
intent (in) :: nz
178 real*8,
intent (in out),
dimension(n) :: lower
179 real*8,
intent (in out),
dimension(n) :: curr
180 real*8,
intent (in out),
dimension(n) :: upper
181 integer,
intent (in out),
dimension(n) :: vsta
183 integer,
intent (out),
dimension(m) ::
type
184 integer,
intent (in out),
dimension(m) :: esta
186 real*8,
intent (in out),
dimension(m) :: rhs
187 integer,
intent (in out),
dimension(n+1) :: colsta
188 integer,
intent (out),
dimension(nz) :: rowno
189 integer,
intent (in out),
dimension(nz) :: nlflag
190 real*8,
intent (in out),
dimension(nz) ::
value
223 value(k) = 2.0d0**(-abs(i+j-(n+1)))
224 rhs(j) = rhs(j) + value(k)
234Integer Function lincns_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
235#ifdef dec_directives_win32
244 INTEGER,
Intent(IN) :: n, m
245 INTEGER,
Intent(IN),
Dimension(N) :: xbas, xsta
246 INTEGER,
Intent(IN),
Dimension(M) :: ybas, ysta
247 real*8,
Intent(IN),
Dimension(N) :: xval, xmar
248 real*8,
Intent(IN),
Dimension(M) :: yval, ymar
249 real*8,
Intent(IN OUT) :: usrmem(*)
252 CHARACTER*5,
Parameter,
Dimension(4) :: stat = (/
'Lower',
'Upper',
'Basic',
'Super' /)
258 WRITE(10,
"(/' Variable Solution value Reduced cost B-stat')")
260 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, xval(i), xmar(i), stat(1+xbas(i))
261 If ( abs(xval(i)-1.d0) > 1.d-7 )
then
262 write(10,*)
'**** Bad solution value'
268 WRITE(10,
"(/' Constrnt Activity level Marginal cost B-stat')")
270 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5 )") i, yval(i), ymar(i), stat(1+ybas(i))
273 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)