CONOPT
Loading...
Searching...
No Matches
tutorial2r.f90
Go to the documentation of this file.
1!> @file tutorial2r.f90
2!! @ingroup FORT1THREAD_EXAMPLES
3!! @brief This is a revised version of Tutorial2 in which the production
4!! function is split into two equations using an intermediate variable.
5!!
6!! The purpose is to make the expressions simpler, in particular the
7!! second order terms.
8!! The equation
9!! Row 2: `Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho)) ** ( -1.d0/Rho ) - Out = 0`
10!! is replaced by
11!! Row 2 (new): `Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho)) = Int`
12!! Row 4 (new): `Int**( -1.d0/Rho ) = Out`
13!! where `Int` is a new variable.
14!!
15!! For more information about the individual callbacks, please have a look at the source code.
16
17#if defined(_WIN32) && !defined(_WIN64)
18#define dec_directives_win32
19#endif
20
21!> Main program. A simple setup and call of CONOPT
22!!
23Program tutorial2r
24
26 Use conopt
27 implicit None
28!
29! Declare the user callback routines as Integer, External:
30!
31 Integer, External :: tut_readmatrix ! Mandatory Matrix definition routine defined below
32 Integer, External :: tut_fdeval ! Function and Derivative evaluation routine
33 ! needed a nonlinear model.
34 Integer, External :: std_status ! Standard callback for displaying solution status
35 Integer, External :: std_solution ! Standard callback for displaying solution values
36 Integer, External :: std_message ! Standard callback for managing messages
37 Integer, External :: std_errmsg ! Standard callback for managing error messages
38 Integer, External :: tut_2dlagrstr ! Callback for second derivatives structure
39 Integer, External :: tut_2dlagrval ! Callback for second derivatives values
40#ifdef dec_directives_win32
41!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_ReadMatrix
42!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_FDEval
43!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Status
44!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Solution
45!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_Message
46!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Std_ErrMsg
47!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_2DLagrStr
48!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_2DLagrVal
49#endif
50!
51! Control vector
52!
53 INTEGER, Dimension(:), Pointer :: cntvect
54 INTEGER :: coi_error
55
56 call startup
57!
58! Create and initialize a Control Vector
59!
60 coi_error = coi_create( cntvect )
61!
62! Tell CONOPT about the size of the model by populating the Control Vector:
63!
64 coi_error = max( coi_error, coidef_numvar( cntvect, 5 ) ) ! 5 variables
65 coi_error = max( coi_error, coidef_numcon( cntvect, 4 ) ) ! 4 constraints
66 coi_error = max( coi_error, coidef_numnz( cntvect, 11 ) ) ! 11 nonzeros in the Jacobian
67 coi_error = max( coi_error, coidef_numnlnz( cntvect, 5 ) ) ! 5 of which are nonlinear
68 coi_error = max( coi_error, coidef_numhess( cntvect, 4 ) ) ! 4 elements in the Hessian of the Lagrangian
69 coi_error = max( coi_error, coidef_optdir( cntvect, 1 ) ) ! Maximize
70 coi_error = max( coi_error, coidef_objcon( cntvect, 1 ) ) ! Objective is constraint 1
71 coi_error = max( coi_error, coidef_debugfv( cntvect, 0 ) ) ! Debug Fdeval on or off
72 coi_error = max( coi_error, coidef_debug2d( cntvect, 0 ) ) ! Debug 2nd derivatives on or off
73 coi_error = max( coi_error, coidef_optfile( cntvect, 'tutorial.opt' ) )
74!
75! Tell CONOPT about the callback routines:
76!
77 coi_error = max( coi_error, coidef_readmatrix( cntvect, tut_readmatrix ) )
78 coi_error = max( coi_error, coidef_fdeval( cntvect, tut_fdeval ) )
79 coi_error = max( coi_error, coidef_status( cntvect, std_status ) )
80 coi_error = max( coi_error, coidef_solution( cntvect, std_solution ) )
81 coi_error = max( coi_error, coidef_message( cntvect, std_message ) )
82 coi_error = max( coi_error, coidef_errmsg( cntvect, std_errmsg ) )
83 coi_error = max( coi_error, coidef_2dlagrstr( cntvect, tut_2dlagrstr ) )
84 coi_error = max( coi_error, coidef_2dlagrval( cntvect, tut_2dlagrval ) )
85
86#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
87 coi_error = max( coi_error, coidef_license( cntvect, conopt_license_int_1, conopt_license_int_2, conopt_license_int_3, conopt_license_text) )
88#endif
89
90 If ( coi_error .ne. 0 ) THEN
91 write(*,*)
92 write(*,*) '**** Fatal Error while loading CONOPT Callback routines.'
93 write(*,*)
94 call flog( "Skipping Solve due to setup errors", 1 )
95 ENDIF
96!
97! Start CONOPT:
98!
99 coi_error = coi_solve( cntvect )
100
101 write(*,*)
102 write(*,*) 'End of Tutorial2r example. Return code=',coi_error
103
104 If ( coi_error /= 0 ) then
105 call flog( "Errors encountered during solution", 1 )
106 elseif ( stacalls == 0 .or. solcalls == 0 ) then
107 call flog( "Status or Solution routine was not called", 1 )
108 elseif ( sstat /= 1 .or. mstat /= 2 ) then
109 call flog( "Solver and Model Status was not as expected (1,2)", 1 )
110 elseif ( abs( obj-0.572943d0 ) > 0.000001d0 ) then
111 call flog( "Incorrect objective returned", 1 )
112 endif
113
114 if ( coi_free(cntvect) /= 0 ) call flog( "Error while freeing control vector",1)
115
116 call flog( "Successful Solve", 0 )
117!
118! Free solution memory
119!
120 call finalize
121
122End Program tutorial2r
123
124!> Define information about the model
125!!
126!! @include{doc} readMatrix_params.dox
127Integer Function tut_readmatrix( lower, curr, upper, vsta, type, rhs, esta, &
128 colsta, rowno, value, nlflag, n, m, nz, &
129 usrmem )
130#ifdef dec_directives_win32
131!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_ReadMatrix
132#endif
133 implicit none
134 integer, intent (in) :: n ! number of variables
135 integer, intent (in) :: m ! number of constraints
136 integer, intent (in) :: nz ! number of nonzeros
137 real*8, intent (in out), dimension(n) :: lower ! vector of lower bounds
138 real*8, intent (in out), dimension(n) :: curr ! vector of initial values
139 real*8, intent (in out), dimension(n) :: upper ! vector of upper bounds
140 integer, intent (in out), dimension(n) :: vsta ! vector of initial variable status
141 ! (not defined here)
142 integer, intent (out), dimension(m) :: type ! vector of equation types
143 integer, intent (in out), dimension(m) :: esta ! vector of initial equation status
144 ! (not defined here)
145 real*8, intent (in out), dimension(m) :: rhs ! vector of right hand sides
146 integer, intent (in out), dimension(n+1) :: colsta ! vector with start of column indices
147 integer, intent (out), dimension(nz) :: rowno ! vector of row numbers
148 integer, intent (in out), dimension(nz) :: nlflag ! vector of nonlinearity flags
149 real*8, intent (in out), dimension(nz) :: value ! vector of matrix values
150 real*8 usrmem(*) ! optional user memory
151!
152! Parameters needed for new initial value -- could be moved to a
153! Module
154!
155 real*8, parameter :: al = 0.16d0
156 real*8, parameter :: ak = 2.0d0
157 real*8, parameter :: ainp = 0.16d0
158 real*8, parameter :: rho = 1.0d0
159 real*8, parameter :: k = 4.0d0
160!
161! Information about Variables:
162! Default: Lower = -Inf, Curr = 0, and Upper = +inf.
163! Default: the status information in Vsta is not used.
164!
165! Lower bound on L = X(1) = 0.1 and initial value = 0.5:
166!
167 lower(1) = 0.1d0
168 curr(1) = 0.5d0
169!
170! Lower bound on INP = X(2) = 0.1 and initial value = 0.5:
171!
172 lower(2) = 0.1d0
173 curr(2) = 0.5d0
174!
175! Lower bound on OUT = X(3) and P = X(4) are both 0 and the
176! default initial value of 0 is used:
177!
178 lower(3) = 0.d0
179 lower(4) = 0.d0
180!
181! The added variable, in the following called Int, is given a lower
182! bound of 0.01 and an initial value consistent with the defining
183! equation, i.e. int = (Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho))
184!
185 lower(5) = 0.01d0
186 curr(5) = (al*curr(1)**(-rho) + ak*k**(-rho) + ainp*curr(2)**(-rho))
187!
188! Information about Constraints:
189! Default: Rhs = 0
190! Default: the status information in Esta and the function
191! value in FV are not used.
192! Default: Type: There is no default.
193! 0 = Equality,
194! 1 = Greater than or equal,
195! 2 = Less than or equal,
196! 3 = Non binding.
197!
198! Constraint 1 (Objective)
199! Rhs = -0.1 and type Non binding
200!
201 rhs(1) = -0.1d0
202 type(1) = 3
203!
204! Constraint 2 (Production Function)
205! Rhs = 0 and type Equality
206!
207 type(2) = 0
208!
209! Constraint 3 (Price equation)
210! Rhs = 4.0 and type Equality
211!
212 rhs(3) = 4.d0
213 type(3) = 0
214!
215! Constraint 4 (additional equation)
216! Rhs = 0.0 and type Equality
217!
218 type(4) = 0
219!
220! Information about the Jacobian. CONOPT expects a columnwise
221! representation in Rowno, Value, Nlflag and Colsta.
222!
223! Colsta = Start of column indices (No Defaults):
224! Rowno = Row indices
225! Value = Value of derivative (by default only linear
226! derivatives are used)
227! Nlflag = 0 for linear and 1 for nonlinear derivative
228! (not needed for completely linear models)
229!
230! Indices
231! L INP OUT P Int
232! x(1) x(2) x(3) x(4) x(5)
233! 1: 1 3 5 8
234! 2: 2 4 10
235! 3: 6 9
236! 4 7 11
237!
238 colsta(1) = 1
239 colsta(2) = 3
240 colsta(3) = 5
241 colsta(4) = 8
242 colsta(5) = 10
243 colsta(6) = 12
244 rowno(1) = 1
245 rowno(2) = 2
246 rowno(3) = 1
247 rowno(4) = 2
248 rowno(5) = 1
249 rowno(6) = 3
250 rowno(7) = 4
251 rowno(8) = 1
252 rowno(9) = 3
253 rowno(10) = 2
254 rowno(11) = 4
255!
256! Nonlinearity Structure: L = 0 are linear and NL = 1 are nonlinear
257! x(1) x(2) x(3) x(4) x(5)
258! 1: L L NL NL
259! 2: NL NL L
260! 3: L L
261! 4: L NL
262!
263 nlflag(1) = 0
264 nlflag(2) = 1
265 nlflag(3) = 0
266 nlflag(4) = 1
267 nlflag(5) = 1
268 nlflag(6) = 0
269 nlflag(7) = 0
270 nlflag(8) = 1
271 nlflag(9) = 0
272 nlflag(10)= 0
273 nlflag(11)= 1
274!
275! Value (Linear only)
276! x(1) x(2) x(3) x(4) x(5)
277! 1: -1 -1 NL NL
278! 2: NL NL -1
279! 3: 1 2
280! 4: -1 NL
281!
282 value(1) = -1.d0
283 value(3) = -1.d0
284 value(6) = 1.d0
285 value(7) = -1.d0
286 value(9) = 2.d0
287 value(10) = -1.d0
288
289 tut_readmatrix = 0 ! Return value means OK
290
291end Function tut_readmatrix
292
293!> Compute nonlinear terms and non-constant Jacobian elements
294!!
295!! @include{doc} fdeval_params.dox
296Integer Function tut_fdeval( x, g, jac, rowno, jcnm, mode, ignerr, errcnt, &
297 n, nz, thread, usrmem )
298#ifdef dec_directives_win32
299!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_FDEval
300#endif
301 implicit none
302 integer, intent (in) :: n ! number of variables
303 integer, intent (in) :: rowno ! number of the row to be evaluated
304 integer, intent (in) :: nz ! number of nonzeros in this row
305 real*8, intent (in), dimension(n) :: x ! vector of current solution values
306 real*8, intent (in out) :: g ! constraint value
307 real*8, intent (in out), dimension(n) :: jac ! vector of derivatives for current constraint
308 integer, intent (in), dimension(nz) :: jcnm ! list of variables that appear nonlinearly
309 ! in this row. Ffor information only.
310 integer, intent (in) :: mode ! evaluation mode: 1 = function value
311 ! 2 = derivatives, 3 = both
312 integer, intent (in) :: ignerr ! if 1 then errors can be ignored as long
313 ! as errcnt is incremented
314 integer, intent (in out) :: errcnt ! error counter to be incremented in case
315 ! of function evaluation errors.
316 integer, intent (in) :: thread
317 real*8 usrmem(*) ! optional user memory
318!
319! Declare local copies of the optimization variables. This is
320! just for convenience to make the expressions easier to read.
321!
322 real*8 :: l, inp, out, p, int
323!
324! Declare parameters and their data values.
325!
326 real*8, parameter :: w = 1.0d0
327 real*8, parameter :: l0 = 0.1d0
328 real*8, parameter :: pinp = 1.0d0
329 real*8, parameter :: al = 0.16d0
330 real*8, parameter :: ak = 2.0d0
331 real*8, parameter :: ainp = 0.16d0
332 real*8, parameter :: rho = 1.0d0
333 real*8, parameter :: k = 4.0d0
334!
335! Move the optimization variables from the X vector to a set
336! of local variables with the same names as the variables in
337! the model description. This is not necessary, but it should make
338! the equations easier to recognize.
339!
340 l = x(1)
341 inp = x(2)
342 out = x(3)
343 p = x(4)
344 int = x(5)
345!
346! Row 1: the objective function is nonlinear
347!
348 if ( rowno .eq. 1 ) then
349!
350! Mode = 1 or 3. Function value: G = P * Out
351!
352 if ( mode .eq. 1 .or. mode .eq. 3 ) then
353 g = p * out
354 endif
355!
356! Mode = 2 or 3: Derivative values:
357!
358 if ( mode .eq. 2 .or. mode .eq. 3 ) then
359 jac(3) = p ! derivative w.r.t. Out = X(3)
360 jac(4) = out ! derivative w.r.t. P = X(4)
361 endif
362!
363! Row 2: The production function is nonlinear:
364! Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho))
365!
366 elseif ( rowno .eq. 2 ) then
367!
368! Mode = 1 or 3: Function value
369!
370 if ( mode .eq. 1 .or. mode .eq. 3 ) then
371 g = al*l**(-rho) + ak*k**(-rho) + ainp*inp**(-rho)
372 endif
373!
374! Mode = 2 or 3: Derivatives
375!
376 if ( mode .eq. 2 .or. mode .eq. 3 ) then
377 jac(1) = -rho * al * l ** (-rho-1.d0) ! derivative w.r.t. L = X(1)
378 jac(2) = -rho * ainp * inp ** (-rho-1.d0) ! derivative w.r.t. Inp = X(2)
379 endif
380!
381! Row = 4: Out = Int**(-1/Rho)
383 elseif ( rowno .eq. 4 ) then
384 if ( mode .eq. 1 .or. mode .eq. 3 ) then
385 g = int**(-1.d0/rho)
386 endif
387 if ( mode .eq. 2 .or. mode .eq. 3 ) then
388 jac(5) = (-1.d0/rho)*int**(-1.d0/rho-1.d0) ! derivative w.r.t. Int = X(5)
389 endif
390
391 endif
392 tut_fdeval = 0
393
394end Function tut_fdeval
395
396!> Specify the structure of the Lagrangian of the Hessian
397!!
398!! @include{doc} 2DLagrStr_params.dox
399Integer Function tut_2dlagrstr( HSRW, HSCL, NODRV, N, M, NHESS, UsrMem )
400#ifdef dec_directives_win32
401!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_2DLagrStr
402#endif
403 Implicit None
404
405 Integer, Intent (IN) :: n, m, nhess
406 Integer, Intent (IN OUT) :: nodrv
407 Integer, Dimension(Nhess), Intent (Out) :: hsrw, hscl
408 real*8, Intent(IN OUT) :: usrmem(*)
409!
410! There are two nonlinear constraints, P * Out in row 1 and Sdef and
411! Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho)) ** ( -1.d0/Rho ) in
412! row 2 and they have the following Hessians:
413!
414! Row1: P * Out
415! Hessian (diagonal and lower triangle): A total of 1 nonzero element
416! Out P
417! 3 4
418! 3
419! 4 1
420!
421! Row 2: Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho))
422! with L and Inp being the variables.
423! Hessian (diagonal and lower triangle): A total of 3 nonzero element
424! L Inp
425! 1 2
426! 1 d1
427! 2 d2
428!
429! where d1 = (-Rho)*(-Rho-1)*Al*L**(-Rho-2)
430! and d2 = (-Rho)*(-Rho-1)*Ainp*Inp**(-Rho-2)
431!
432! Row 4: Int**(-1/Rho)
433! Hessian (diagonal and lower triangle): A total of 1 nonzero element
434! Int
435! 5
436! 5 Int d3
437!
438! where d3 = (-1/Rho)*(-1/Rho-1)*Int**(-1/Rho-2)
439!
440! The three Hessian matrices do not overlap so the total number of
441! nonzeros is 4. The structure using numerical indices for rows and
442! columns and running indices for the Hessian element is:
443!
444! 1 2 3 4 5
445! 1 1
446! 2 2
447! 3
448! 4 3
449! 5 4
450!
451! and the same with names of variables and numbers of contributing
452! equations:
453!
454! L Inp Out P Int
455! L 2
456! Inp 2
457! Out
458! P 1
459! Int 4
460!
461!
462! Define structure of Hessian
463!
464 hsrw(1) = 1; hscl(1) = 1
465 hsrw(2) = 2; hscl(2) = 2
466 hsrw(3) = 4; hscl(3) = 3
467 hsrw(4) = 5; hscl(4) = 5
468
469 tut_2dlagrstr = 0
470
471End Function tut_2dlagrstr
472
473!> Compute the Lagrangian of the Hessian
474!!
475!! @include{doc} 2DLagrVal_params.dox
476Integer Function tut_2dlagrval( X, U, HSRW, HSCL, HSVL, NODRV, N, M, NHESS, UsrMem )
477#ifdef dec_directives_win32
478!DEC$ ATTRIBUTES STDCALL, REFERENCE, NOMIXED_STR_LEN_ARG :: Tut_2DLagrVal
479#endif
480 Implicit None
481
482 Integer, Intent (IN) :: n, m, nhess
483 Integer, Intent (IN OUT) :: nodrv
484 real*8, Dimension(N), Intent (IN) :: x
485 real*8, Dimension(M), Intent (IN) :: u
486 Integer, Dimension(NHess), Intent (IN) :: hsrw, hscl
487 real*8, Dimension(NHess), Intent (Out) :: hsvl
488 real*8, Intent(IN OUT) :: usrmem(*)
489!
490! Declare local copies of the optimization variables. This is
491! just for convenience to make the expressions easier to read.
492!
493 real*8 :: l, inp
494!
495! Declare parameters and their data values.
496!
497 real*8, parameter :: w = 1.0d0
498 real*8, parameter :: l0 = 0.1d0
499 real*8, parameter :: pinp = 1.0d0
500 real*8, parameter :: al = 0.16d0
501 real*8, parameter :: ak = 2.0d0
502 real*8, parameter :: ainp = 0.16d0
503 real*8, parameter :: rho = 1.0d0
504 real*8, parameter :: k = 4.0d0
505!
506! There are two nonlinear constraints, P * Out in row 1 and Sdef and
507! Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho)) ** ( -1.d0/Rho ) in
508! row 2 and they have the following Hessians:
509!
510! Row1: P * Out
511! Hessian (diagonal and lower triangle): A total of 1 nonzero element
512! Out P
513! 3 4
514! 3
515! 4 1
516!
517! Row 2: Al*L**(-Rho) + Ak*K**(-Rho) + Ainp*Inp**(-Rho))
518! with L and Inp being the variables.
519! Hessian (diagonal and lower triangle): A total of 3 nonzero element
520! L Inp
521! 1 2
522! 1 d1
523! 2 d2
524!
525! where d1 = (-Rho)*(-Rho-1)*Al*L**(-Rho-2)
526! and d2 = (-Rho)*(-Rho-1)*Ainp*Inp**(-Rho-2)
527!
528! Row 4: Int**(-1/Rho)
529! Hessian (diagonal and lower triangle): A total of 1 nonzero element
530! Int
531! 5
532! 5 Int d3
533!
534! where d3 = (-1/Rho)*(-1/Rho-1)*Int**(-1/Rho-2)
535!
536! The three Hessian matrices do not overlap so the total number of
537! nonzeros is 4. The structure using numerical indices for rows and
538! columns and running indices for the Hessian element is:
539!
540! 1 2 3 4 5
541! 1 1
542! 2 2
543! 3
544! 4 3
545! 5 4
546!
547! and the same with names of variables and numbers of contributing
548! equations:
549!
550! L Inp Out P Int
551! L 2
552! Inp 2
553! Out
554! P 1
555! Int 4
556!
557!
558! Normal Evaluation mode
559!
560 hsvl(3) = u(1) ! Second derivative of constraint 1 is 1
561 if ( u(2) .ne. 0.d0 ) Then
562 l = x(1)
563 inp = x(2)
564 hsvl(1) = (-rho) * (-rho-1.d0) * al * l**(-rho-2.d0) * u(2)
565 hsvl(2) = (-rho) * (-rho-1.d0) * ainp * inp**(-rho-2.d0) * u(2)
566 endif
567 if ( u(4) .ne. 0.d0 ) then
568 hsvl(4) = (-1.d0/rho)*(-1.d0/rho-1.d0)*x(5)**(-1.d0/rho-2.d0)
569 endif
570
571 tut_2dlagrval = 0
572
573End Function tut_2dlagrval
Main program. A simple setup and call of CONOPT.
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
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
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_2dlagrstr(cntvect, coi_2dlagrstr)
define callback routine for providing the structure of the second derivatives of the Lagrangian.
Definition conopt.f90:1547
integer(c_int) function coidef_optfile(cntvect, optfile)
define callback routine for defining an options file.
Definition conopt.f90:928
integer(c_int) function coidef_2dlagrval(cntvect, coi_2dlagrval)
define callback routine for computing the values of the second derivatives of the Lagrangian.
Definition conopt.f90:1573
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_debug2d(cntvect, debug2d)
turn debugging of 2nd derivatives on and off.
Definition conopt.f90:534
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_numhess(cntvect, numhess)
defines the Number of Hessian Nonzeros.
Definition conopt.f90:188
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
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
integer mstat
Definition comdecl.f90:17
subroutine startup
Definition comdecl.f90:41
integer function tut_2dlagrval(x, u, hsrw, hscl, hsvl, nodrv, n, m, nhess, usrmem)
Compute the Lagrangian of the Hessian.
integer function tut_2dlagrstr(hsrw, hscl, nodrv, n, m, nhess, usrmem)
Specify the structure of the Lagrangian of the Hessian.
integer function tut_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
Definition tutorial.f90:109
integer function tut_fdeval(x, g, jac, rowno, jcnm, mode, ignerr, errcnt, n, nz, thread, usrmem)
Compute nonlinear terms and non-constant Jacobian elements.
Definition tutorial.f90:242