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