Scippy

SCIP

Solving Constraint Integer Programs

relax.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 relax.h
26 * @ingroup INTERNALAPI
27 * @brief internal methods for relaxators
28 * @author Tobias Achterberg
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_RELAX_H__
34#define __SCIP_RELAX_H__
35
36
37#include "scip/def.h"
39#include "scip/type_primal.h"
40#include "scip/type_relax.h"
41#include "scip/type_result.h"
42#include "scip/type_retcode.h"
43#include "scip/type_set.h"
44#include "scip/type_sol.h"
45#include "scip/type_stat.h"
46#include "scip/type_tree.h"
47#include "scip/type_var.h"
48#include "scip/pub_relax.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/** copies the given relaxator to a new scip */
56 SCIP_RELAX* relax, /**< relaxator */
57 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
58 );
59
60/** creates a relaxator */
62 SCIP_RELAX** relax, /**< pointer to relaxator data structure */
63 SCIP_SET* set, /**< global SCIP settings */
64 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
65 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
66 const char* name, /**< name of relaxator */
67 const char* desc, /**< description of relaxator */
68 int priority, /**< priority of the relaxator (negative: after LP, non-negative: before LP) */
69 int freq, /**< frequency for calling relaxator */
70 SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxator or NULL if you don't want to copy your plugin into sub-SCIPs */
71 SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxator */
72 SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxator */
73 SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxator */
74 SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxator */
75 SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxator */
76 SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxator */
77 SCIP_RELAXDATA* relaxdata /**< relaxator data */
78 );
79
80/** calls destructor and frees memory of relaxator */
82 SCIP_RELAX** relax, /**< pointer to relaxator data structure */
83 SCIP_SET* set /**< global SCIP settings */
84 );
85
86/** initializes relaxator */
88 SCIP_RELAX* relax, /**< relaxator */
89 SCIP_SET* set /**< global SCIP settings */
90 );
91
92/** calls exit method of relaxator */
94 SCIP_RELAX* relax, /**< relaxator */
95 SCIP_SET* set /**< global SCIP settings */
96 );
97
98/** informs relaxator that the branch and bound process is being started */
100 SCIP_RELAX* relax, /**< relaxator */
101 SCIP_SET* set /**< global SCIP settings */
102 );
103
104/** informs relaxator that the branch and bound process data is being freed */
106 SCIP_RELAX* relax, /**< relaxator */
107 SCIP_SET* set /**< global SCIP settings */
108 );
109
110/** calls execution method of relaxator */
112 SCIP_RELAX* relax, /**< relaxator */
113 SCIP_SET* set, /**< global SCIP settings */
114 SCIP_TREE* tree, /**< branch and bound tree */
115 SCIP_STAT* stat, /**< dynamic problem statistics */
116 int depth, /**< depth of current node */
117 SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
118 SCIP_RESULT* result /**< pointer to store the result of the callback method */
119 );
120
121/** sets priority of relaxator */
123 SCIP_RELAX* relax, /**< relaxator */
124 SCIP_SET* set, /**< global SCIP settings */
125 int priority /**< new priority of the relaxator */
126 );
127
128/** set copy callback of relaxation handler */
130 SCIP_RELAX* relax, /**< relaxation handler */
131 SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
132 );
133
134/** set destructor callback of relaxation handler */
136 SCIP_RELAX* relax, /**< relaxation handler */
137 SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
138 );
139
140/** set initialization callback of relaxation handler */
142 SCIP_RELAX* relax, /**< relaxation handler */
143 SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
144 );
145
146/** set deinitialization callback of relaxation handler */
148 SCIP_RELAX* relax, /**< relaxation handler */
149 SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
150 );
151
152/** set solving process initialization callback of relaxation handler */
154 SCIP_RELAX* relax, /**< relaxation handler */
155 SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
156 );
157
158/** set solving process deinitialization callback of relaxation handler */
160 SCIP_RELAX* relax, /**< relaxation handler */
161 SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
162 );
163
164/** returns whether the relaxation was completely solved at the current node */
166 SCIP_RELAX* relax, /**< relaxator */
167 SCIP_STAT* stat /**< dynamic problem statistics */
168 );
169
170/*
171 * methods for the global relaxation data
172 */
173
174/** enables or disables all clocks of \p relax, depending on the value of the flag */
176 SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
177 SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
178 );
179
180/** creates global relaxation data */
182 SCIP_RELAXATION** relaxation, /**< global relaxation data */
183 BMS_BLKMEM* blkmem, /**< block memory */
184 SCIP_SET* set, /**< global SCIP settings */
185 SCIP_STAT* stat, /**< problem statistics data */
186 SCIP_PRIMAL* primal, /**< primal data */
187 SCIP_TREE* tree /**< branch and bound tree */
188 );
189
190/** frees global relaxation data */
192 SCIP_RELAXATION** relaxation /**< global relaxation data */
193 );
194
195/** sets the relaxsolzero flag in the relaxation data to the given value */
197 SCIP_RELAXATION* relaxation, /**< global relaxation data */
198 SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
199 );
200
201/** returns whether the global relaxation solution is cleared and all values are set to zero */
203 SCIP_RELAXATION* relaxation /**< global relaxation data */
204 );
205
206/** sets the relaxsolvalid and includeslp flags in the relaxation data to the given values */
208 SCIP_RELAXATION* relaxation, /**< global relaxation data */
209 SCIP_Bool isvalid, /**< is the stored solution valid? */
210 SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */
211 );
212
213/** returns whether the global relaxation solution is valid */
215 SCIP_RELAXATION* relaxation /**< global relaxation data */
216 );
217
218/** returns whether the global relaxation solution was computed by a relaxator which included all LP cuts */
220 SCIP_RELAXATION* relaxation /**< global relaxation data */
221 );
222
223/** sets the objective value of the global relaxation solution */
225 SCIP_RELAXATION* relaxation, /**< global relaxation data */
226 SCIP_Real obj /**< objective value */
227 );
228
229/** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
231 SCIP_RELAXATION* relaxation /**< global relaxation data */
232 );
233
234/** adds the given value to the global relaxation solution's objective value */
236 SCIP_RELAXATION* relaxation, /**< global relaxation data */
237 SCIP_Real val /**< value to add to the objective value */
238 );
239
240/** updates objective value of current relaxation solution after change of objective coefficient */
242 SCIP_RELAXATION* relaxation, /**< global relaxation data */
243 SCIP_SET* set, /**< global SCIP settings */
244 SCIP_VAR* var, /**< variable with changed objective coefficient */
245 SCIP_Real oldobj, /**< old objective coefficient */
246 SCIP_Real newobj /**< new objective coefficient */
247 );
248
249/** store the most recent relaxation handler \p relax responsible for the solution */
251 SCIP_RELAXATION* relaxation, /**< global relaxation data */
252 SCIP_RELAX* relax /**< relaxation handler responsible for the most recent relaxation solution */
253 );
254
255/** returns the most recent relaxation handler responsible for the solution, or NULL if unspecified */
257 SCIP_RELAXATION* relaxation /**< global relaxation data */
258 );
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:172
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
public methods for relaxation handlers
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:531
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:520
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:231
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:785
SCIP_RETCODE SCIPrelaxCreate(SCIP_RELAX **relax, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_DECL_RELAXCOPY((*relaxcopy)), SCIP_DECL_RELAXFREE((*relaxfree)), SCIP_DECL_RELAXINIT((*relaxinit)), SCIP_DECL_RELAXEXIT((*relaxexit)), SCIP_DECL_RELAXINITSOL((*relaxinitsol)), SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), SCIP_DECL_RELAXEXEC((*relaxexec)), SCIP_RELAXDATA *relaxdata)
Definition: relax.c:172
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:774
SCIP_RETCODE SCIPrelaxExit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:275
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:860
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid, SCIP_Bool includeslp)
Definition: relax.c:795
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:498
void SCIPrelaxSetExit(SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
Definition: relax.c:509
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:204
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:828
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:487
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:839
void SCIPrelaxSetCopy(SCIP_RELAX *relax, SCIP_DECL_RELAXCOPY((*relaxcopy)))
Definition: relax.c:476
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:849
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:83
void SCIPrelaxationSetSolRelax(SCIP_RELAXATION *relaxation, SCIP_RELAX *relax)
Definition: relax.c:880
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:708
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:762
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:606
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:734
SCIP_RELAX * SCIPrelaxationGetSolRelax(SCIP_RELAXATION *relaxation)
Definition: relax.c:891
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:305
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_TREE *tree, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:353
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:572
SCIP_Bool SCIPrelaxationIsLpIncludedForSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:818
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:808
SCIP_RETCODE SCIPrelaxExitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:329
Definition: heur_padm.c:135
type definitions for collecting primal CIP solutions and primal informations
type definitions for relaxators
#define SCIP_DECL_RELAXINIT(x)
Definition: type_relax.h:72
#define SCIP_DECL_RELAXEXITSOL(x)
Definition: type_relax.h:102
#define SCIP_DECL_RELAXFREE(x)
Definition: type_relax.h:64
#define SCIP_DECL_RELAXINITSOL(x)
Definition: type_relax.h:91
#define SCIP_DECL_RELAXCOPY(x)
Definition: type_relax.h:56
#define SCIP_DECL_RELAXEXEC(x)
Definition: type_relax.h:127
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:80
struct SCIP_RelaxData SCIP_RELAXDATA
Definition: type_relax.h:47
result codes for SCIP callback methods
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:61
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for global SCIP settings
type definitions for storing primal CIP solutions
type definitions for problem statistics
type definitions for branch and bound tree
type definitions for problem variables