GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
gcgheur.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
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-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file gcgheur.c
30 * @brief public methods for GCG heuristics
31 * @author Christian Puchert
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36#include "gcg/gcg.h"
37#include "gcg/pub_gcgheur.h"
38
39
40/** resets the parameters to their default value */
41static
43 SCIP* scip /**< SCIP data structure */
44 )
45{
46 assert(scip != NULL);
47
48 /* set specific parameters for LNS heuristics */
49 SCIP_CALL( SCIPresetParam(scip, "heuristics/gcgrens/nodesofs") );
50 SCIP_CALL( SCIPresetParam(scip, "heuristics/gcgrens/minfixingrate") );
51 SCIP_CALL( SCIPresetParam(scip, "heuristics/gcgrins/nodesofs") );
52 SCIP_CALL( SCIPresetParam(scip, "heuristics/gcgrins/minfixingrate") );
53 SCIP_CALL( SCIPresetParam(scip, "heuristics/xpcrossover/nodesofs") );
54 SCIP_CALL( SCIPresetParam(scip, "heuristics/xpcrossover/minfixingrate") );
55 SCIP_CALL( SCIPresetParam(scip, "heuristics/xprins/nodesofs") );
56 SCIP_CALL( SCIPresetParam(scip, "heuristics/xprins/minfixingrate") );
57
58 return SCIP_OKAY;
59}
60
61/** sets the parameters to aggressive values */
62static
64 SCIP* scip /**< SCIP data structure */
65 )
66{
67 assert(scip != NULL);
68
69 /* set specific parameters for GCG RENS heuristic, if the heuristic is included */
70#ifndef NDEBUG
71 if( SCIPfindHeur(scip, "gcgrens") != NULL )
72#endif
73 {
74 SCIP_CALL( SCIPsetLongintParam(scip, "heuristics/gcgrens/nodesofs", (SCIP_Longint)2000) );
75 SCIP_CALL( SCIPsetRealParam(scip, "heuristics/gcgrens/minfixingrate", 0.3) );
76 }
77
78 /* set specific parameters for GCG RINS heuristic, if the heuristic is included */
79#ifndef NDEBUG
80 if( SCIPfindHeur(scip, "gcgrins") != NULL )
81#endif
82 {
83 SCIP_CALL( SCIPsetIntParam(scip, "heuristics/gcgrins/nodesofs", 2000) );
84 SCIP_CALL( SCIPsetRealParam(scip, "heuristics/gcgrins/minfixingrate", 0.3) );
85 }
86
87 /* set specific parameters for XP Crossover heuristic, if the heuristic is included */
88#ifndef NDEBUG
89 if( SCIPfindHeur(scip, "xpcrossover") != NULL )
90#endif
91 {
92 SCIP_CALL( SCIPsetLongintParam(scip, "heuristics/xpcrossover/nodesofs", (SCIP_Longint)2000) );
93 SCIP_CALL( SCIPsetRealParam(scip, "heuristics/xpcrossover/minfixingrate", 0.3) );
94 }
95
96 /* set specific parameters for XP RINS heuristic, if the heuristic is included */
97#ifndef NDEBUG
98 if( SCIPfindHeur(scip, "xprins") != NULL )
99#endif
100 {
101 SCIP_CALL( SCIPsetLongintParam(scip, "heuristics/xprins/nodesofs", (SCIP_Longint)2000) );
102 SCIP_CALL( SCIPsetRealParam(scip, "heuristics/xprins/minfixingrate", 0.3) );
103 }
104
105 return SCIP_OKAY;
106}
107
108/** sets the parameters to fast values */
109static
111 SCIP* scip /**< SCIP data structure */
112 )
113{
114 char paramname[SCIP_MAXSTRLEN];
115 int i;
116
117#define NEXPENSIVEHEURS 11
118 static const char* const expensiveheurs[NEXPENSIVEHEURS] = {
119 "gcgcoefdiving",
120 "gcgfeaspump",
121 "gcgfracdiving",
122 "gcgguideddiving",
123 "gcglinesdiving",
124 "gcgpscostdiving",
125 "gcgrens",
126 "gcgrins",
127 "gcgveclendiving",
128 "xpcrossover",
129 "xprins"
130 };
131
132 assert(scip != NULL);
133
135
136 /* explicitly turn off expensive heuristics, if included */
137 for( i = 0; i < NEXPENSIVEHEURS; ++i )
138 {
139 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", expensiveheurs[i]);
140 SCIP_CALL( SCIPsetIntParam(scip, paramname, -1) );
141 }
142
143 return SCIP_OKAY;
144}
145
146/** sets heuristic parameters values to
147 *
148 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all heuristic parameters
149 * - SCIP_PARAMSETTING_FAST such that the time spend for heuristic is decreased
150 * - SCIP_PARAMSETTING_AGGRESSIVE such that the heuristic are called more aggregative
151 * - SCIP_PARAMSETTING_OFF which turns off all heuristics
152 */
154 GCG* gcg, /**< SCIP data structure */
155 SCIP_PARAMSETTING paramsetting /**< parameter settings */
156 )
157{
158 SCIP* origprob;
159 assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST
160 || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF);
161
163
164 switch( paramsetting )
165 {
168 break;
170 break;
173 break;
176 break;
177 default:
178 SCIPerrorMessage("The given paramsetting is invalid!\n");
179 break;
180 }
181
182 return SCIP_OKAY;
183}
#define SCIP_MAXSTRLEN
#define SCIP_Longint
GCG interface methods.
static SCIP_RETCODE setOrigHeuristicsDefault(SCIP *scip)
Definition gcgheur.c:42
static SCIP_RETCODE setOrigHeuristicsAggressive(SCIP *scip)
Definition gcgheur.c:63
#define NEXPENSIVEHEURS
static SCIP_RETCODE setOrigHeuristicsFast(SCIP *scip)
Definition gcgheur.c:110
SCIP * GCGgetOrigprob(GCG *gcg)
Definition gcg.cpp:87
SCIP_RETCODE GCGsetHeuristics(GCG *gcg, SCIP_PARAMSETTING paramsetting)
Definition gcgheur.c:153
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPresetParam(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
int SCIPsnprintf(char *t, int len, const char *s,...)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIP * origprob
int i
#define NULL
public methods for GCG heuristics
#define SCIPerrorMessage
struct Gcg GCG
Definition type_gcg.h:44
SCIP_PARAMSETTING_OFF
SCIP_PARAMSETTING_AGGRESSIVE
SCIP_PARAMSETTING_DEFAULT
SCIP_PARAMSETTING_FAST
enum SCIP_ParamSetting SCIP_PARAMSETTING
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP