Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcgsepa.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file gcgsepa.c
29  * @brief public methods for GCG separators
30  * @author Christian Puchert
31  * @author Jonas Witt
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #include "gcg.h"
37 #include "pub_gcgsepa.h"
38 
39 
40 /** resets the parameters to disable separators */
41 static
42 SCIP_RETCODE setSeparatorsOff(
43  SCIP* scip /**< SCIP data structure */
44  )
45 {
46  assert(scip != NULL);
47 
48  /* set specific parameters for GCG basis separator, if the separator is included */
49 #ifndef NDEBUG
50  if( SCIPfindSepa(GCGgetMasterprob(scip), "basis") != NULL )
51 #endif
52  {
53  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/basis/enable", FALSE) );
54  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/enable = FALSE\n");
55  }
56 
57  /* set specific parameters for GCG master separator, if the separator is included */
58 #ifndef NDEBUG
59  if( SCIPfindSepa(GCGgetMasterprob(scip), "master") != NULL )
60 #endif
61  {
62  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/master/enable", FALSE) );
63  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/enable = FALSE\n");
64  }
65 
66  return SCIP_OKAY;
67 }
68 
69 /** resets the parameters to their default value */
70 static
71 SCIP_RETCODE setSeparatorsDefault(
72  SCIP* scip /**< SCIP data structure */
73  )
74 {
75  assert(scip != NULL);
76 
77  /* set specific parameters for GCG basis separator, if the separator is included */
78 #ifndef NDEBUG
79  if( SCIPfindSepa(GCGgetMasterprob(scip), "basis") != NULL )
80 #endif
81  {
82  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/basis/enable", TRUE) );
83  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/enable = TRUE\n");
84 
85  SCIP_CALL( SCIPsetIntParam(scip, "sepa/basis/paramsetting", 0) );
86  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/paramsetting = %d\n", 0);
87  }
88 
89  /* set specific parameters for GCG master separator, if the separator is included */
90 #ifndef NDEBUG
91  if( SCIPfindSepa(GCGgetMasterprob(scip), "master") != NULL )
92 #endif
93  {
94  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/master/enable", TRUE) );
95  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/enable = TRUE\n");
96 
97  SCIP_CALL( SCIPsetIntParam(scip, "sepa/master/paramsetting", 0) );
98  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/paramsetting = %d\n", 0);
99  }
100 
101  return SCIP_OKAY;
102 }
103 
104 /** sets the parameters to aggressive values */
105 static
107  SCIP* scip /**< SCIP data structure */
108  )
109 {
110  assert(scip != NULL);
111 
112  /* set specific parameters for GCG basis separator, if the separator is included */
113 #ifndef NDEBUG
114  if( SCIPfindSepa(GCGgetMasterprob(scip), "basis") != NULL )
115 #endif
116  {
117  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/basis/enable", TRUE) );
118  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/enable = TRUE\n");
119 
120  SCIP_CALL( SCIPsetIntParam(scip, "sepa/basis/paramsetting", 1) );
121  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/paramsetting = %d\n", 1);
122  }
123 
124  /* set specific parameters for GCG master separator, if the separator is included */
125 #ifndef NDEBUG
126  if( SCIPfindSepa(GCGgetMasterprob(scip), "master") != NULL )
127 #endif
128  {
129  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/master/enable", TRUE) );
130  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/enable = TRUE\n");
131 
132  SCIP_CALL( SCIPsetIntParam(scip, "sepa/master/paramsetting", 1) );
133  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/paramsetting = %d\n", 1);
134  }
135 
136  return SCIP_OKAY;
137 }
138 
139 /** sets the parameters to fast values */
140 static
141 SCIP_RETCODE setSeparatorsFast(
142  SCIP* scip /**< SCIP data structure */
143  )
144 {
145  /* set specific parameters for GCG basis separator, if the separator is included */
146 #ifndef NDEBUG
147  if( SCIPfindSepa(GCGgetMasterprob(scip), "basis") != NULL )
148 #endif
149  {
150  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/basis/enable", TRUE) );
151  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/enable = TRUE\n");
152 
153  SCIP_CALL( SCIPsetIntParam(scip, "sepa/basis/paramsetting", 2) );
154  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/basis/paramsetting = %d\n", 2);
155  }
156 
157  /* set specific parameters for GCG master separator, if the separator is included */
158 #ifndef NDEBUG
159  if( SCIPfindSepa(GCGgetMasterprob(scip), "master") != NULL )
160 #endif
161  {
162  SCIP_CALL( SCIPsetBoolParam(scip, "sepa/master/enable", TRUE) );
163  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/enable = TRUE\n");
164 
165  SCIP_CALL( SCIPsetIntParam(scip, "sepa/master/paramsetting", 2) );
166  SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "sepa/master/paramsetting = %d\n", 2);
167  }
168 
169  return SCIP_OKAY;
170 }
171 
172 /** sets separator parameters values to
173  *
174  * - SCIP_PARAMSETTING_DEFAULT which are the default values of all separator parameters
175  * - SCIP_PARAMSETTING_FAST such that the time spend for separator is decreased
176  * - SCIP_PARAMSETTING_AGGRESSIVE such that the separator are called more aggregative
177  * - SCIP_PARAMSETTING_OFF which turns off all separators
178  */
179 SCIP_RETCODE GCGsetSeparators(
180  SCIP* scip, /**< SCIP data structure */
181  SCIP_PARAMSETTING paramsetting /**< parameter settings */
182  )
183 {
184  assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST
185  || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF);
186 
187  switch( paramsetting )
188  {
189  case SCIP_PARAMSETTING_AGGRESSIVE:
190  SCIP_CALL( setSeparatorsAggressive(scip) );
191  break;
192  case SCIP_PARAMSETTING_OFF:
193  SCIP_CALL(setSeparatorsOff(scip));
194  break;
195  case SCIP_PARAMSETTING_FAST:
196  SCIP_CALL( setSeparatorsFast(scip) );
197  break;
198  case SCIP_PARAMSETTING_DEFAULT:
199  SCIP_CALL( setSeparatorsDefault(scip) );
200  break;
201  default:
202  SCIPerrorMessage("The given paramsetting is invalid!\n");
203  break;
204  }
205 
206  return SCIP_OKAY;
207 }
static SCIP_RETCODE setSeparatorsAggressive(SCIP *scip)
Definition: gcgsepa.c:106
GCG interface methods.
static SCIP_RETCODE setSeparatorsFast(SCIP *scip)
Definition: gcgsepa.c:141
public methods for GCG separators
static SCIP_RETCODE setSeparatorsDefault(SCIP *scip)
Definition: gcgsepa.c:71
SCIP * GCGgetMasterprob(SCIP *scip)
Definition: relax_gcg.c:3920
SCIP_RETCODE GCGsetSeparators(SCIP *scip, SCIP_PARAMSETTING paramsetting)
Definition: gcgsepa.c:179
static SCIP_RETCODE setSeparatorsOff(SCIP *scip)
Definition: gcgsepa.c:42