Scippy

SCIP

Solving Constraint Integer Programs

pub_nlpi.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2024 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file pub_nlpi.h
26  * @ingroup PUBLICCOREAPI
27  * @brief public methods for NLP solver interfaces
28  * @author Thorsten Gellermann
29  * @author Stefan Vigerske
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #ifndef __SCIP_PUB_NLPI_H__
35 #define __SCIP_PUB_NLPI_H__
36 
37 #include "scip/def.h"
38 #include "scip/type_nlpi.h"
39 #include "scip/type_misc.h"
40 
41 #ifdef NDEBUG
42 #include "scip/struct_nlpi.h"
43 #endif
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**@addtogroup PublicNLPIInterfaceMethods
50  *
51  * @{
52  */
53 
54 /** compares two NLPIs w.r.t. their priority */
55 SCIP_DECL_SORTPTRCOMP(SCIPnlpiComp);
56 
57 /** gets data of an NLPI */
58 SCIP_EXPORT
60  SCIP_NLPI* nlpi /**< NLP interface structure */
61  );
62 
63 /** gets NLP solver name */
64 SCIP_EXPORT
65 const char* SCIPnlpiGetName(
66  SCIP_NLPI* nlpi /**< NLP interface structure */
67  );
68 
69 /** gets NLP solver description */
70 SCIP_EXPORT
71 const char* SCIPnlpiGetDesc(
72  SCIP_NLPI* nlpi /**< NLP interface structure */
73  );
74 
75 /** gets NLP solver priority */
76 SCIP_EXPORT
78  SCIP_NLPI* nlpi /**< NLP interface structure */
79  );
80 
81 /**@name Statistics */
82 /**@{ */
83 
84 /** gives number of problems created for NLP solver so far */
85 SCIP_EXPORT
87  SCIP_NLPI* nlpi /**< NLP interface structure */
88  );
89 
90 /** gives total time spend in problem creation/modification/freeing */
91 SCIP_EXPORT
93  SCIP_NLPI* nlpi /**< NLP interface structure */
94  );
95 
96 /** total number of NLP solves so far */
97 SCIP_EXPORT
99  SCIP_NLPI* nlpi /**< NLP interface structure */
100  );
101 
102 /** gives total time spend in NLP solves (as reported by solver) */
103 SCIP_EXPORT
105  SCIP_NLPI* nlpi /**< NLP interface structure */
106  );
107 
108 /** gives total time spend in function evaluation during NLP solves
109  *
110  * If parameter `timing/nlpieval` is off (the default), depending on the NLP solver, this may just return 0.
111  */
112 SCIP_EXPORT
114  SCIP_NLPI* nlpi /**< NLP interface structure */
115  );
116 
117 /** gives total number of iterations spend by NLP solver so far */
118 SCIP_EXPORT
120  SCIP_NLPI* nlpi /**< NLP interface structure */
121  );
122 
123 /** gives number of times a solve ended with a specific termination status */
124 SCIP_EXPORT
126  SCIP_NLPI* nlpi, /**< NLP interface structure */
127  SCIP_NLPTERMSTAT termstatus /**< the termination status to query for */
128  );
129 
130 /** gives number of times a solve ended with a specific solution status */
131 SCIP_EXPORT
133  SCIP_NLPI* nlpi, /**< NLP interface structure */
134  SCIP_NLPSOLSTAT solstatus /**< the solution status to query for */
135  );
136 
137 /** adds statistics from one NLPI to another */
138 SCIP_EXPORT
140  SCIP_NLPI* targetnlpi, /**< NLP interface where to add statistics */
141  SCIP_NLPI* sourcenlpi, /**< NLP interface from which to add statistics */
142  SCIP_Bool reset /**< whether to reset statistics in sourcescip */
143  );
144 
145 #ifdef NDEBUG
146 /* If NDEBUG is defined, the function calls are overwritten by defines to reduce the number of function calls and
147  * speed up the algorithms.
148  */
149 #define SCIPnlpiGetData(nlpi) (nlpi)->nlpidata
150 #define SCIPnlpiGetName(nlpi) (nlpi)->name
151 #define SCIPnlpiGetDesc(nlpi) (nlpi)->description
152 #define SCIPnlpiGetPriority(nlpi) (nlpi)->priority
153 #define SCIPnlpiGetNProblems(nlpi) (nlpi)->nproblems
154 #define SCIPnlpiGetProblemTime(nlpi) SCIPclockGetTime((nlpi)->problemtime)
155 #define SCIPnlpiGetNSolves(nlpi) (nlpi)->nsolves
156 #define SCIPnlpiGetSolveTime(nlpi) (nlpi)->solvetime
157 #define SCIPnlpiGetEvalTime(nlpi) (nlpi)->evaltime
158 #define SCIPnlpiGetNIterations(nlpi) (nlpi)->niter
159 #define SCIPnlpiGetNTermStat(nlpi, termstatus) (nlpi)->ntermstat[termstatus]
160 #define SCIPnlpiGetNSolStat(nlpi, solstatus) (nlpi)->nsolstat[solstatus]
161 #endif
162 
163 /**@} */ /* Statistics */
164 
165 /**@} */ /* PublicNLPIMethods */
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* __SCIP_PUB_NLPI_H__ */
int SCIPnlpiGetPriority(SCIP_NLPI *nlpi)
Definition: nlpi.c:742
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
Definition: type_nlpi.h:194
SCIP_Real SCIPnlpiGetProblemTime(SCIP_NLPI *nlpi)
Definition: nlpi.c:765
SCIP_NLPIDATA * SCIPnlpiGetData(SCIP_NLPI *nlpi)
Definition: nlpi.c:712
int SCIPnlpiGetNSolves(SCIP_NLPI *nlpi)
Definition: nlpi.c:774
type definitions for miscellaneous datastructures
data definitions for an NLP solver interface
int SCIPnlpiGetNProblems(SCIP_NLPI *nlpi)
Definition: nlpi.c:756
void SCIPnlpiMergeStatistics(SCIP_NLPI *targetnlpi, SCIP_NLPI *sourcenlpi, SCIP_Bool reset)
Definition: nlpi.c:833
const char * SCIPnlpiGetName(SCIP_NLPI *nlpi)
Definition: nlpi.c:722
const char * SCIPnlpiGetDesc(SCIP_NLPI *nlpi)
Definition: nlpi.c:732
int SCIPnlpiGetNSolStat(SCIP_NLPI *nlpi, SCIP_NLPSOLSTAT solstatus)
Definition: nlpi.c:823
SCIP_Real SCIPnlpiGetEvalTime(SCIP_NLPI *nlpi)
Definition: nlpi.c:795
SCIP_Real SCIPnlpiGetSolveTime(SCIP_NLPI *nlpi)
Definition: nlpi.c:783
SCIP_DECL_SORTPTRCOMP(SCIPnlpiComp)
Definition: nlpi.c:47
struct SCIP_NlpiData SCIP_NLPIDATA
Definition: type_nlpi.h:52
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
Definition: type_nlpi.h:168
SCIP_Longint SCIPnlpiGetNIterations(SCIP_NLPI *nlpi)
Definition: nlpi.c:804
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:173
#define SCIP_Longint
Definition: def.h:158
int SCIPnlpiGetNTermStat(SCIP_NLPI *nlpi, SCIP_NLPTERMSTAT termstatus)
Definition: nlpi.c:813
common defines and data types used in all packages of SCIP
type definitions for NLP solver interfaces