Scippy

SCIP

Solving Constraint Integer Programs

redcosts.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-2022 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 scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file redcosts.h
17  * @brief Reduced cost based routines for Steiner problems
18  * @author Daniel Rehfeldt
19  *
20  * Reduced costs are stored level-wise
21  *
22  */
23 
24 
25 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
26 
27 #ifndef APPLICATIONS_STP_SRC_REDCOSTS_H_
28 #define APPLICATIONS_STP_SRC_REDCOSTS_H_
29 
30 #include "scip/scip.h"
31 #include "graphdefs.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** reduced cost data */
38 typedef struct reduce_costs_data REDCOST;
39 
40 
41 /** parameters */
43 {
44  SCIP_Real cutoff; /**< FOR FIRST LEVEL: reduced cost cutoff value or -1.0 if not used */
45  int nLevels; /**< number of of levels */
46  int nCloseTerms; /**< number of close terminals: 1, 2, or 3 */
47  int nnodes; /**< number of nodes */
48  int nedges; /**< number of edges */
49  int redCostRoot; /**< FOR FIRST LEVEL: graph root for reduced cost calculation */
50 } RCPARAMS;
51 
52 
53 
54 /** returns number of nodes for which reduced costs are stored */
55 SCIP_EXPORT
57  const REDCOST* redcostdata /**< reduced costs data */
58  );
59 
60 
61 /** returns number of edges for which reduced costs are stored */
62 SCIP_EXPORT
64  const REDCOST* redcostdata /**< reduced costs data */
65  );
66 
67 
68 /** returns reduced costs */
69 SCIP_EXPORT
71  const REDCOST* redcostdata, /**< reduced costs data */
72  int level /**< level to get reduced costs for */
73  );
74 
75 /** returns top level reduced costs */
76 SCIP_EXPORT
78  const REDCOST* redcostdata /**< reduced costs data */
79  );
80 
81 
82 /** returns root to node distances */
83 SCIP_EXPORT
85  const REDCOST* redcostdata, /**< reduced costs data */
86  int level /**< level to get distances for */
87  );
88 
89 /** returns root to node distances for top level */
90 SCIP_EXPORT
92  const REDCOST* redcostdata /**< reduced costs data */
93  );
94 
95 
96 /** returns paths from nodes to closes terms */
97 SCIP_EXPORT
99  const REDCOST* redcostdata, /**< reduced costs data */
100  int level /**< level to get reduced costs for */
101  );
102 
103 
104 /** returns paths from nodes to closes terms for top level */
105 SCIP_EXPORT
107  const REDCOST* redcostdata /**< reduced costs data */
108  );
109 
110 
111 /** returns closest terminals to nodes */
113  const REDCOST* redcostdata, /**< reduced costs data */
114  int level /**< level to get terminals for */
115  );
116 
117 
118 /** returns closest terms to nodes for top level */
119 SCIP_EXPORT
121  const REDCOST* redcostdata /**< reduced costs data */
122  );
123 
124 
125 /** returns cutoff */
126 SCIP_EXPORT
128  const REDCOST* redcostdata, /**< reduced costs data */
129  int level /**< level to get cutoff for */
130  );
131 
132 
133 /** returns cutoff for top level */
134 SCIP_EXPORT
136  const REDCOST* redcostdata /**< reduced costs data */
137  );
138 
139 
140 /** returns dual-bound */
141 SCIP_EXPORT
143  int level, /**< level */
144  const REDCOST* redcostdata /**< reduced costs data */
145  );
146 
147 /** returns dual-bound for top level*/
148 SCIP_EXPORT
150  const REDCOST* redcostdata /**< reduced costs data */
151  );
152 
153 
154 /** returns root used for reduced cost computation */
155 int redcosts_getRoot(
156  const REDCOST* redcostdata, /**< reduced costs data */
157  int level /**< level to get root for */
158  );
159 
160 
161 /** returns root used for reduced cost computation for top level */
162 SCIP_EXPORT
164  const REDCOST* redcostdata /**< reduced costs data */
165  );
166 
167 
168 /** returns current (top) level; 0-indexed */
169 SCIP_EXPORT
171  const REDCOST* redcostdata /**< reduced costs data */
172  );
173 
174 
175 /** returns current number of levels */
177  const REDCOST* redcostdata /**< reduced costs data */
178  );
179 
180 /** sets cutoff */
181 SCIP_EXPORT
182 void redcosts_setCutoff(
183  SCIP_Real cutoff, /**< the value */
184  int level, /**< level to set cutoff for */
185  REDCOST* redcostdata /**< reduced costs data */
186  );
187 
188 
189 /** sets cutoff for top level */
190 SCIP_EXPORT
192  SCIP_Real cutoff, /**< the value */
193  REDCOST* redcostdata /**< reduced costs data */
194  );
195 
196 
197 
198 /** sets dual-bound */
199 SCIP_EXPORT
201  SCIP_Real dualbound, /**< the value */
202  int level, /**< level to set dual bound for */
203  REDCOST* redcostdata /**< reduced costs data */
204  );
205 
206 
207 /** sets dual-bound for top level */
208 SCIP_EXPORT
210  SCIP_Real dualbound, /**< the value */
211  REDCOST* redcostdata /**< reduced costs data */
212  );
213 
214 
215 /** sets root used for reduced cost computation */
216 SCIP_EXPORT
217 void redcosts_setRoot(
218  int root, /**< the root */
219  int level, /**< level to set dual bound for */
220  REDCOST* redcostdata /**< reduced costs data */
221  );
222 
223 
224 /** sets root used for reduced cost computation for top level */
225 SCIP_EXPORT
227  int root, /**< the root */
228  REDCOST* redcostdata /**< reduced costs data */
229  );
230 
231 
232 /** adds a new level */
233 SCIP_EXPORT
234 void redcosts_addLevel(
235  REDCOST* redcostdata /**< reduced costs data */
236  );
237 
238 
239 /** initializes reduced costs data structure from given parameter struct */
240 SCIP_EXPORT
242  SCIP* scip, /**< SCIP */
243  const RCPARAMS* parameters, /**< parameters for initialization */
244  REDCOST** redcostdata /**< data to initialize */
245 );
246 
247 /** initializes reduced costs data structure.
248  * DEPRECATED! Use redcosts_initFromParams */
249 SCIP_EXPORT
251  SCIP* scip, /**< SCIP */
252  int nnodes, /**< number of nodes */
253  int nedges, /**< number of edges */
254  SCIP_Real cutoff, /**< reduced cost cutoff value or -1.0 if not used */
255  int redCostRoot, /**< graph root for reduced cost calculation */
256  REDCOST** redcostdata /**< reduced costs data */
257  );
258 
259 
260 /** frees */
261 SCIP_EXPORT
262 void redcosts_free(
263  SCIP* scip, /**< SCIP */
264  REDCOST** redcostdata /**< data to free */
265 );
266 
267 
268 /** sets cutoff for top level */
269 SCIP_EXPORT
271  SCIP_Real upperbound, /**< bound */
272  REDCOST* redcostdata, /**< reduced cost data */
273  SCIP_Real* cutoffbound /**< cutoff */
274 );
275 
276 
277 /** sets cutoff */
278 SCIP_EXPORT
280  SCIP_Real upperbound, /**< bound */
281  int level, /**< level */
282  REDCOST* redcostdata /**< reduced cost data */
283 );
284 
285 
286 /** sets cutoff for top level */
287 SCIP_EXPORT
289  SCIP_Real upperbound, /**< bound */
290  REDCOST* redcostdata /**< reduced cost data */
291 );
292 
293 
294 
295 /** increases reduced cost for deleted arcs */
296 SCIP_EXPORT
298  const GRAPH* graph, /**< graph */
299  const STP_Bool* arcsdeleted, /**< array to mark deleted arcs */
300  int level, /**< the level */
301  REDCOST* redcostdata /**< reduced cost data */
302 );
303 
304 
305 /** unifies costs */
306 SCIP_EXPORT
308  const GRAPH* graph, /**< graph */
309  int level, /**< the level */
310  REDCOST* redcostdata /**< reduced cost data */
311 );
312 
313 
314 /** increases reduced cost for deleted arcs for top level */
315 SCIP_EXPORT
317  const GRAPH* graph, /**< graph */
318  const STP_Bool* arcsdeleted, /**< array to mark deleted arcs */
319  REDCOST* redcostdata /**< reduced cost data */
320 );
321 
322 
323 /* initialize distances from reduced costs */
324 SCIP_EXPORT
326  SCIP* scip, /**< SCIP */
327  int level, /**< level to inizialize for*/
328  GRAPH* g, /**< graph data structure */
329  REDCOST* redcostdata /**< reduced cost data */
330  );
331 
332 
333 /* initialize top distances from reduced costs */
334 SCIP_EXPORT
336  SCIP* scip, /**< SCIP */
337  GRAPH* g, /**< graph data structure */
338  REDCOST* redcostdata /**< reduced cost data */
339  );
340 
341 
342 /** reduced costs available? */
343 SCIP_EXPORT
345  SCIP* scip /**< SCIP structure */
346  );
347 
348 
349 /** are reduced costs reliable? */
350 SCIP_EXPORT
352  SCIP* scip, /**< SCIP structure */
353  SCIP_VAR** vars, /**< variables (in) */
354  const GRAPH* graph /**< graph data */
355  );
356 
357 /** initialize reduced costs */
358 SCIP_EXPORT
359 void redcosts_forLPget(
360  SCIP* scip, /**< SCIP structure */
361  SCIP_VAR** vars, /**< variables */
362  const GRAPH* graph, /**< graph data */
363  SCIP_Real* redcosts /**< reduced costs */
364  );
365 
366 
367 
368 #ifdef __cplusplus
369 }
370 #endif
371 
372 #endif /* APPLICATIONS_STP_SRC_REDCOSTS_H_ */
struct reduced_costs_parameters RCPARAMS
void redcosts_increaseOnDeletedArcsTop(const GRAPH *graph, const STP_Bool *arcsdeleted, REDCOST *redcostdata)
Definition: redcosts.c:728
SCIP_Real redcosts_getCutoffTop(const REDCOST *redcostdata)
Definition: redcosts.c:300
void redcosts_increaseOnDeletedArcs(const GRAPH *graph, const STP_Bool *arcsdeleted, int level, REDCOST *redcostdata)
Definition: redcosts.c:682
int redcosts_getRoot(const REDCOST *redcostdata, int level)
Definition: redcosts.c:335
void redcosts_setAndReturnCutoffFromBoundTop(SCIP_Real upperbound, REDCOST *redcostdata, SCIP_Real *cutoffbound)
Definition: redcosts.c:624
void redcosts_addLevel(REDCOST *redcostdata)
Definition: redcosts.c:460
void redcosts_setDualBound(SCIP_Real dualbound, int level, REDCOST *redcostdata)
Definition: redcosts.c:406
void redcosts_free(SCIP *scip, REDCOST **redcostdata)
Definition: redcosts.c:743
int redcosts_getNlevels(const REDCOST *redcostdata)
Definition: redcosts.c:369
SCIP_Real * redcosts_getRootToNodeDist(const REDCOST *redcostdata, int level)
Definition: redcosts.c:213
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
int redcosts_getRootTop(const REDCOST *redcostdata)
Definition: redcosts.c:347
SCIP_RETCODE redcosts_initializeDistancesTop(SCIP *scip, GRAPH *g, REDCOST *redcostdata)
Definition: redcosts.c:573
int * redcosts_getNodeToTermsBases(const REDCOST *redcostdata, int level)
Definition: redcosts.c:264
SCIP_Real * redcosts_getEdgeCosts(const REDCOST *redcostdata, int level)
Definition: redcosts.c:187
int redcosts_getNnodes(const REDCOST *redcostdata)
Definition: redcosts.c:165
void redcosts_setCutoffFromBoundTop(SCIP_Real upperbound, REDCOST *redcostdata)
Definition: redcosts.c:670
SCIP_Real redcosts_getDualBoundTop(const REDCOST *redcostdata)
Definition: redcosts.c:324
int redcosts_getNedges(const REDCOST *redcostdata)
Definition: redcosts.c:176
SCIP_Real redcosts_getCutoff(const REDCOST *redcostdata, int level)
Definition: redcosts.c:288
SCIP_Real * redcosts_getEdgeCostsTop(const REDCOST *redcostdata)
Definition: redcosts.c:202
SCIP_RETCODE redcosts_initializeDistances(SCIP *scip, int level, GRAPH *g, REDCOST *redcostdata)
Definition: redcosts.c:473
unsigned char STP_Bool
Definition: portab.h:34
#define SCIP_Bool
Definition: def.h:84
SCIP_RETCODE redcosts_init(SCIP *scip, int nnodes, int nedges, SCIP_Real cutoff, int redCostRoot, REDCOST **redcostdata)
Definition: redcosts.c:605
includes graph definitions used for Steiner tree problems
void redcosts_setRoot(int root, int level, REDCOST *redcostdata)
Definition: redcosts.c:433
int * redcosts_getNodeToTermsBasesTop(const REDCOST *redcostdata)
Definition: redcosts.c:277
PATH * redcosts_getNodeToTermsPathsTop(const REDCOST *redcostdata)
Definition: redcosts.c:253
int redcosts_getLevel(const REDCOST *redcostdata)
Definition: redcosts.c:358
SCIP_Bool redcosts_forLPareAvailable(SCIP *scip)
Definition: redcosts.c:767
void redcosts_setCutoffFromBound(SCIP_Real upperbound, int level, REDCOST *redcostdata)
Definition: redcosts.c:645
void redcosts_unifyBlockedEdgeCosts(const GRAPH *graph, int level, REDCOST *redcostdata)
Definition: redcosts.c:705
SCIP_Bool redcosts_forLPareReliable(SCIP *scip, SCIP_VAR **vars, const GRAPH *graph)
Definition: redcosts.c:814
SCIP_Real redcosts_getDualBound(int level, const REDCOST *redcostdata)
Definition: redcosts.c:311
void redcosts_setCutoffTop(SCIP_Real cutoff, REDCOST *redcostdata)
Definition: redcosts.c:394
SCIP_Real * redcosts_getRootToNodeDistTop(const REDCOST *redcostdata)
Definition: redcosts.c:228
void redcosts_setDualBoundTop(SCIP_Real dualbound, REDCOST *redcostdata)
Definition: redcosts.c:420
PATH * redcosts_getNodeToTermsPaths(const REDCOST *redcostdata, int level)
Definition: redcosts.c:240
#define SCIP_Real
Definition: def.h:177
void redcosts_setCutoff(SCIP_Real cutoff, int level, REDCOST *redcostdata)
Definition: redcosts.c:380
void redcosts_setRootTop(int root, REDCOST *redcostdata)
Definition: redcosts.c:447
void redcosts_forLPget(SCIP *scip, SCIP_VAR **vars, const GRAPH *graph, SCIP_Real *redcosts)
Definition: redcosts.c:861
SCIP_RETCODE redcosts_initFromParams(SCIP *scip, const RCPARAMS *parameters, REDCOST **redcostdata)
Definition: redcosts.c:590
SCIP callable library.