47#if defined(_WIN32) && !defined(_WIN64)
48#define dec_directives_win32
66#ifdef dec_directives_win32
76 INTEGER,
Dimension(:),
Pointer :: cntvect
94 coi_error = max( coi_error,
coidef_optfile( cntvect,
'cns03.opt' ) )
104#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
105 coi_error = max( coi_error,
coidef_license( cntvect, conopt_license_int_1, conopt_license_int_2, conopt_license_int_3, conopt_license_text) )
108 If ( coi_error .ne. 0 )
THEN
110 write(*,*)
'**** Fatal Error while loading CONOPT Callback routines.'
112 call flog(
"Skipping Solve due to setup errors", 1 )
124 If ( coi_error /= 0 )
then
125 call flog(
"Errors encountered during solution", 1 )
127 call flog(
"Status or Solution routine was not called", 1 )
128 elseif (
sstat /= 1 )
then
129 call flog(
"Solver Status was not 1 as expected.", 1 )
131 if (
mstat == 5 )
then
133 call flog(
"Mstat = 5 and Count of infeasibilities was not positive.", 1 )
135 call flog(
"Mstat = 4 and Count of dependencies was not positive.", 1 )
137 elseif (
mstat == 17 )
then
139 call flog(
"Mstat = 17 and Count of infeasibilities was not zero.", 1 )
141 call flog(
"Mstat = 17 and Count of dependencies was not positive.", 1 )
144 elseif (
mstat == 16 )
then
147 call flog(
"Model Status was not as expected 5, 16, or 17.", 1 )
151 if ( abs(
xprim(2)+
xprim(3)-2.0d0) > 1.d-8 )
then
152 call flog(
"Bad levels for x2 + x3.", 1 )
153 else if ( abs(
uprim(1)-5.0d0) > 1.d-8 )
then
154 call flog(
"Bad e1 level.", 1 )
155 else if ( abs(
uprim(2)-7.0d0) > 1.d-8 )
then
156 call flog(
"Bad e2 level.", 1 )
161 write(*,*)
'End of Cns03 example. Return code=',coi_error
163 if (
coi_free(cntvect) /= 0 )
call flog(
"Error while freeing control vector",1)
165 call flog(
"Successful Solve", 0 )
176Integer Function cns03_readmatrix( lower, curr, upper, vsta, type, rhs, esta, &
177 colsta, rowno, value, nlflag, n, m, nz, &
179#ifdef dec_directives_win32
183 integer,
intent (in) :: n
184 integer,
intent (in) :: m
185 integer,
intent (in) :: nz
186 real*8,
intent (in out),
dimension(n) :: lower
187 real*8,
intent (in out),
dimension(n) :: curr
188 real*8,
intent (in out),
dimension(n) :: upper
189 integer,
intent (in out),
dimension(n) :: vsta
191 integer,
intent (out),
dimension(m) ::
type
192 integer,
intent (in out),
dimension(m) :: esta
194 real*8,
intent (in out),
dimension(m) :: rhs
195 integer,
intent (in out),
dimension(n+1) :: colsta
196 integer,
intent (out),
dimension(nz) :: rowno
197 integer,
intent (in out),
dimension(nz) :: nlflag
198 real*8,
intent (in out),
dimension(nz) ::
value
integer function cns03_readmatrix(lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
Define information about the model.
program cns03
Main program. A simple setup and call of CONOPT.
integer function std_solution(xval, xmar, xbas, xsta, yval, ymar, ybas, ysta, n, m, usrmem)
integer function std_status(modsta, solsta, iter, objval, usrmem)
integer function std_message(smsg, dmsg, nmsg, llen, usrmem, msgv)
integer function std_errmsg(rowno, colno, posno, msglen, usrmem, msg)
integer(c_int) function coidef_message(cntvect, coi_message)
define callback routine for handling messages returned during the solution process.
integer(c_int) function coidef_solution(cntvect, coi_solution)
define callback routine for returning the final solution values.
integer(c_int) function coidef_status(cntvect, coi_status)
define callback routine for returning the completion status.
integer(c_int) function coidef_readmatrix(cntvect, coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
integer(c_int) function coidef_errmsg(cntvect, coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
integer(c_int) function coidef_optfile(cntvect, optfile)
define callback routine for defining an options file.
integer(c_int) function coidef_license(cntvect, licint1, licint2, licint3, licstring)
define the License Information.
integer(c_int) function coidef_square(cntvect, square)
square models.
integer(c_int) function coidef_numvar(cntvect, numvar)
defines the number of variables in the model.
integer(c_int) function coidef_numcon(cntvect, numcon)
defines the number of constraints in the model.
integer(c_int) function coidef_numnlnz(cntvect, numnlnz)
defines the Number of Nonlinear Nonzeros.
integer(c_int) function coidef_numnz(cntvect, numnz)
defines the number of nonzero elements in the Jacobian.
integer(c_int) function coi_create(cntvect)
initializes CONOPT and creates the control vector.
integer(c_int) function coi_free(cntvect)
frees the control vector.
integer(c_int) function coi_solve(cntvect)
method for starting the solving process of CONOPT.
subroutine flog(msg, code)
real *8, dimension(:), pointer xprim
real *8, dimension(:), pointer uprim