CONOPT
Loading...
Searching...
No Matches
comdecl.f90
Go to the documentation of this file.
1#if defined(_WIN32) && !defined(_WIN64)
2#define dec_directives_win32
3#endif
4
5Module proginfo
6!
7! Module with information about the progress of the program used to
8! check if the examples execute properly and write messages accordingly.
9!
10 IMPLICIT NONE
11 Character(len=128):: Progname ! Program name
12 Integer :: Stacalls = 0 ! Number of times Std_Status has been called
13 Integer :: solcalls = 0 ! Number of times Std_Solution has been called
14 real*8 :: obj ! Objective in last Std_Status
15 Integer :: mstat = 0 ! Value of MODSTA in last Std_Status
16 Integer :: sstat = 0 ! Value of SOLSTA in last Std_Status
17 Integer :: miter = 0 ! Value of ITER in last Std_Status
18 Integer :: c_infeas = 0 ! Count of infeasibilities in last Std_Solution
19 Integer :: c_nonopt = 0 ! Count of non-optimalities in last Std_Solution
20 Integer :: c_unbnd = 0 ! Count of unbounded in last Std_Solution
21 real*8, Dimension(:), Pointer :: xprim, xdual ! Primal and dual values for variables
22 real*8, Dimension(:), Pointer :: uprim, udual ! Primal and dual values for equations
23 Integer, Dimension(:), Pointer :: xbasc, xstat ! Basis and Status value for variables
24 Integer, Dimension(:), Pointer :: ubasc, ustat ! Basis and Status value for equations
25 Logical :: do_allocate ! If set to .true. then allocate above vectors at first call to Std_Solution
26 Integer :: maxvar, maxcon ! If defined then these sizes are used to allocate space
27 ! for variable and constraint related vectors with Do_allocate
29 Integer, Parameter :: minimize = 1, maximize = 2, infeasible = 3
30! Basis status for variables:
31 Integer, Parameter :: bslower = 0, bsupper = 1, bsbasic = 2, bssuper = 3
32
33 Contains
34!
35! Nullify pointers, get the name of the program, and write the first
36! status-line with "Starting to execute".
37!
38 Subroutine startup
39!$ Use OMP_Lib
40 IMPLICIT NONE
41!$ Integer :: MaxThread
42 Nullify(xprim); Nullify(xdual)
43 Nullify(uprim); Nullify(udual)
44 read(*,"(A)") progname
45 call flog( "Starting to execute", 0 )
46!
47! Open the Progname.lst and Progname.sta files on unit 10 and 11
48!
49 open(10,file=trim(progname) // '.lst',status='Unknown')
50 open(11,file=trim(progname) // '.sta',status='Unknown')
51 do_allocate = .false.
52 maxvar = 0; maxcon = 0
53!$ maxthread = OMP_GET_MAX_THREADS() ! We make the call to force the right libraries to be loaded.
54 End Subroutine startup
55!
56! Write a one-line status report used to monitor in the Progname.rc file
57! how far the program has progressed.
58!
59 Subroutine flog( Msg, Code )
60 IMPLICIT NONE
61 character(len=*), Intent(IN) :: Msg
62 Integer, Intent(IN) :: Code
63
64 open(15,file=trim(progname) // '.rc',action='write',form='formatted',status='unknown')
65 write(15,"(A,': ',A)") trim(progname), msg
66 close(15)
67 if ( code /= 0 ) then ! Error return.
68 close(10) ! Close the Status and
69 close(11) ! Document files and
70 stop 1 ! Stop
71 Endif
72 End Subroutine flog
73!
74! Free memory
75!
76 Subroutine finalize
77 IMPLICIT NONE
78 if ( associated(xprim) ) Then
79 Deallocate(xprim);
80 Nullify(xprim);
81 endif
82 if ( associated(xdual) ) Then
83 Deallocate(xdual);
84 Nullify(xdual);
85 endif
86 if ( associated(uprim) ) Then
87 Deallocate(uprim);
88 Nullify(uprim);
89 endif
90 if ( associated(udual) ) Then
91 Deallocate(udual);
92 Nullify(udual);
93 endif
94 if ( associated(xbasc) ) Then
95 Deallocate(xbasc);
96 Nullify(xbasc);
97 endif
98 if ( associated(xstat) ) Then
99 Deallocate(xstat);
100 Nullify(xstat);
101 endif
102 if ( associated(ubasc) ) Then
103 Deallocate(ubasc);
104 Nullify(ubasc);
105 endif
106 if ( associated(ustat) ) Then
107 Deallocate(ustat);
108 Nullify(ustat);
109 endif
110 End Subroutine finalize
111
112End Module proginfo
113!
114! Standard routines for Message, Status, Solution, and ErrMsg called
115! Std_Message, Std_Status, Std_Solution, and Std_ErrMsg.
116! The routines assume that the documentation file is opened as unit
117! 10 and that the status file is opened as unit 11.
118! The routines are use in the model if they are defined as callbacks
119! using the COIDEF_* routines. Otherwise, they will be ignored.
120! The routines are intended as inspiration for some more realistic
121! and useful implementations.
122!
123Integer Function std_status( MODSTA, SOLSTA, ITER, OBJVAL, USRMEM )
124#ifdef dec_directives_win32
125!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Status
126#endif
127!
128! Simple implementation in which we write to all files
129!
130 Use proginfo
131 IMPLICIT NONE
132 INTEGER, Intent(IN) :: modsta, solsta, iter
133 real*8, Intent(IN) :: objval
134 real*8, Intent(IN OUT) :: usrmem(*)
135
136 WRITE(*,*)
137 WRITE(*,*) 'CONOPT has finished optimizing.'
138 WRITE(*,*) 'Model status =',modsta
139 WRITE(*,*) 'Solver status =',solsta
140 WRITE(*,*) 'Iteration count=',iter
141 WRITE(*,*) 'Objective value=',objval
142
143 WRITE(10,*)
144 WRITE(10,*) 'CONOPT has finished optimizing.'
145 WRITE(10,*) 'Model status =',modsta
146 WRITE(10,*) 'Solver status =',solsta
147 WRITE(10,*) 'Iteration count=',iter
148 WRITE(10,*) 'Objective value=',objval
149
150 WRITE(11,*)
151 WRITE(11,*) 'Model status =',modsta
152 WRITE(11,*) 'Solver status =',solsta
153 WRITE(11,*) 'Objective value=',objval
154 Call flush(10)
155 Call flush(11)
156
157 stacalls = stacalls + 1
158 obj = objval
159 mstat = modsta
160 sstat = solsta
161 miter = iter
162
163 std_status = 0
164
165END Function std_status
166
167Integer Function std_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
168#ifdef dec_directives_win32
169!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Solution
170#endif
171!
172! Simple implementation in which we write the solution values to
173! the 'Documentation file' on unit 10.
174! If Xprim and Uprim are allocated with enough space, the primal and
175! dual solutions are also saved to Xprim and Uprim.
176!
177 Use proginfo
178 IMPLICIT NONE
179 INTEGER, Intent(IN) :: n, m
180 INTEGER, Intent(IN), Dimension(N) :: xbas, xsta
181 INTEGER, Intent(IN), Dimension(M) :: ybas, ysta
182 real*8, Intent(IN), Dimension(N) :: xval, xmar
183 real*8, Intent(IN), Dimension(M) :: yval, ymar
184 real*8, Intent(IN OUT) :: usrmem(*)
185
186 INTEGER :: i, na, ma
187 CHARACTER*5, Parameter, Dimension(4) :: basc = (/ 'Lower','Upper','Basic','Super' /)
188 CHARACTER*6, Parameter, Dimension(4) :: stat = (/ 'Normal','NonOpt','Infeas','Unbnd ' /)
189
190 c_infeas = 0
191 c_nonopt = 0
192 c_unbnd = 0
193 WRITE(10,"(/' Variable Solution value Reduced cost Var-Basc Var-stat')")
194 DO i = 1, n
195 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))
196 if ( xsta(i) == 1 ) c_nonopt = c_nonopt + 1
197 if ( xsta(i) == 2 ) c_infeas = c_infeas + 1
198 if ( xsta(i) == 3 ) c_unbnd = c_unbnd + 1
199 ENDDO
200
201 WRITE(10,"(/' Constrnt Activity level Marginal cost Con-Basc Con-stat')")
202 DO i = 1, m
203 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))
204 if ( ysta(i) == 1 ) c_nonopt = c_nonopt + 1
205 if ( ysta(i) == 2 ) c_infeas = c_infeas + 1
206 if ( ysta(i) == 3 ) c_unbnd = c_unbnd + 1
207 ENDDO
208 if ( c_nonopt > 0 ) write(10,"(/' Number of non-optimalities =',i5)") c_nonopt
209 if ( c_infeas > 0 ) write(10,"(/' Number of infeasibilities =',i5)") c_infeas
210 Call flush(10)
211 Call flush(11)
212
213 If ( do_allocate ) Then
214 If ( maxvar > 0 ) then; na = maxvar; else; na = n; Endif
215 If ( maxcon > 0 ) then; ma = maxcon; else; ma = m; Endif
216 Allocate( xprim(na), xdual(na), uprim(ma), udual(ma), xbasc(na), xstat(na), ubasc(ma), ustat(ma) )
217 do_allocate = .false.
218 Endif
219 If ( associated(xprim) .and. associated(xdual) .and. associated(uprim) .and. associated(udual) ) Then
220 If ( Size(xprim) >= n .and. Size(xdual) >= n .AND. Size(uprim) >= m .and. Size(udual) >= m ) Then
221 xprim(1:n) = xval(1:n)
222 xdual(1:n) = xmar(1:n)
223 uprim(1:m) = yval(1:m)
224 udual(1:m) = ymar(1:m)
225 Endif
226 Endif
227 If ( associated(xbasc) .and. associated(xstat) .and. associated(ubasc) .and. associated(ustat) ) Then
228 If ( Size(xbasc) >= n .and. Size(xstat) >= n .AND. Size(ubasc) >= m .and. Size(ustat) >= m ) Then
229 xbasc(1:n) = xbas(1:n)
230 xstat(1:n) = xsta(1:n)
231 ubasc(1:m) = ybas(1:m)
232 ustat(1:m) = ysta(1:m)
233 Endif
234 Endif
235 solcalls = solcalls + 1
236 std_solution = 0
237
238END Function std_solution
239
240Integer Function std_message( SMSG, DMSG, NMSG, LLEN, USRMEM, MSGV )
241#ifdef dec_directives_win32
242!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Message
243#endif
244!
245! Simple implementation in which we only write the 'Screen file'
246! to unit *, the 'Status file' to unit 11, and the 'Documentation file'
247! to unit 10.
248!
249 Use proginfo
250 IMPLICIT NONE
251
252 INTEGER, Intent(IN) :: smsg, dmsg, nmsg
253 INTEGER, Intent(IN) , Dimension(*) :: llen
254 CHARACTER(Len=133), Intent(IN), Dimension(*) :: msgv
255 real*8, Intent(IN OUT) :: usrmem(*)
256
257 Integer :: i
258!
259! write to screen
260!
261 do i = 1, smsg
262 write(*,"(A)") msgv(i)(1:llen(i))
263 enddo
264!
265! write to status file
266!
267 do i = 1, nmsg
268 write(11,"(A)") msgv(i)(1:llen(i))
269 enddo
270!
271! write to document file
272!
273 do i = 1, dmsg
274 write(10,"(A)") msgv(i)(1:llen(i))
275 enddo
276 Call flush(10)
277 Call flush(11)
278
279 std_message = 0
280
281END Function std_message
282
283Integer Function std_errmsg( ROWNO, COLNO, POSNO, MSGLEN, USRMEM, MSG )
284#ifdef dec_directives_win32
285!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_ErrMsg
286#endif
287!
288! Simple implementation of ErrMsg in which we just write 'Variable XX',
289! 'Equation YY' or 'Variable XX appearing in Equation YY' followed by
290! the text. We write both to the 'Documentation file' on unit 10 and
291! to the 'Status File' on unit 11.
292!
293 Use proginfo
294 IMPLICIT NONE
295
296 INTEGER, Intent(IN) :: rowno, colno, posno, msglen
297 CHARACTER(len=*), Intent(IN) :: msg
298 real*8, Intent(IN OUT) :: usrmem(*)
299!
300! If Rowno = 0 then the message is about a Column.
301! If Colno = 0 then the message is abuut a Row.
302! Otherwise, the message is about (Rowno,Colno)
303!
304 IF ( rowno .EQ. 0 ) THEN ! Must be a column (error) message
305 WRITE(10,1001) colno, msg(1:msglen)
306 WRITE(11,1001) colno, msg(1:msglen)
307 ELSEIF ( colno .EQ. 0 ) THEN ! Must be a row (error) message
308 WRITE(10,1002) rowno, msg(1:msglen)
309 WRITE(11,1002) rowno, msg(1:msglen)
310 ELSE ! Must be a (row,col) (error) message
311 WRITE(10,1000) colno, rowno, msg(1:msglen)
312 WRITE(11,1000) colno, rowno, msg(1:msglen)
313 ENDIF
314 Call flush(10)
315 Call flush(11)
3161002 FORMAT('Equation',i8,' : ',a)
3171001 FORMAT('Variable',i8,' : ',a)
3181000 FORMAT('Variable',i8,' appearing in Equation',i8,' : ',a)
319
320 std_errmsg = 0
321
322END Function std_errmsg
323
324Integer Function std_triord( Mode, Type, Status, Irow, Icol, Inf, Value, Resid, Usrmem )
325#ifdef dec_directives_win32
326!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_TriOrd
327#endif
328!
329! Simple implementation of the TriOrd callback routine.
330!
331 Implicit NONE
332 INTEGER, INTENT(IN) :: mode, Type, status, irow, icol, inf
333 real*8, INTENT(IN) :: VALUE, resid
334 real*8, Intent(IN OUT) :: usrmem(*)
335
336! This list has been copied here from src/preaction.inc
337! Eventually, it should maybe move into conopt.f90 and conopt.h.
338 Integer, Parameter :: pretriangular = 1, & ! Fix a structural variable from an equality equation
339 fixedcolumn = 2, & ! Fix a structural variable from equal lower and upper bouunds
340 dependentrow = 3, & ! All structural variables are fixed and the row is feasible
341 redundantrow = 4, & ! The row is feasible due to bounds on all variables.
342 impliedlower = 5, & ! Change a simple inequality to a lower bound
343 impliedupper = 6, & ! Change a simple inequality to an upper bound
344 impliedrange = 7, & ! Changed a ranged constraint to both a lower and an upper bound.
345 forcedlower = 8, & ! A variable is forced to the lower bound by a ForcingLower or
346 ! ForcingUpper constraint.
347 forcedupper = 9, & ! A variable is forced to the upper bound by a ForcingLower or
348 ! ForcingUpper constraint.
349 forcedvalue = 10, & ! A variable if forced to a value equal to an implied but not
350 ! original bound by a ForcingLower or ForcingUpper constraint
351 forcinglower = 11, & ! A constraint is forcing all variables in it to a bound
352 ! and it works as an =L= constraint.
353 forcingupper = 12, & ! A constraint is forcing all variables in it to a bound
354 ! and it works as an =G= constraint.
355!
356! Any of the next actions will terminate the pre-processor and there can therefore only be one of them
357! and only in an infeasible model.
358!
359 pretriainfeasb = 13, & ! An equation has only one nonfixed variable, but it cannot
360 ! be solved because the variable will exceed a bound.
361 pretriainfeasl = 14, & ! An equation has only one nonfixed variable, but it cannot
362 ! be solved because the infeasibility is at a (local) minimum.
363 forcinginfeas = 15, & ! A constraint is infeasible due to bounds on all variables
364 inconsistentrow = 16, & ! All structural variables are fixed and the row in infeasible
365 wforcinginfeas = 17, & ! A constraint is forcing but based on weak bound so no traceback
366!
367! FixedDual is only used if the preprocessor terminates properly (feasible) and is always last
368!
369 fixeddual = 18 ! A variable is fixed based on dual information.
370
371 If ( mode == -1 ) THEN
372 write(10,"(/'The preprocessing transformation are described below in detection order:'/)")
373 Else if ( mode == -2 ) Then
374 write(10,"(//'The order of the critical transformations is:'/)")
375 Endif
376 Select case (type)
377 Case (pretriangular)
378 If ( inf == 0 ) Then
379 WRITE(10,"('Equation',i7,' solved with respect to variable',i7,'. Value=',1p,e18.10)") irow, icol, value
380 Elseif ( inf == 1 ) Then
381 WRITE(10,"('Equation',i7,' solved with respect to variable',i7,'. Value=',9x,'+Infinity')") irow, icol
382 Else
383 WRITE(10,"('Equation',i7,' solved with respect to variable',i7,'. Value=',9x,'-Infinity')") irow, icol
384 Endif
385 Case (fixedcolumn)
386 WRITE(10,"('Variable',i7,' fixed at value=',1p,e18.10)") icol, value
387 Case (dependentrow)
388 WRITE(10,"('Equation',i7,' is dependent (all variables are fixed.)')") irow
389 Case (redundantrow)
390 WRITE(10,"('Equation',i7,' is redundant (will later be solved with respect to the slack.)')") irow
391 Case (impliedlower)
392 WRITE(10,"('Equation',i7,' turned into lower bound on variable',i7,'. Bound=',1p,e18.10)") irow, icol, value
393 Case (impliedupper)
394 WRITE(10,"('Equation',i7,' turned into upper bound on variable',i7,'. Bound=',1p,e18.10)") irow, icol, value
395 Case (impliedrange)
396 WRITE(10,"('Ranged Equation',i7,' turned into two bounds on variable',i7,'. Bound=',1p,e18.10)") irow, icol, value
397 Case (forcedlower)
398 WRITE(10,"('Variable',i7,' forced to lower bound=',1p,e18.10)") icol, value
399 Case (forcedupper)
400 WRITE(10,"('Variable',i7,' forced to upper bound=',1p,e18.10)") icol, value
401 Case (forcedvalue)
402 WRITE(10,"('Variable',i7,' forced to implied bound=',1p,e18.10)") icol, value
403 Case (forcinglower)
404 WRITE(10,"('Previous variables were forced by equation',i7,' binding as a less than or equal constraint.')") irow
405 Case (forcingupper)
406 WRITE(10,"('Previous variables were forced by equation',i7,' binding as a greater than or equal constraint.')") irow
407 Case (pretriainfeasb)
408 WRITE(10,"('Equation',i7,' cannot be solved with respect to variable',i7,' due to bounds. Value=',1p,e18.10)") &
409 irow, icol, value
410 Case (pretriainfeasl)
411 WRITE(10, &
412 "('Equation',i7,' cannot be solved with respect to variable',i7,'. Infeasibility has local minimum at',1p,e18.10)") &
413 irow, icol, value
414 Case (forcinginfeas)
415 WRITE(10,"('Equation',i7,' is still infeasible after the above variables have been forced to their best bounds.')") irow
416 Case (inconsistentrow)
417 WRITE(10,"('Equation',i7,' cannot be solved. No free variables left.')") irow
418 Case Default
419 WRITE(10,"('Pretriangular action=',i7,' not implemented yet.')") type
420 stop 1
421 End Select
422 If ( resid /= 0.d0 ) write(10,"('Residual after last transformation=',1p,e18.10)") resid
423 Call flush(10)
424
425 std_triord = 0
426
427End Function std_triord
428
429Subroutine checkdual( Case, MinMax )
430!
431! This routine can check if the status and dual information is
432! consistent.
433! Case is a string to be added in front of any error messages.
434! MinMax defines termination status of the model according to
435! Integer, Parameter :: Minimize = 1, Maximize = 2, Infeasible = 3
436! The solution must not be in an intermediate state.
437!
438! The solution must have been saved using DO_Allocate and the size
439! of the model must correspond to the sizes of the allocated vectors,
440! i.e. MaxVar and MaxCon cannot be used with this routine.
441!
442 Use proginfo
443 Implicit NONE
444 Character(Len=*), Intent(IN) :: Case
445 INTEGER, INTENT(IN) :: MinMax
446
447 real*8, Parameter :: opttol = 2.d-6
448 Integer :: I
449 Character(Len=120) Text
450
451 If ( solcalls <= 0 ) Return
452 If ( .not. ( associated(xprim) .and. associated(xdual) .and. associated(uprim) .and. associated(udual) ) ) Return
453 If ( .not. ( associated(xbasc) .and. associated(xstat) .and. associated(ubasc) .and. associated(ustat) ) ) Return
454!
455! Check variable status. Must be normal
456!
457 do i = 1, Size(xstat)
458 If ( xstat(i) /= 0 ) then
459 write(text, "(A,': Status of variable',i6,' is not zero(normal). Is',i10)") Case, i, xstat(i)
460 call flog( trim(text), 1 )
461 Endif
462 Enddo
463!
464! Check Variable Basis status is consistent with the reduced cost in Xdual
465!
466 do i = 1, size(xbasc)
467 select case(xbasc(i))
468 case(bslower)
469 if ( minmax == maximize ) then
470 if ( xdual(i) > opttol ) then
471 write(text, "(A,': Max and variable',i6,' at lower. Reduced cost is positive:',1p,d15.6)") Case, i, xdual(i)
472 call flog( trim(text), 1 )
473 Endif
474 else ! Minimize or infeasible
475 if ( xdual(i) < -opttol ) then
476 write(text, "(A,': Min and variable',i6,' at lower. Reduced cost is negative:',1p,d15.6)") Case, i, xdual(i)
477 call flog( trim(text), 1 )
478 Endif
479 endif
480 case(bsupper)
481 if ( minmax == maximize ) then
482 if ( xdual(i) < -opttol ) then
483 write(text, "(A,': Max and variable',i6,' at upper. Reduced cost is negative:',1p,d15.6)") Case, i, xdual(i)
484 call flog( trim(text), 1 )
485 Endif
486 else ! Minimize or infeasible
487 if ( xdual(i) > opttol ) then
488 write(text, "(A,': Min and variable',i6,' at upper. Reduced cost is positive:',1p,d15.6)") Case, i, xdual(i)
489 call flog( trim(text), 1 )
490 Endif
491 endif
492 case(bsbasic)
493 if ( xdual(i) /= 0.d0 ) then
494 write(text, "(A,': Basic variable',i6,' does not have reduced cost zero. Is',1p,d15.6)") Case, i, xdual(i)
495 call flog( trim(text), 1 )
496 Endif
497 case(bssuper)
498 if ( abs( xdual(i) ) > opttol ) then
499 write(text, "(A,': Superbasic variable',i6,' does not have small reduced cost. Is',1p,d15.6)") Case, i, xdual(i)
500 call flog( trim(text), 1 )
501 Endif
502 case default
503 write(text, "(A,': Variable',i6,' bas illegal basis status:',I10)") Case, i, xbasc(i)
504 call flog( trim(text), 1 )
505 end select
506 enddo
507!
508! Check Equation status. Must be normal if the model is not infeasible
509!
510 if ( minmax /= infeasible ) then
511 do i = 1, Size(ustat)
512 If ( ustat(i) /= 0 ) then
513 write(text, "(A,': Status of constraint',i6,' is not zero(normal). Is',i10)") Case, i, ustat(i)
514 call flog( trim(text), 1 )
515 Endif
516 Enddo
517 Endif
518!
519! Check Constraint Basis status is consistent with the reduced cost in Xdual
520!
521 do i = 1, size(ubasc)
522 select case(ubasc(i))
523 case(bslower)
524 if ( minmax == maximize ) then
525 if ( udual(i) > opttol ) then
526 write(text, "(A,': Max and constraint',i6,' at lower. Reduced cost is positive:',1p,d15.6)") Case, i, udual(i)
527 call flog( trim(text), 1 )
528 Endif
529 else ! Minimize or infeasible
530 if ( udual(i) < -opttol ) then
531 write(text, "(A,': Min and constraint',i6,' at lower. Reduced cost is negative:',1p,d15.6)") Case, i, udual(i)
532 call flog( trim(text), 1 )
533 Endif
534 endif
535 case(bsupper)
536 if ( minmax == maximize ) then
537 if ( udual(i) < -opttol ) then
538 write(text, "(A,': Max and constraint',i6,' at upper. Reduced cost is negative:',1p,d15.6)") Case, i, udual(i)
539 call flog( trim(text), 1 )
540 Endif
541 else ! Minimize or infeasible
542 if ( udual(i) > opttol ) then
543 write(text, "(A,': Min and constraint',i6,' at upper. Reduced cost is positive:',1p,d15.6)") Case, i, udual(i)
544 call flog( trim(text), 1 )
545 Endif
546 endif
547 case(bsbasic)
548 if ( minmax /= infeasible .and. udual(i) /= 0.d0 ) then
549 write(text, "(A,': Basic constraint',i6,' does not have reduced cost zero. Is',1p,d15.6)") Case, i, udual(i)
550 call flog( trim(text), 1 )
551 Endif
552 case(bssuper)
553 if ( minmax /= infeasible .and. abs( udual(i) ) > opttol ) then
554 write(text, "(A,': Superbasic constraint',i6,' does not have small reduced cost. Is',1p,d15.6)") Case, i, udual(i)
555 call flog( trim(text), 1 )
556 Endif
557 case default
558 write(text, "(A,': Constraint',i6,' bas illegal basis status:',I10)") Case, i, ubasc(i)
559 call flog( trim(text), 1 )
560 end select
561 enddo
562
563End Subroutine checkdual
integer function std_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
Definition comdecl.f90:170
integer function std_status(modsta, solsta, iter, objval, usrmem)
Definition comdecl.f90:126
subroutine checkdual(case, minmax)
Definition comdecl.f90:432
integer function std_message(smsg, dmsg, nmsg, llen, usrmem, msgv)
Definition comdecl.f90:243
integer function std_triord(mode, type, status, irow, icol, inf, value, resid, usrmem)
Definition comdecl.f90:327
integer function std_errmsg(rowno, colno, posno, msglen, usrmem, msg)
Definition comdecl.f90:286
real *8 obj
Definition comdecl.f90:16
integer, dimension(:), pointer ubasc
Definition comdecl.f90:26
integer c_nonopt
Definition comdecl.f90:21
integer, parameter bssuper
Definition comdecl.f90:33
integer solcalls
Definition comdecl.f90:15
integer maxvar
Definition comdecl.f90:28
integer sstat
Definition comdecl.f90:18
real *8, dimension(:), pointer udual
Definition comdecl.f90:24
integer, parameter bslower
Definition comdecl.f90:33
real *8, dimension(:), pointer xdual
Definition comdecl.f90:23
integer, dimension(:), pointer xstat
Definition comdecl.f90:25
subroutine finalize
Definition comdecl.f90:79
integer c_infeas
Definition comdecl.f90:20
integer, dimension(:), pointer xbasc
Definition comdecl.f90:25
integer, dimension(:), pointer ustat
Definition comdecl.f90:26
integer, parameter infeasible
Definition comdecl.f90:31
integer, parameter bsbasic
Definition comdecl.f90:33
integer maxcon
Definition comdecl.f90:28
integer, parameter minimize
Definition comdecl.f90:31
integer stacalls
Definition comdecl.f90:14
integer, parameter bsupper
Definition comdecl.f90:33
subroutine flog(msg, code)
Definition comdecl.f90:62
logical do_allocate
Definition comdecl.f90:27
integer, parameter maximize
Definition comdecl.f90:31
integer miter
Definition comdecl.f90:19
real *8, dimension(:), pointer xprim
Definition comdecl.f90:23
real *8, dimension(:), pointer uprim
Definition comdecl.f90:24
integer mstat
Definition comdecl.f90:17
subroutine startup
Definition comdecl.f90:41
integer c_unbnd
Definition comdecl.f90:22