CONOPT
Loading...
Searching...
No Matches
conopt.h
Go to the documentation of this file.
1/* CONOPT C API
2 *
3 * Copyright (C) 1995-2025 GAMS Software GmbH
4 * Copyright (C) 1995-2025 GAMS Development Corporation
5 */
6
11
12#ifndef CONOPT_H_
13#define CONOPT_H_
14
16#if defined(_WIN32)
17#define COI_CALLCONV __stdcall
18#else
19#define COI_CALLCONV
20#endif
21
23#if defined(COI_API)
24#elif defined(_WIN32)
25#define COI_API __declspec(dllexport)
26#elif defined(__GNUC__) && __GNUC__ >= 4
27#define COI_API __attribute__((__visibility__("default")))
28#else
29#define COI_API
30#endif
31
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
38 typedef struct coiRec* coiHandle_t;
39
40 typedef int(COI_CALLCONV *COI_READMATRIX_t)(double LOWER[], double CURR[], double UPPER[], int VSTA[], int TYPEX[], double RHS[], int ESTA[], int COLSTA[], int ROWNO[], double VALUE[], int NLFLAG[], int NUMVAR, int NUMCON, int NUMNZ, void* USRMEM);
41 typedef int(COI_CALLCONV *COI_FDEVAL_t)(const double X[], double* G, double JAC[], int ROWNO, const int JACNUM[], int MODE, int IGNERR, int* ERRCNT, int NUMVAR, int NUMJAC, int THREAD, void* USRMEM);
42 typedef int(COI_CALLCONV *COI_FDEVALINI_t)(const double X[], const int ROWLIST[], int MODE, int LISTSIZE, int NUMTHREAD, int IGNERR, int* ERRCNT, int NUMVAR, void* USRMEM);
43 typedef int(COI_CALLCONV *COI_FDEVALEND_t)(int IGNERR, int* ERRCNT, void* USRMEM);
44 typedef int(COI_CALLCONV *COI_STATUS_t)(int MODSTA, int SOLSTA, int ITER, double OBJVAL, void* USRMEM);
45 typedef int(COI_CALLCONV *COI_SOLUTION_t)(const double XVAL[], const double XMAR[], const int XBAS[], const int XSTA[], const double YVAL[], const double YMAR[], const int YBAS[], const int YSTA[], int NUMVAR, int NUMCON, void* USRMEM);
46 typedef int(COI_CALLCONV *COI_MESSAGE_t)(int SMSG, int DMSG, int NMSG, char* MSGV[], void* USRMEM);
47 typedef int(COI_CALLCONV *COI_ERRMSG_t)(int ROWNO, int COLNO, int POSNO, const char* MSG, void* USRMEM);
48 typedef int(COI_CALLCONV *COI_PROGRESS_t)(int LEN_INT, const int INTX[], int LEN_RL, const double RL[], const double X[], void* USRMEM);
49 typedef int(COI_CALLCONV *COI_OPTION_t)(int NCALL, double* RVAL, int* IVAL, int* LVAL, char* NAME, void* USRMEM);
50 typedef int(COI_CALLCONV *COI_TRIORD_t)(int MODE, int TYPEX, int STATUS, int ROWNO, int COLNO, int INF, double VALUE, double RESID, void* USRMEM);
51 typedef int(COI_CALLCONV *COI_FDINTERVAL_t)(const double XMIN[], const double XMAX[], double* GMIN, double* GMAX, double JMIN[], double JMAX[], int ROWNO, const int JACNUM[], int MODE, double PINF, int NUMVAR, int NUMJAC, void* USRMEM);
52 typedef int(COI_CALLCONV *COI_2DDIR_t)(const double X[], const double DX[], double D2G[], int ROWNO, const int JACNUM[], int* NODRV, int NUMVAR, int NUMJAC, int THREAD, void* USRMEM);
53 typedef int(COI_CALLCONV *COI_2DDIRINI_t)(const double X[], const double DX[], const int ROWLIST[], int LISTSIZE, int NUMTHREAD, int NEWPT, int* NODRV, int NUMVAR, void* USRMEM);
54 typedef int(COI_CALLCONV *COI_2DDIREND_t)(int* NODRV, void* USRMEM);
55 typedef int(COI_CALLCONV *COI_2DDIRLAGR_t)(const double X[], const double DX[], const double U[], double D2G[], int NEWPT, int* NODRV, int NUMVAR, int NUMCON, void* USRMEM);
56 typedef int(COI_CALLCONV *COI_2DLAGRSIZE_t)(int* NODRV, int NUMVAR, int NUMCON, int* NHESS, int MAXHESS, void* USRMEM);
57 typedef int(COI_CALLCONV *COI_2DLAGRSTR_t)(int HSRW[], int HSCL[], int* NODRV, int NUMVAR, int NUMCON, int NHESS, void* USRMEM);
58 typedef int(COI_CALLCONV *COI_2DLAGRVAL_t)(const double X[], const double U[], const int HSRW[], const int HSCL[], double HSVL[], int* NODRV, int NUMVAR, int NUMCON, int NHESS, void* USRMEM);
60
65 COI_API int COI_CALLCONV COI_Solve(coiHandle_t cntvect);
66
71 COI_API void COI_CALLCONV COIGET_Version(int* major, int* minor, int* patch);
72
77 COI_API int COI_CALLCONV COIGET_MaxThreads(coiHandle_t cntvect);
78
83 COI_API double COI_CALLCONV COIGET_MaxHeapUsed(coiHandle_t cntvect);
84
89 COI_API int COI_CALLCONV COIGET_RangeErrors(coiHandle_t cntvect);
90
95 COI_API int COI_CALLCONV COI_Create(coiHandle_t *cntvect);
96
101 COI_API int COI_CALLCONV COI_Free(coiHandle_t *cntvect);
102
109
114 COI_API int COI_CALLCONV COIDEF_NumVar(coiHandle_t cntvect, int numvar);
115
120 COI_API int COI_CALLCONV COIDEF_NumCon(coiHandle_t cntvect, int numcon);
121
126 COI_API int COI_CALLCONV COIDEF_NumNz(coiHandle_t cntvect, int numnz);
127
132 COI_API int COI_CALLCONV COIDEF_NumNlNz(coiHandle_t cntvect, int numnlnz);
133
138 COI_API int COI_CALLCONV COIDEF_NumHess(coiHandle_t cntvect, int numhess);
139
144 COI_API int COI_CALLCONV COIDEF_OptDir(coiHandle_t cntvect, int optdir);
145
150 COI_API int COI_CALLCONV COIDEF_ObjVar(coiHandle_t cntvect, int objvar);
151
156 COI_API int COI_CALLCONV COIDEF_ObjCon(coiHandle_t cntvect, int objcon);
157
162 COI_API int COI_CALLCONV COIDEF_License(coiHandle_t cntvect, int licint1, int licint2, int licint3, const char *licstring);
163
168 COI_API int COI_CALLCONV COIDEF_ItLim(coiHandle_t cntvect, int itlim);
169
174 COI_API int COI_CALLCONV COIDEF_ErrLim(coiHandle_t cntvect, int errlim);
175
180 COI_API int COI_CALLCONV COIDEF_ResLim(coiHandle_t cntvect, double reslim);
181
186 COI_API int COI_CALLCONV COIDEF_MaxHeap(coiHandle_t cntvect, double maxheap);
187
192 COI_API int COI_CALLCONV COIDEF_IniStat(coiHandle_t cntvect, int inistat);
193
198 COI_API int COI_CALLCONV COIDEF_FVincLin(coiHandle_t cntvect, int fvinclin);
199
204 COI_API int COI_CALLCONV COIDEF_FVforAll(coiHandle_t cntvect, int fvforall);
205
210 COI_API int COI_CALLCONV COIDEF_MaxSup(coiHandle_t cntvect, int maxsup);
211
216 COI_API int COI_CALLCONV COIDEF_Square(coiHandle_t cntvect, int square);
217
222 COI_API int COI_CALLCONV COIDEF_EmptyRow(coiHandle_t cntvect, int emptyrow);
223
228 COI_API int COI_CALLCONV COIDEF_EmptyCol(coiHandle_t cntvect, int emptycol);
229
234 COI_API int COI_CALLCONV COIDEF_DisCont(coiHandle_t cntvect, int discont);
235
240 COI_API int COI_CALLCONV COIDEF_HessFac(coiHandle_t cntvect, double hessfac);
241
246 COI_API int COI_CALLCONV COIDEF_DebugFV(coiHandle_t cntvect, int debugfv);
247
252 COI_API int COI_CALLCONV COIDEF_Debug2D(coiHandle_t cntvect, int debug2d);
253
258 COI_API int COI_CALLCONV COIDEF_ClearM(coiHandle_t cntvect, int clearm);
259
264 COI_API int COI_CALLCONV COIDEF_ThreadS(coiHandle_t cntvect, int threads);
265
270 COI_API int COI_CALLCONV COIDEF_ThreadF(coiHandle_t cntvect, int threadf);
271
276 COI_API int COI_CALLCONV COIDEF_Thread2D(coiHandle_t cntvect, int thread2d);
277
282 COI_API int COI_CALLCONV COIDEF_ThreadC(coiHandle_t cntvect, int threadc);
283
288 COI_API int COI_CALLCONV COIDEF_StdOut(coiHandle_t cntvect, int tostdout);
289
294 COI_API int COI_CALLCONV COIDEF_Optfile(coiHandle_t cntvect, const char *optfile);
295
300 COI_API int COI_CALLCONV COIDEF_ReadMatrix(coiHandle_t cntvect, COI_READMATRIX_t coi_readmatrix);
301
306 COI_API int COI_CALLCONV COIDEF_FDEval(coiHandle_t cntvect, COI_FDEVAL_t coi_fdeval);
307
312 COI_API int COI_CALLCONV COIDEF_FDEvalIni(coiHandle_t cntvect, COI_FDEVALINI_t coi_fdevalini);
313
318 COI_API int COI_CALLCONV COIDEF_FDEvalEnd(coiHandle_t cntvect, COI_FDEVALEND_t coi_fdevalend);
319
324 COI_API int COI_CALLCONV COIDEF_Status(coiHandle_t cntvect, COI_STATUS_t coi_status);
325
330 COI_API int COI_CALLCONV COIDEF_Solution(coiHandle_t cntvect, COI_SOLUTION_t coi_solution);
331
336 COI_API int COI_CALLCONV COIDEF_Message(coiHandle_t cntvect, COI_MESSAGE_t coi_message);
337
342 COI_API int COI_CALLCONV COIDEF_ErrMsg(coiHandle_t cntvect, COI_ERRMSG_t coi_errmsg);
343
348 COI_API int COI_CALLCONV COIDEF_Progress(coiHandle_t cntvect, COI_PROGRESS_t coi_progress);
349
354 COI_API int COI_CALLCONV COIDEF_Option(coiHandle_t cntvect, COI_OPTION_t coi_option);
355
360 COI_API int COI_CALLCONV COIDEF_TriOrd(coiHandle_t cntvect, COI_TRIORD_t coi_triord);
361
366 COI_API int COI_CALLCONV COIDEF_FDInterval(coiHandle_t cntvect, COI_FDINTERVAL_t coi_fdinterval);
367
372 COI_API int COI_CALLCONV COIDEF_2DDir(coiHandle_t cntvect, COI_2DDIR_t coi_2ddir);
373
378 COI_API int COI_CALLCONV COIDEF_2DDirIni(coiHandle_t cntvect, COI_2DDIRINI_t coi_2ddirini);
379
384 COI_API int COI_CALLCONV COIDEF_2DDirEnd(coiHandle_t cntvect, COI_2DDIREND_t coi_2ddirend);
385
390 COI_API int COI_CALLCONV COIDEF_2DDirLagr(coiHandle_t cntvect, COI_2DDIRLAGR_t coi_2ddirlagr);
391
392 COI_API int COI_CALLCONV COIDEF_2DLagrSize(coiHandle_t cntvect, COI_2DLAGRSIZE_t coi_2dlagrsize);
393
398 COI_API int COI_CALLCONV COIDEF_2DLagrStr(coiHandle_t cntvect, COI_2DLAGRSTR_t coi_2dlagrstr);
399
404 COI_API int COI_CALLCONV COIDEF_2DLagrVal(coiHandle_t cntvect, COI_2DLAGRVAL_t coi_2dlagrval);
405
410 COI_API int COI_CALLCONV COIDEF_UsrMem(coiHandle_t cntvect, void* usrmem);
411
412#ifdef __cplusplus
413}
414#endif
415
416#endif /* CONOPT_H_ */
#define COI_CALLCONV
Definition conopt.h:19
#define COI_API
Definition conopt.h:29
int COIDEF_2DLagrSize(coiHandle_t cntvect, COI_2DLAGRSIZE_t coi_2dlagrsize)
program fvforall
Main program. A simple setup and call of CONOPT.
Definition fvforall.f90:20
program fvinclin
Main program. A simple setup and call of CONOPT.
Definition fvinclin.f90:20
int COIDEF_ReadMatrix(coiHandle_t cntvect, COI_READMATRIX_t coi_readmatrix)
define callback routine for providing the matrix data to CONOPT.
int COIDEF_Message(coiHandle_t cntvect, COI_MESSAGE_t coi_message)
define callback routine for handling messages returned during the solution process.
int COIDEF_FDEval(coiHandle_t cntvect, COI_FDEVAL_t coi_fdeval)
define callback routine for performing function and derivative evaluations.
int COIDEF_ErrMsg(coiHandle_t cntvect, COI_ERRMSG_t coi_errmsg)
define callback routine for returning error messages for row, column or Jacobian elements.
int COIDEF_Solution(coiHandle_t cntvect, COI_SOLUTION_t coi_solution)
define callback routine for returning the final solution values.
int COIDEF_Status(coiHandle_t cntvect, COI_STATUS_t coi_status)
define callback routine for returning the completion status.
int COIDEF_FDEvalEnd(coiHandle_t cntvect, COI_FDEVALEND_t coi_fdevalend)
define callback routine for the termination of the function and derivative evaluation.
int COIDEF_2DDirLagr(coiHandle_t cntvect, COI_2DDIRLAGR_t coi_2ddirlagr)
define callback routine for computing the second derivative of the Lagrangian in a direction.
int COIDEF_2DLagrStr(coiHandle_t cntvect, COI_2DLAGRSTR_t coi_2dlagrstr)
define callback routine for providing the structure of the second derivatives of the Lagrangian.
int COIDEF_2DDirIni(coiHandle_t cntvect, COI_2DDIRINI_t coi_2ddirini)
define callback routine for initializing the computation of second derivatives for a constraint in a ...
int COIDEF_2DDir(coiHandle_t cntvect, COI_2DDIR_t coi_2ddir)
define callback routine for computing the second derivative for a constraint in a direction.
int COIDEF_2DDirEnd(coiHandle_t cntvect, COI_2DDIREND_t coi_2ddirend)
define callback routine for termination the computation of second derivatives for a constraint in a d...
int COIDEF_UsrMem(coiHandle_t cntvect, void *usrmem)
provides a pointer to user memory that is available in all callback functions. NOTE: this is not a ca...
int COIDEF_Option(coiHandle_t cntvect, COI_OPTION_t coi_option)
define callback routine for defining runtime options.
int COIDEF_Optfile(coiHandle_t cntvect, const char *optfile)
define callback routine for defining an options file.
int COIDEF_FDInterval(coiHandle_t cntvect, COI_FDINTERVAL_t coi_fdinterval)
define callback routine for performing function and derivative evaluations on intervals.
int COIDEF_FDEvalIni(coiHandle_t cntvect, COI_FDEVALINI_t coi_fdevalini)
define callback routine to perform initialization tasks for the function and derivative evaluation.
int COIDEF_Progress(coiHandle_t cntvect, COI_PROGRESS_t coi_progress)
define callback routine for monitoring the algorithmic progress.
int COIDEF_2DLagrVal(coiHandle_t cntvect, COI_2DLAGRVAL_t coi_2dlagrval)
define callback routine for computing the values of the second derivatives of the Lagrangian.
int COIDEF_TriOrd(coiHandle_t cntvect, COI_TRIORD_t coi_triord)
define callback routine for providing the triangular order information.
int COIDEF_EmptyCol(coiHandle_t cntvect, int emptycol)
allow empty columns.
int COIDEF_Square(coiHandle_t cntvect, int square)
square models.
int COIDEF_HessFac(coiHandle_t cntvect, double hessfac)
factor for Hessian density relative to Jacobian density HessFac.
int COIDEF_ThreadS(coiHandle_t cntvect, int threads)
number of threads allowed internally in CONOPT.
int COIDEF_EmptyRow(coiHandle_t cntvect, int emptyrow)
allow empty rows.
int COIDEF_FVincLin(coiHandle_t cntvect, int fvinclin)
include the linear terms in function evaluations.
int COIDEF_IniStat(coiHandle_t cntvect, int inistat)
handling of the initial status values.
int COIDEF_Debug2D(coiHandle_t cntvect, int debug2d)
turn debugging of 2nd derivatives on and off.
int COIDEF_StdOut(coiHandle_t cntvect, int tostdout)
allow output to StdOut.
int COIDEF_ErrLim(coiHandle_t cntvect, int errlim)
define the Error Limit.
int COIDEF_ResLim(coiHandle_t cntvect, double reslim)
define resource limit.
int COIDEF_DisCont(coiHandle_t cntvect, int discont)
allow discontinuous functions and derivatives.
int COIDEF_MaxHeap(coiHandle_t cntvect, double maxheap)
define Limit on Heap Memory. ""
int COIDEF_ThreadF(coiHandle_t cntvect, int threadf)
number of threads allowed for simultaneous FDEval calls.
int COIDEF_DebugFV(coiHandle_t cntvect, int debugfv)
turn Debugging of FDEval on and off.
int COIDEF_ClearM(coiHandle_t cntvect, int clearm)
ClearM.
int COIDEF_FVforAll(coiHandle_t cntvect, int fvforall)
call the FDEval for all constraints, including linear constraints.
int COIDEF_ItLim(coiHandle_t cntvect, int itlim)
define the Iteration Limit.
int COIDEF_ThreadC(coiHandle_t cntvect, int threadc)
check for thread compatibility.
int COIDEF_MaxSup(coiHandle_t cntvect, int maxsup)
limit on superbasics.
int COIDEF_Thread2D(coiHandle_t cntvect, int thread2d)
number of threads allowed for simultaneous 2DDir calls.
int COIDEF_License(coiHandle_t cntvect, int licint1, int licint2, int licint3, const char *licstring)
define the License Information.
int COIDEF_OptDir(coiHandle_t cntvect, int optdir)
defines the Optimization Direction.
int COIDEF_ObjCon(coiHandle_t cntvect, int objcon)
defines the Objective Constraint.
int COIDEF_NumVar(coiHandle_t cntvect, int numvar)
defines the number of variables in the model.
int COIDEF_NumHess(coiHandle_t cntvect, int numhess)
defines the Number of Hessian Nonzeros.
int COIDEF_ObjVar(coiHandle_t cntvect, int objvar)
defines the Objective Variable.
int COIDEF_NumNlNz(coiHandle_t cntvect, int numnlnz)
defines the Number of Nonlinear Nonzeros.
int COIDEF_NumNz(coiHandle_t cntvect, int numnz)
defines the number of nonzero elements in the Jacobian.
int COIDEF_NumCon(coiHandle_t cntvect, int numcon)
defines the number of constraints in the model.
int COI_Free(coiHandle_t *cntvect)
frees the control vector.
void COI_Finalize(void)
finializes the solving process for CONOPT. This must be called when using OpenMP. It will terminate t...
int COI_Create(coiHandle_t *cntvect)
initializes CONOPT and creates the control vector.
double COIGET_MaxHeapUsed(coiHandle_t cntvect)
After a model has been solved this method will return the amount of heap memory used.
void COIGET_Version(int *major, int *minor, int *patch)
returns the version number. It can be used to ensure that the modeler is linked to the correct versio...
int COIGET_RangeErrors(coiHandle_t cntvect)
returns the range errors that were encountered.
int COIGET_MaxThreads(coiHandle_t cntvect)
returns the maximum number of threads that can be used by CONOPT.
int COI_Solve(coiHandle_t cntvect)
method for starting the solving process of CONOPT.
program square
Main program. A simple setup and call of CONOPT.
Definition square.f90:23