1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 Konrad-Zuse-Zentrum                            */
7 /*                            fuer Informationstechnik Berlin                */
8 /*                                                                           */
9 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
10 /*                                                                           */
11 /*  You should have received a copy of the ZIB Academic License              */
12 /*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   type_presol.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief  type definitions for presolvers
19  * @author Tobias Achterberg
20  */
21 
22 /** @defgroup DEFPLUGINS_PRESOL Default Presolvers
23  *  @ingroup DEFPLUGINS
24  *  @brief implementation files (.c files) of the default presolvers of SCIP
25  */
26 
27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
28 
29 #ifndef __SCIP_TYPE_PRESOL_H__
30 #define __SCIP_TYPE_PRESOL_H__
31 
32 #include "scip/def.h"
33 #include "scip/type_retcode.h"
34 #include "scip/type_result.h"
35 #include "scip/type_scip.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 typedef struct SCIP_Presol SCIP_PRESOL;           /**< presolver data structure */
42 typedef struct SCIP_PresolData SCIP_PRESOLDATA;   /**< presolver specific data */
43 
44 
45 /** copy method for presolver plugins (called when SCIP copies plugins)
46  *
47  *  input:
48  *  - scip            : SCIP main data structure
49  *  - presol          : the presolver itself
50  */
51 #define SCIP_DECL_PRESOLCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
52 
53 /** destructor of presolver to free user data (called when SCIP is exiting)
54  *
55  *  input:
56  *  - scip            : SCIP main data structure
57  *  - presol          : the presolver itself
58  */
59 #define SCIP_DECL_PRESOLFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
60 
61 /** initialization method of presolver (called after problem was transformed)
62  *
63  *  input:
64  *  - scip            : SCIP main data structure
65  *  - presol          : the presolver itself
66  */
67 #define SCIP_DECL_PRESOLINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
68 
69 /** deinitialization method of presolver (called before transformed problem is freed)
70  *
71  *  input:
72  *  - scip            : SCIP main data structure
73  *  - presol          : the presolver itself
74  */
75 #define SCIP_DECL_PRESOLEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
76 
77 /** presolving initialization method of presolver (called when presolving is about to begin)
78  *
79  *  This method is called when the presolving process is about to begin, even if presolving is turned off.
80  *  The presolver may use this call to initialize its data structures.
81  *
82  *  Necessary modifications that have to be performed even if presolving is turned off should be done here or in the
83  *  presolving deinitialization call (SCIP_DECL_PRESOLSEXITPRE()).
84  *
85  *  input:
86  *  - scip            : SCIP main data structure
87  *  - presol          : the presolver itself
88  */
89 #define SCIP_DECL_PRESOLINITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
90 
91 /** presolving deinitialization method of presolver (called after presolving has been finished)
92  *
93  *  This method is called after the presolving has been finished, even if presolving is turned off.
94  *  The presolver may use this call e.g. to clean up or modify its data structures.
95  *
96  *  Necessary modifications that have to be performed even if presolving is turned off should be done here or in the
97  *  presolving initialization call (SCIP_DECL_PRESOLINITPRE()).
98  *
99  *  Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the
100  *  problem has already been solved.  Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL,
101  *  SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
102  *
103  *  input:
104  *  - scip            : SCIP main data structure
105  *  - presol          : the presolver itself
106  */
107 #define SCIP_DECL_PRESOLEXITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol)
108 
109 /** execution method of presolver
110  *
111  *  The presolver should go through the variables and constraints and tighten the domains or
112  *  constraints. Each tightening should increase the given total numbers of changes.
113  *
114  *  input:
115  *  - scip            : SCIP main data structure
116  *  - presol          : the presolver itself
117  *  - nrounds         : number of presolving rounds already done
118  *  - presoltiming    : current presolving timing
119  *  - nnewfixedvars   : number of variables fixed since the last call to the presolver
120  *  - nnewaggrvars    : number of variables aggregated since the last call to the presolver
121  *  - nnewchgvartypes : number of variable type changes since the last call to the presolver
122  *  - nnewchgbds      : number of variable bounds tightened since the last call to the presolver
123  *  - nnewholes       : number of domain holes added since the last call to the presolver
124  *  - nnewdelconss    : number of deleted constraints since the last call to the presolver
125  *  - nnewaddconss    : number of added constraints since the last call to the presolver
126  *  - nnewupgdconss   : number of upgraded constraints since the last call to the presolver
127  *  - nnewchgcoefs    : number of changed coefficients since the last call to the presolver
128  *  - nnewchgsides    : number of changed left or right hand sides since the last call to the presolver
129  *
130  *  @note the counters state the changes since the last call including the changes of this presolver during its last
131  *        last call
132  *
133  *  @note if the presolver uses dual information it is nesassary to check via calling SCIPallowWeakDualReds and
134  *        SCIPallowStrongDualReds if dual reductions are allowed.
135  *
136  *  input/output:
137  *  - nfixedvars      : pointer to total number of variables fixed of all presolvers
138  *  - naggrvars       : pointer to total number of variables aggregated of all presolvers
139  *  - nchgvartypes    : pointer to total number of variable type changes of all presolvers
140  *  - nchgbds         : pointer to total number of variable bounds tightened of all presolvers
141  *  - naddholes       : pointer to total number of domain holes added of all presolvers
142  *  - ndelconss       : pointer to total number of deleted constraints of all presolvers
143  *  - naddconss       : pointer to total number of added constraints of all presolvers
144  *  - nupgdconss      : pointer to total number of upgraded constraints of all presolvers
145  *  - nchgcoefs       : pointer to total number of changed coefficients of all presolvers
146  *  - nchgsides       : pointer to total number of changed left/right hand sides of all presolvers
147  *
148  *  output:
149  *  - result          : pointer to store the result of the presolving call
150  *
151  *  possible return values for *result:
152  *  - SCIP_UNBOUNDED  : at least one variable is not bounded by any constraint in obj. direction -> problem is unbounded
153  *  - SCIP_CUTOFF     : at least one constraint is infeasible in the variable's bounds -> problem is infeasible
154  *  - SCIP_SUCCESS    : the presolver found a reduction
155  *  - SCIP_DIDNOTFIND : the presolver searched, but did not find a presolving change
156  *  - SCIP_DIDNOTRUN  : the presolver was skipped
157  */
158 #define SCIP_DECL_PRESOLEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_PRESOL* presol, int nrounds, SCIP_PRESOLTIMING presoltiming, \
159       int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \
160       int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \
161       int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \
162       int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result)
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif
169