CONOPT
Loading...
Searching...
No Matches
fvboth2.f90
Go to the documentation of this file.
1!> @file fvboth2.f90
2!! @ingroup FORT1THREAD_EXAMPLES
3!!
4!!
5!! This is the pindyck example rewritten to use both the FVforAll
6!! and FVincLin way of defining nonlinear functions. All functions, linear as
7!! well as nonlinear, will be called, and the functions must return the
8!! sum of the linear and nonlinear terms.
9!! Similar to FvBoth but with Linear Jacobian elements defined in FDEval
10!!
11!!
12!! For more information about the individual callbacks, please have a look at the source code.
13
14#if defined(_WIN32) && !defined(_WIN64)
15#define dec_directives_win32
16#endif
17
18!> Main program. A simple setup and call of CONOPT
19!!
20Program fvboth2
21 Use proginfo
23 Use data_t
24 Implicit none
25!
26! Declare the user callback routines as Integer, External:
27!
28 Integer, External :: pin_readmatrix ! Mandatory Matrix definition routine defined below
29 Integer, External :: pin_fdeval ! Function and Derivative evaluation routine
30 ! needed a nonlinear model.
31 Integer, External :: std_status ! Standard callback for displaying solution status
32 Integer, External :: pin_solution ! Specialized callback for displaying solution values
33 Integer, External :: std_message ! Standard callback for managing messages
34 Integer, External :: std_errmsg ! Standard callback for managing error messages
35#ifdef dec_directives_win32
36!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_ReadMatrix
37!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_FDEval
38!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Status
39!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_Solution
40!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Message
41!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_ErrMsg
42#endif
43!
44! Control vector
45!
46 INTEGER, Dimension(:), Pointer :: cntvect
47 INTEGER :: coi_error
48!
49! Other variables
50!
51 INTEGER :: major, minor, patch
52
53 call startup
54!
55! Create and initialize a Control Vector
56!
57 coi_error = coi_create( cntvect )
58
59! Write which version of CONOPT we are using.
60
61 call coiget_version( major, minor, patch )
62 write(*,"('Solving Pindyck Model using CONOPT version ',i2,'.',i2,'.',i2)") major, minor, patch
63!
64! Define the number of time periods, T.
65!
66 t = 16
67!
68! Tell CONOPT about the size of the model by populating the Control Vector:
69!
70! Number of variables (excl. slacks): 7 per period
71!
72 coi_error = max( coi_error, coidef_numvar( cntvect, 7 * t ) )
73!
74! Number of equations: 1 objective + 6 per period
75!
76 coi_error = max( coi_error, coidef_numcon( cntvect, 1 + 6 * t ) )
77!
78! Number of nonzeros in the Jacobian. See the counting in ReadMatrix below:
79! For each period there is 1 in the objective, 16 for unlagged
80! variables and 4 for lagged variables.
81!
82 coi_error = max( coi_error, coidef_numnz( cntvect, 17 * t + 4 * (t-1) ) )
83!
84! Number of nonlinear nonzeros. 5 unlagged for each period.
85!
86 coi_error = max( coi_error, coidef_numnlnz( cntvect, 5 * t ) )
87!
88! Direction: +1 = maximization.
89!
90 coi_error = max( coi_error, coidef_optdir( cntvect, 1 ) )
91!
92! Objective: Constraint no 1
93!
94 coi_error = max( coi_error, coidef_objcon( cntvect, 1 ) )
95!
96! Define that all functions should be called.
97!
98 coi_error = max( coi_error, coidef_fvforall( cntvect, +1 ) )
99!
100! Define that functions will include linear terms
101!
102 coi_error = max( coi_error, coidef_fvinclin( cntvect, +1 ) )
103!
104! Turn function debugging on in the initial point to check if it is consistent
105! with FVforAll:
106!
107 coi_error = max( coi_error, coidef_debugfv( cntvect, -1 ) )
108!
109! Tell CONOPT about the callback routines:
110!
111 coi_error = max( coi_error, coidef_readmatrix( cntvect, pin_readmatrix ) )
112 coi_error = max( coi_error, coidef_fdeval( cntvect, pin_fdeval ) )
113 coi_error = max( coi_error, coidef_status( cntvect, std_status ) )
114 coi_error = max( coi_error, coidef_solution( cntvect, pin_solution ) )
115 coi_error = max( coi_error, coidef_message( cntvect, std_message ) )
116 coi_error = max( coi_error, coidef_errmsg( cntvect, std_errmsg ) )
117
118#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
119 coi_error = max( coi_error, coidef_license( cntvect, conopt_license_int_1, conopt_license_int_2, conopt_license_int_3, conopt_license_text) )
120#endif
121
122 If ( coi_error .ne. 0 ) THEN
123 write(*,*)
124 write(*,*) '**** Fatal Error while loading CONOPT Callback routines.'
125 write(*,*)
126 call flog( "Skipping Solve due to setup errors", 1 )
127 ENDIF
128!
129! Save the solution so we can check the duals:
130!
131 do_allocate = .true.
132!
133! Start CONOPT:
134!
135 coi_error = coi_solve( cntvect )
136
137 write(*,*)
138 write(*,*) 'End of FVboth2 Model. Return code=',coi_error
139
140 If ( coi_error /= 0 ) then
141 call flog( "Errors encountered during solution", 1 )
142 elseif ( stacalls == 0 .or. solcalls == 0 ) then
143 call flog( "Status or Solution routine was not called", 1 )
144 elseif ( sstat /= 1 .or. mstat /= 2 ) then
145 call flog( "Solver and Model Status was not as expected (1,2)", 1 )
146 elseif ( abs( obj-1170.4863d0 ) > 0.0001d0 ) then
147 call flog( "Incorrect objective returned", 1 )
148 Else
149 Call checkdual( 'FVboth2', maximize )
150 endif
151
152 if ( coi_free(cntvect) /= 0 ) call flog( "Error while freeing control vector",1)
153
154 call flog( "Successful Solve", 0 )
155!
156! Free solution memory
157!
158 call finalize
159
160end Program fvboth2
161!
162! =====================================================================
163! Define information about the model structure
164!
165
166!> Define information about the model
167!!
168!! @include{doc} readMatrix_params.dox
169Integer Function pin_readmatrix( lower, curr, upper, vsta, type, rhs, esta, &
170 colsta, rowno, value, nlflag, n, m, nz, usrmem )
171#ifdef dec_directives_win32
172!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_ReadMatrix
173#endif
174 Use data_t
175 implicit none
176 integer, intent (in) :: n ! number of variables
177 integer, intent (in) :: m ! number of constraints
178 integer, intent (in) :: nz ! number of nonzeros
179 real*8, intent (in out), dimension(n) :: lower ! vector of lower bounds
180 real*8, intent (in out), dimension(n) :: curr ! vector of initial values
181 real*8, intent (in out), dimension(n) :: upper ! vector of upper bounds
182 integer, intent (in out), dimension(n) :: vsta ! vector of initial variable status
183 ! (not defined here)
184 integer, intent (out), dimension(m) :: type ! vector of equation types
185 integer, intent (in out), dimension(m) :: esta ! vector of initial equation status
186 ! (not defined here)
187 real*8, intent (in out), dimension(m) :: rhs ! vector of right hand sides
188 integer, intent (in out), dimension(n+1) :: colsta ! vector with start of column indices
189 integer, intent (out), dimension(nz) :: rowno ! vector of row numbers
190 integer, intent (in out), dimension(nz) :: nlflag ! vector of nonlinearity flags
191 real*8, intent (in out), dimension(nz) :: value ! vector of matrix values
192 real*8 usrmem(*) ! optional user memory
193
194 Integer :: it, is, i, icol, iz
195!
196! Define the information for the columns.
197!
198! We should not supply status information, vsta.
199!
200! We order the variables as follows:
201! td, cs, s, d, r, p, and rev. All variables for period 1 appears
202! first followed by all variables for period 2 etc.
203!
204! td, cs, s, and d have lower bounds of 0, r and p have lower
205! bounds of 1, and rev has no lower bound.
206! All have infinite upper bounds (default).
207! The initial value of td is 18, s is 7, cs is 7*t, d is td-s,
208! p is 14, and r is r(t-1)-d. No initial value for rev.
209!
210 do it = 1, t
211 is = 7*(it-1)
212 lower(is+1) = 0.d0
213 lower(is+2) = 0.d0
214 lower(is+3) = 0.d0
215 lower(is+4) = 0.d0
216 lower(is+5) = 1.d0
217 lower(is+6) = 1.d0
218 curr(is+1) = 18.d0
219 curr(is+2) = 7.d0*it
220 curr(is+3) = 7.d0
221 curr(is+4) = curr(is+1) - curr(is+3)
222 if ( it .gt. 1 ) then
223 curr(is+5) = curr(is+5-7) - curr(is+4)
224 else
225 curr(is+5) = 500.d0 - curr(is+4)
226 endif
227 curr(is+6) = 14.d0
228 enddo
229!
230! Define the information for the rows
231!
232! We order the constraints as follows: The objective is first,
233! followed by tddef, sdef, csdef, ddef, rdef, and revdef for
234! the first period, the same for the second period, etc.
235!
236! The objective is a nonbinding constraint:
237!
238 type(1) = 3
239!
240! All others are equalities:
241!
242 do i = 2, m
243 type(i) = 0
244 enddo
245!
246! Right hand sides: In all periods except the first, only tddef
247! has a nonzero right hand side of 1+2.3*1.015**(t-1).
248! In the initial period there are contributions from lagged
249! variables in the constraints that have lagged variables.
250!
251 do it = 1, t
252 is = 1 + 6*(it-1)
253 rhs(is+1) = 1.d0+2.3d0*1.015d0**(it-1)
254 enddo
255!
256! tddef: + 0.87*td(0)
257!
258 rhs(2) = rhs(2) + 0.87d0*18.d0
259!
260! sdef: +0.75*s(0)
261!
262 rhs(3) = 0.75d0*6.5d0
263!
264! csdef: +1*cs(0)
265!
266 rhs(4) = 0.d0
267!
268! rdef: +1*r(0)
269!
270 rhs(6) = 500.d0
271!
272! Define the structure and content of the Jacobian:
273! To help define the Jacobian pattern and values it can be useful to
274! make a picture of the Jacobian. We describe the variables for one
275! period and the constraints they are part of:
276!
277! td cs s d r p rev
278! Obj (1+r)**(1-t)
279! Period t:
280! tddef 1.0 0.13
281! sdef NL 1.0 NL
282! csdef 1.0 -1.0
283! ddef -1.0 1.0 1.0
284! rdef 1.0 1.0
285! revdef NL NL NL 1.0
286! Period t+1:
287! tddef -0.87
288! sdef -0.75
289! csdef -1.0
290! ddef
291! rdef -1.0
292! revdef
293!
294! The Jacobian has to be sorted column-wise so we will just define
295! the elements column by column according to the table above:
296!
297 iz = 1
298 icol = 1
299 do it = 1, t
300!
301! is points to the position before the first equation for the period
302!
303 is = 1 + 6*(it-1)
304!
305! Column td:
306!
307 colsta(icol) = iz
308 icol = icol + 1
309 rowno(iz) = is+1
310 value(iz) = +1.d0
311 nlflag(iz) = 0
312 iz = iz + 1
313 rowno(iz) = is+4
314 value(iz) = -1.d0
315 nlflag(iz) = 0
316 iz = iz + 1
317 if ( it .lt. t ) then
318 rowno(iz) = is+7
319 value(iz) = -0.87d0
320 nlflag(iz) = 0
321 iz = iz + 1
322 endif
323!
324! Column cs
325!
326 colsta(icol) = iz
327 icol = icol + 1
328 rowno(iz) = is+2
329 nlflag(iz) = 1
330 iz = iz + 1
331 rowno(iz) = is+3
332 value(iz) = +1.d0
333 nlflag(iz) = 0
334 iz = iz + 1
335 if ( it .lt. t ) then
336 rowno(iz) = is+9
337 value(iz) = -1.d0
338 nlflag(iz) = 0
339 iz = iz + 1
340 endif
341!
342! Column s
343!
344 colsta(icol) = iz
345 icol = icol + 1
346 rowno(iz) = is+2
347 value(iz) = +1.d0
348 nlflag(iz) = 0
349 iz = iz + 1
350 rowno(iz) = is+3
351 value(iz) = -1.d0
352 nlflag(iz) = 0
353 iz = iz + 1
354 rowno(iz) = is+4
355 value(iz) = +1.d0
356 nlflag(iz) = 0
357 iz = iz + 1
358 if ( it .lt. t ) then
359 rowno(iz) = is+8
360 value(iz) = -0.75d0
361 nlflag(iz) = 0
362 iz = iz + 1
363 endif
364!
365! Column d:
366!
367 colsta(icol) = iz
368 icol = icol + 1
369 rowno(iz) = is+4
370 value(iz) = +1.d0
371 nlflag(iz) = 0
372 iz = iz + 1
373 rowno(iz) = is+5
374 value(iz) = +1.d0
375 nlflag(iz) = 0
376 iz = iz + 1
377 rowno(iz) = is+6
378 nlflag(iz) = 1
379 iz = iz + 1
380!
381! Column r:
382!
383 colsta(icol) = iz
384 icol = icol + 1
385 rowno(iz) = is+5
386 value(iz) = +1.d0
387 nlflag(iz) = 0
388 iz = iz + 1
389 rowno(iz) = is+6
390 nlflag(iz) = 1
391 iz = iz + 1
392 if ( it .lt. t ) then
393 rowno(iz) = is+11
394 value(iz) = -1.d0
395 nlflag(iz) = 0
396 iz = iz + 1
397 endif
398!
399! Column p:
400!
401 colsta(icol) = iz
402 icol = icol + 1
403 rowno(iz) = is+1
404 value(iz) = +0.13d0
405 nlflag(iz) = 0
406 iz = iz + 1
407 rowno(iz) = is+2
408 nlflag(iz) = 1
409 iz = iz + 1
410 rowno(iz) = is+6
411 nlflag(iz) = 1
412 iz = iz + 1
413!
414! Column rev:
415!
416 colsta(icol) = iz
417 icol = icol + 1
418 rowno(iz) = +1
419 value(iz) = 1.05d0**(1-it)
420 nlflag(iz) = 0
421 iz = iz + 1
422 rowno(iz) = is+6
423 value(iz) = 1.d0
424 nlflag(iz) = 0
425 iz = iz + 1
426 enddo
427 colsta(icol) = iz
430
431end Function pin_readmatrix
432!
433! =====================================================================
434! Compute nonlinear terms and non-constant Jacobian elements
435!
436
437!> Compute nonlinear terms and non-constant Jacobian elements
438!!
439!! @include{doc} fdeval_params.dox
440Integer Function pin_fdeval( x, g, jac, rowno, jcnm, mode, ignerr, errcnt, &
441 n, nz, thread, usrmem )
442#ifdef dec_directives_win32
443!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_FDEval
444#endif
445 Use data_t
446 implicit none
447 integer, intent (in) :: n ! number of variables
448 integer, intent (in) :: rowno ! number of the row to be evaluated
449 integer, intent (in) :: nz ! number of nonzeros in this row
450 real*8, intent (in), dimension(n) :: x ! vector of current solution values
451 real*8, intent (in out) :: g ! constraint value
452 real*8, intent (in out), dimension(n) :: jac ! vector of derivatives for current constraint
453 integer, intent (in), dimension(nz) :: jcnm ! list of variables that appear nonlinearly
454 ! in this row. Ffor information only.
455 integer, intent (in) :: mode ! evaluation mode: 1 = function value
456 ! 2 = derivatives, 3 = both
457 integer, intent (in) :: ignerr ! if 1 then errors can be ignored as long
458 ! as errcnt is incremented
459 integer, intent (in out) :: errcnt ! error counter to be incremented in case
460 ! of function evaluation errors.
461 integer, intent (in) :: thread
462 real*8 usrmem(*) ! optional user memory
463
464 integer it, is
465 real*8 h1, h2
466!
467! Compute the number of the period
468!
469 pin_fdeval = 0
470 it = (rowno+4) / 6
471 is = 7*(it-1)
472 if ( rowno == 1 ) then
473!
474! This is the linear objective
475! Obj : sum(t,(1+r)**(1-t)*rev(t)
476!
477 if ( mode == 1 .or. mode == 3 ) then
478 g = 0.0d0
479 do it = 1, t
480 is = 7*(it-1)
481 g = g + x(is+7) * 1.05d0**(1-it)
482 enddo
483 endif
484 if ( mode == 2 .or. mode == 3 ) then
485 do it = 1, t
486 is = 7*(it-1)
487 jac(is+7) = 1.05d0**(1-it)
488 enddo
489 endif
490 else if ( rowno == (it-1)*6+2 ) then
491!
492! tddef equation. All terms: td + 0.13*p -0.87*td(t-1)
493!
494 if ( mode == 1 .or. mode == 3 ) then
495 g = x(is+1) + 0.13d0*x(is+6)
496 if ( it > 1 ) g = g - 0.87d0*x(is+1-7)
497 endif
498 if ( mode == 2 .or. mode == 3 ) then
499 jac(is+1) = 1.0d0
500 jac(is+6) = 0.13d0
501 if ( it > 1 ) jac(is+1-7) = -0.87d0
502 endif
503 else if ( rowno == (it-1)*6+3 ) then
504!
505! sdef equation. All terms: s - 0.75*s(t-1) -(1.1+0.1*p)*1.02**(-cs/7)
506!
507 h1 = (1.1d0+0.1d0*x(is+6))
508 h2 = 1.02d0**(-x(is+2)/7.d0)
509 if ( mode == 1 .or. mode == 3 ) then
510 g = x(is+3) -h1*h2
511 if ( it > 1 ) g = g - 0.75d0*x(is+3-7) ! 0.75*s(t-1) only it t > 1
512 endif
513 if ( mode == 2 .or. mode == 3 ) then
514 jac(is+2) = h1*h2*log(1.02d0)/7.d0
515 jac(is+6) = -h2*0.1d0
516 jac(is+3) = +1.0d0
517 if ( it > 1 ) jac(is+3-7) = -0.75d0
518 endif
519 else if ( rowno == (it-1)*6+4 ) then
520!
521! csdef equation. All terms: cs - s - cs(t-1)
522!
523 if ( mode == 1 .or. mode == 3 ) then
524 g = x(is+2) - x(is+3)
525 if ( it > 1 ) g = g - x(is+2-7)
526 endif
527 if ( mode == 2 .or. mode == 3 ) then
528 jac(is+2) = 1.0d0
529 jac(is+3) = -1.0d0
530 if ( it > 1 ) jac(is+2-7) = -1.0d0
531 endif
532 else if ( rowno == (it-1)*6+5 ) then
533!
534! ddef equation. All terms: -td + s + d
535!
536 if ( mode == 1 .or. mode == 3 ) then
537 g = -x(is+1) + x(is+3) + x(is+4)
538 endif
539 if ( mode == 2 .or. mode == 3 ) then
540 jac(is+1) = -1.0d0
541 jac(is+3) = 1.0d0
542 jac(is+4) = 1.0d0
543 endif
544 else if ( rowno == (it-1)*6+6 ) then
545!
546! rdef equation. All terms: d + r - r(t-1)
547!
548 if ( mode == 1 .or. mode == 3 ) then
549 g = x(is+4) + x(is+5)
550 if ( it > 1 ) g = g - x(is+5-7)
551 endif
552 if ( mode == 2 .or. mode == 3 ) then
553 jac(is+4) = 1.0d0
554 jac(is+5) = 1.0d0
555 if ( it > 1 ) jac(is+5-7) = -1.0d0
556 endif
557 elseif ( rowno == (it-1)*6+7 ) then
558!
559! revdef equation. All terms: rev - d*(p-250/r)
560!
561 if ( mode == 1 .or. mode == 3 ) then
562 g = x(is+7) -x(is+4)*(x(is+6)-250.d0/x(is+5))
563 endif
564 if ( mode == 2 .or. mode == 3 ) then
565 jac(is+4) = -(x(is+6)-250.d0/x(is+5))
566 jac(is+5) = -x(is+4)*250d0/x(is+5)**2
567 jac(is+6) = -x(is+4)
568 jac(is+7) = +1.0d0
569 endif
570 else
571!
572! We should have covered everything above so this is an error.
573!
574 pin_fdeval = 1
575 endif
576
577end Function pin_fdeval
578
579Integer Function pin_solution( XVAL, XMAR, XBAS, XSTA, YVAL, YMAR, YBAS, YSTA, N, M, USRMEM )
580#ifdef dec_directives_win32
581!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Pin_Solution
582#endif
583!
584! Specialized solution callback routine with names for variables and constraints
585!
586 Use proginfo
587 Use data_t
588 IMPLICIT NONE
589 INTEGER, Intent(IN) :: n, m
590 INTEGER, Intent(IN), Dimension(N) :: xbas, xsta
591 INTEGER, Intent(IN), Dimension(M) :: ybas, ysta
592 real*8, Intent(IN), Dimension(N) :: xval, xmar
593 real*8, Intent(IN), Dimension(M) :: yval, ymar
594 real*8, Intent(IN OUT) :: usrmem(*)
595 character*6, parameter, dimension(7) :: vname = (/'td ','cs ','s ','d ','r ','p ','rev '/)
596 character*6, parameter, dimension(6) :: ename = (/'tddef ','sdef ','csdef ','ddef ','rdef ','revdef'/)
597
598 INTEGER :: i, it, i1
599 CHARACTER*5, Parameter, Dimension(4) :: stat = (/ 'Lower','Upper','Basic','Super' /)
600
601 WRITE(10,"(/' Variable Solution value Reduced cost B-stat'/)")
602 i = 0
603 do it = 1, t
604 DO i1 = 1, 7
605 i = i + 1
606 WRITE(10,"(1X,A6,i2,1p,E20.6,E16.6,4X,A5 )") vname(i1), it, xval(i), xmar(i), stat(1+xbas(i))
607 ENDDO
608 enddo
609
610 WRITE(10,"(/' Constrnt Activity level Marginal cost B-stat'/)")
611 i = 1
612 WRITE(10,"(1x,'Objective',1P,E19.6,E16.6,4X,A5 )") yval(i), ymar(i), stat(1+ybas(i))
613 do it = 1, t
614 do i1 = 1, 6
615 i = i + 1
616 WRITE(10,"(1x,A6,i2,1P,E20.6,E16.6,4X,A5 )") ename(i1),it, yval(i), ymar(i), stat(1+ybas(i))
617 enddo
618 ENDDO
619
620 solcalls = solcalls + 1
621 pin_solution = 0
622
623END Function pin_solution
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_errmsg(rowno, colno, posno, msglen, usrmem, msg)
Definition comdecl.f90:286
program fvboth2
Main program. A simple setup and call of CONOPT.
Definition fvboth2.f90:22
integer function pin_fdeval(x, g, jac, rowno, jcnm, mode, ignerr, errcnt, n, nz, thread, usrmem)
Compute nonlinear terms and non-constant Jacobian elements.
Definition fvboth.f90:429
integer function pin_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
Definition fvboth.f90:161
integer function pin_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
Definition fvboth.f90:535
integer(c_int) function coidef_message(cntvect, coi_message)
define callback routine for handling messages returned during the solution process.
Definition conopt.f90:1265
integer(c_int) function coidef_solution(cntvect, coi_solution)
define callback routine for returning the final solution values.
Definition conopt.f90:1238
integer(c_int) function coidef_status(cntvect, coi_status)
define callback routine for returning the completion status.
Definition conopt.f90:1212
integer(c_int) function coidef_readmatrix(cntvect, coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
Definition conopt.f90:1111
integer(c_int) function coidef_errmsg(cntvect, coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
Definition conopt.f90:1291
integer(c_int) function coidef_fdeval(cntvect, coi_fdeval)
define callback routine for performing function and derivative evaluations.
Definition conopt.f90:1135
integer(c_int) function coidef_fvforall(cntvect, fvforall)
call the FDEval for all constraints, including linear constraints.
Definition conopt.f90:1083
integer(c_int) function coidef_license(cntvect, licint1, licint2, licint3, licstring)
define the License Information.
Definition conopt.f90:293
integer(c_int) function coidef_debugfv(cntvect, debugfv)
turn Debugging of FDEval on and off.
Definition conopt.f90:387
integer(c_int) function coidef_fvinclin(cntvect, fvinclin)
include the linear terms in function evaluations.
Definition conopt.f90:1053
integer(c_int) function coidef_numvar(cntvect, numvar)
defines the number of variables in the model.
Definition conopt.f90:97
integer(c_int) function coidef_numcon(cntvect, numcon)
defines the number of constraints in the model.
Definition conopt.f90:121
integer(c_int) function coidef_numnlnz(cntvect, numnlnz)
defines the Number of Nonlinear Nonzeros.
Definition conopt.f90:167
integer(c_int) function coidef_optdir(cntvect, optdir)
defines the Optimization Direction.
Definition conopt.f90:213
integer(c_int) function coidef_numnz(cntvect, numnz)
defines the number of nonzero elements in the Jacobian.
Definition conopt.f90:144
integer(c_int) function coidef_objcon(cntvect, objcon)
defines the Objective Constraint.
Definition conopt.f90:239
integer(c_int) function coi_create(cntvect)
initializes CONOPT and creates the control vector.
Definition conopt.f90:1726
integer(c_int) function coi_free(cntvect)
frees the control vector.
Definition conopt.f90:1749
subroutine coiget_version(major, minor, patch)
returns the version number. It can be used to ensure that the modeler is linked to the correct versio...
Definition conopt.f90:1645
integer(c_int) function coi_solve(cntvect)
method for starting the solving process of CONOPT.
Definition conopt.f90:1625
real *8 obj
Definition comdecl.f90:16
integer solcalls
Definition comdecl.f90:15
integer sstat
Definition comdecl.f90:18
subroutine finalize
Definition comdecl.f90:79
integer stacalls
Definition comdecl.f90:14
subroutine flog(msg, code)
Definition comdecl.f90:62
logical do_allocate
Definition comdecl.f90:27
integer, parameter maximize
Definition comdecl.f90:31
integer mstat
Definition comdecl.f90:17
subroutine startup
Definition comdecl.f90:41