41 call flog(
"Starting to execute", 0 )
45 open(10,file=trim(
progname) //
'.lst',status=
'Unknown')
46 open(11,file=trim(
progname) //
'.sta',status=
'Unknown')
55 Subroutine flog( Msg, Code )
57 character(len=*),
Intent(IN) :: Msg
58 Integer,
Intent(IN) :: Code
60 open(15,file=trim(
progname) //
'.rc',action=
'write',form=
'formatted',status=
'unknown')
61 write(15,
"(A,': ',A)") trim(
progname), msg
81Integer Function std_status( MODSTA, SOLSTA, ITER, OBJVAL, USRMEM )
90 INTEGER,
Intent(IN) :: modsta, solsta, iter
91 real*8,
Intent(IN) :: objval
92 real*8,
Intent(IN OUT) :: usrmem(*)
95 WRITE(*,*)
'CONOPT has finished optimizing.'
96 WRITE(*,*)
'Model status =',modsta
97 WRITE(*,*)
'Solver status =',solsta
98 WRITE(*,*)
'Iteration count=',iter
99 WRITE(*,*)
'Objective value=',objval
102 WRITE(10,*)
'CONOPT has finished optimizing.'
103 WRITE(10,*)
'Model status =',modsta
104 WRITE(10,*)
'Solver status =',solsta
105 WRITE(10,*)
'Iteration count=',iter
106 WRITE(10,*)
'Objective value=',objval
109 WRITE(11,*)
'Model status =',modsta
110 WRITE(11,*)
'Solver status =',solsta
111 WRITE(11,*)
'Objective value=',objval
127Integer Function std_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
139 INTEGER,
Intent(IN) :: n, m
140 INTEGER,
Intent(IN),
Dimension(N) :: xbas, xsta
141 INTEGER,
Intent(IN),
Dimension(M) :: ybas, ysta
142 real*8,
Intent(IN),
Dimension(N) :: xval, xmar
143 real*8,
Intent(IN),
Dimension(M) :: yval, ymar
144 real*8,
Intent(IN OUT) :: usrmem(*)
147 CHARACTER*5,
Parameter,
Dimension(4) :: basc = (/
'Lower',
'Upper',
'Basic',
'Super' /)
148 CHARACTER*6,
Parameter,
Dimension(4) :: stat = (/
'Normal',
'NonOpt',
'Infeas',
'Unbnd ' /)
153 WRITE(10,
"(/' Variable Solution value Reduced cost Var-Basc Var-stat')")
155 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5,7X,A6 )") i, xval(i), xmar(i), basc(1+xbas(i)), stat(1+xsta(i))
161 WRITE(10,
"(/' Constrnt Activity level Marginal cost Con-Basc Con-stat')")
163 WRITE(10,
"(1P,I7,E20.6,E16.6,4X,A5,7X,A6 )") i, yval(i), ymar(i), basc(1+ybas(i)), stat(1+ysta(i))
168 if (
c_nonopt > 0 )
write(10,
"(/' Number of non-optimalities =',i5)")
c_nonopt
169 if (
c_infeas > 0 )
write(10,
"(/' Number of infeasibilities =',i5)")
c_infeas
176 If (
maxvar > 0 ) then; na =
maxvar; else; na = n;
Endif
177 If (
maxcon > 0 ) then; ma =
maxcon; else; ma = m;
Endif
181 If (
associated(
xprim) .and.
associated(
xdual) .and.
associated(
uprim) .and.
associated(
udual) )
Then
182 If (
Size(
xprim) >= n .and.
Size(
xdual) >= n .AND.
Size(
uprim) >= m .and.
Size(
udual) >= m )
Then
183 xprim(1:n) = xval(1:n)
184 xdual(1:n) = xmar(1:n)
185 uprim(1:m) = yval(1:m)
186 udual(1:m) = ymar(1:m)
189 If (
associated(
xbasc) .and.
associated(
xstat) .and.
associated(
ubasc) .and.
associated(
ustat) )
Then
190 If (
Size(
xbasc) >= n .and.
Size(
xstat) >= n .AND.
Size(
ubasc) >= m .and.
Size(
ustat) >= m )
Then
191 xbasc(1:n) = xbas(1:n)
192 xstat(1:n) = xsta(1:n)
193 ubasc(1:m) = ybas(1:m)
194 ustat(1:m) = ysta(1:m)
202Integer Function std_message( SMSG, DMSG, NMSG, LLEN, USRMEM, MSGV )
214 INTEGER,
Intent(IN) :: smsg, dmsg, nmsg
215 INTEGER,
Intent(IN) ,
Dimension(*) :: llen
216 CHARACTER(Len=133),
Intent(IN),
Dimension(*) :: msgv
217 real*8,
Intent(IN OUT) :: usrmem(*)
224 write(*,
"(A)") msgv(i)(1:llen(i))
230 write(11,
"(A)") msgv(i)(1:llen(i))
236 write(10,
"(A)") msgv(i)(1:llen(i))
247Integer Function std_errmsg( ROWNO, COLNO, POSNO, MSGLEN, USRMEM, MSG )
260 INTEGER,
Intent(IN) :: rowno, colno, posno, msglen
261 CHARACTER(len=*),
Intent(IN) :: msg
262 real*8,
Intent(IN OUT) :: usrmem(*)
268 IF ( rowno .EQ. 0 )
THEN
269 WRITE(10,1001) colno, msg(1:msglen)
270 WRITE(11,1001) colno, msg(1:msglen)
271 ELSEIF ( colno .EQ. 0 )
THEN
272 WRITE(10,1002) rowno, msg(1:msglen)
273 WRITE(11,1002) rowno, msg(1:msglen)
275 WRITE(10,1000) colno, rowno, msg(1:msglen)
276 WRITE(11,1000) colno, rowno, msg(1:msglen)
2821002
FORMAT(
'Equation',i8,
' : ',a)
2831001
FORMAT(
'Variable',i8,
' : ',a)
2841000
FORMAT(
'Variable',i8,
' appearing in Equation',i8,
' : ',a)
290Integer Function std_triord( Mode, Type, Status, Irow, Icol, Inf, Value, Resid, Usrmem )
298 INTEGER,
INTENT(IN) :: mode,
Type, status, irow, icol, inf
299 real*8,
INTENT(IN) ::
VALUE, resid
300 real*8,
Intent(IN OUT) :: usrmem(*)
302 include
'preaction.inc'
304 If ( mode == -1 )
THEN
305 write(10,
"(/'The preprocessing transformation are described below in detection order:'/)")
306 Else if ( mode == -2 )
Then
307 write(10,
"(//'The order of the critical transformations is:'/)")
312 WRITE(10,
"('Equation',i7,' solved with respect to variable',i7,'. Value=',1p,e18.10)") irow, icol,
value
313 Elseif ( inf == 1 )
Then
314 WRITE(10,
"('Equation',i7,' solved with respect to variable',i7,'. Value=',9x,'+Infinity')") irow, icol
316 WRITE(10,
"('Equation',i7,' solved with respect to variable',i7,'. Value=',9x,'-Infinity')") irow, icol
319 WRITE(10,
"('Variable',i7,' fixed at value=',1p,e18.10)") icol,
value
321 WRITE(10,
"('Equation',i7,' is dependent (all variables are fixed.)')") irow
323 WRITE(10,
"('Equation',i7,' is redundant (will later be solved with respect to the slack.)')") irow
325 WRITE(10,
"('Equation',i7,' turned into lower bound on variable',i7,'. Bound=',1p,e18.10)") irow, icol,
value
327 WRITE(10,
"('Equation',i7,' turned into upper bound on variable',i7,'. Bound=',1p,e18.10)") irow, icol,
value
329 WRITE(10,
"('Ranged Equation',i7,' turned into two bounds on variable',i7,'. Bound=',1p,e18.10)") irow, icol,
value
331 WRITE(10,
"('Variable',i7,' forced to lower bound=',1p,e18.10)") icol,
value
333 WRITE(10,
"('Variable',i7,' forced to upper bound=',1p,e18.10)") icol,
value
335 WRITE(10,
"('Variable',i7,' forced to implied bound=',1p,e18.10)") icol,
value
337 WRITE(10,
"('Previous variables were forced by equation',i7,' binding as a less than or equal constraint.')") irow
339 WRITE(10,
"('Previous variables were forced by equation',i7,' binding as a greater than or equal constraint.')") irow
340 Case (pretriainfeasb)
341 WRITE(10,
"('Equation',i7,' cannot be solved with respect to variable',i7,' due to bounds. Value=',1p,e18.10)") &
343 Case (pretriainfeasl)
345 "('Equation',i7,' cannot be solved with respect to variable',i7,'. Infeasibility has local minimum at',1p,e18.10)") &
348 WRITE(10,
"('Equation',i7,' is still infeasible after the above variables have been forced to their best bounds.')") irow
349 Case (inconsistentrow)
350 WRITE(10,
"('Equation',i7,' cannot be solved. No free variables left.')") irow
352 WRITE(10,
"('Pretriangular action=',i7,' not implemented yet.')")
type
355 If ( resid /= 0.d0 )
write(10,
"('Residual after last transformation=',1p,e18.10)") resid
379 Character(Len=*),
Intent(IN) :: Case
380 INTEGER,
INTENT(IN) :: MinMax
382 real*8,
Parameter :: opttol = 2.d-6
384 Character(Len=120) Text
387 If ( .not. (
associated(
xprim) .and.
associated(
xdual) .and.
associated(
uprim) .and.
associated(
udual) ) )
Return
388 If ( .not. (
associated(
xbasc) .and.
associated(
xstat) .and.
associated(
ubasc) .and.
associated(
ustat) ) )
Return
392 do i = 1,
Size(
xstat)
393 If (
xstat(i) /= 0 )
then
394 write(text,
"(A,': Status of variable',i6,' is not zero(normal). Is',i10)")
Case, i,
xstat(i)
395 call flog( trim(text), 1 )
401 do i = 1,
size(
xbasc)
402 select case(
xbasc(i))
405 if (
xdual(i) > opttol )
then
406 write(text,
"(A,': Max and variable',i6,' at lower. Reduced cost is positive:',1p,d15.6)")
Case, i,
xdual(i)
407 call flog( trim(text), 1 )
410 if (
xdual(i) < -opttol )
then
411 write(text,
"(A,': Min and variable',i6,' at lower. Reduced cost is negative:',1p,d15.6)")
Case, i,
xdual(i)
412 call flog( trim(text), 1 )
417 if (
xdual(i) < -opttol )
then
418 write(text,
"(A,': Max and variable',i6,' at upper. Reduced cost is negative:',1p,d15.6)")
Case, i,
xdual(i)
419 call flog( trim(text), 1 )
422 if (
xdual(i) > opttol )
then
423 write(text,
"(A,': Min and variable',i6,' at upper. Reduced cost is positive:',1p,d15.6)")
Case, i,
xdual(i)
424 call flog( trim(text), 1 )
428 if (
xdual(i) /= 0.d0 )
then
429 write(text,
"(A,': Basic variable',i6,' does not have reduced cost zero. Is',1p,d15.6)")
Case, i,
xdual(i)
430 call flog( trim(text), 1 )
433 if ( abs(
xdual(i) ) > opttol )
then
434 write(text,
"(A,': Superbasic variable',i6,' does not have small reduced cost. Is',1p,d15.6)")
Case, i,
xdual(i)
435 call flog( trim(text), 1 )
438 write(text,
"(A,': Variable',i6,' bas illegal basis status:',I10)")
Case, i,
xbasc(i)
439 call flog( trim(text), 1 )
446 do i = 1,
Size(
ustat)
447 If (
ustat(i) /= 0 )
then
448 write(text,
"(A,': Status of constraint',i6,' is not zero(normal). Is',i10)")
Case, i,
ustat(i)
449 call flog( trim(text), 1 )
456 do i = 1,
size(
ubasc)
457 select case(
ubasc(i))
460 if (
udual(i) > opttol )
then
461 write(text,
"(A,': Max and constraint',i6,' at lower. Reduced cost is positive:',1p,d15.6)")
Case, i,
udual(i)
462 call flog( trim(text), 1 )
465 if (
udual(i) < -opttol )
then
466 write(text,
"(A,': Min and constraint',i6,' at lower. Reduced cost is negative:',1p,d15.6)")
Case, i,
udual(i)
467 call flog( trim(text), 1 )
472 if (
udual(i) < -opttol )
then
473 write(text,
"(A,': Max and constraint',i6,' at upper. Reduced cost is negative:',1p,d15.6)")
Case, i,
udual(i)
474 call flog( trim(text), 1 )
477 if (
udual(i) > opttol )
then
478 write(text,
"(A,': Min and constraint',i6,' at upper. Reduced cost is positive:',1p,d15.6)")
Case, i,
udual(i)
479 call flog( trim(text), 1 )
484 write(text,
"(A,': Basic constraint',i6,' does not have reduced cost zero. Is',1p,d15.6)")
Case, i,
udual(i)
485 call flog( trim(text), 1 )
489 write(text,
"(A,': Superbasic constraint',i6,' does not have small reduced cost. Is',1p,d15.6)")
Case, i,
udual(i)
490 call flog( trim(text), 1 )
493 write(text,
"(A,': Constraint',i6,' bas illegal basis status:',I10)")
Case, i,
ubasc(i)
494 call flog( trim(text), 1 )
integer function std_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
integer function std_status(modsta, solsta, iter, objval, usrmem)
subroutine checkdual(case, minmax)
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, dimension(:), pointer ubasc
character(len=128) progname
integer, parameter bssuper
real *8, dimension(:), pointer udual
integer, parameter bslower
real *8, dimension(:), pointer xdual
integer, dimension(:), pointer xstat
integer, dimension(:), pointer xbasc
integer, dimension(:), pointer ustat
integer, parameter infeasible
integer, parameter bsbasic
integer, parameter minimize
integer, parameter bsupper
subroutine flog(msg, code)
integer, parameter maximize
real *8, dimension(:), pointer xprim
real *8, dimension(:), pointer uprim