Scippy

SCIP

Solving Constraint Integer Programs

solpool.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 solpool.h
17  * @brief includes solution pool for Steiner tree problems
18  * @author Daniel Rehfeldt
19  *
20  *
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 
26 #ifndef APPLICATIONS_STP_SRC_SOLPOOL_H_
27 #define APPLICATIONS_STP_SRC_SOLPOOL_H_
28 
29 #include "scip/scip.h"
30 #include "graph.h"
31 
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** element of Steiner tree solution pool */
38 typedef struct stp_solution
39 {
41  int* soledges;
42  int index;
43 } STPSOL;
44 
45 /** edge based solution pool for Steiner tree problems (in presolving) */
46 typedef struct stp_solution_pool
47 {
49  int size;
50  int nedges;
51  int maxsize;
52  int maxindex;
53 } STPSOLPOOL;
54 
55 
56 /** is given solution in pool? */
57 SCIP_EXPORT
59  const int* soledges, /**< edge array of solution to be checked */
60  const STPSOLPOOL* pool /**< the pool */
61 );
62 
63 /** get solution from index */
64 SCIP_EXPORT
66  STPSOLPOOL* pool, /**< the pool */
67  const int soindex /**< the index */
68  );
69 
70 /** initializes STPSOL pool */
71 SCIP_EXPORT
73  SCIP* scip, /**< SCIP data structure */
74  STPSOLPOOL** pool, /**< the pool */
75  const int nedges, /**< number of edges of solutions to be stored in the pool */
76  const int maxsize /**< capacity of pool */
77  );
78 
79 /** tries to add STPSOL to pool */
80 SCIP_EXPORT
82  SCIP* scip, /**< SCIP data structure */
83  const SCIP_Real obj, /**< objective of solution to be added */
84  const int* soledges, /**< edge array of solution to be added */
85  STPSOLPOOL* pool, /**< the pool */
86  SCIP_Bool* success /**< has solution been added? */
87  );
88 
89 /** tries to add sol to SCIP */
90 SCIP_EXPORT
92  SCIP* scip, /**< SCIP data structure */
93  SCIP_HEUR* heur, /**< heuristic data structure or NULL */
94  const GRAPH* g,
95  const int* result , /**< edge array of solution to be added */
96  SCIP_Bool* success /**< has solution been added? */
97  );
98 
99 /** frees STPSOL pool */
100 SCIP_EXPORT
101 void solpool_free(
102  SCIP* scip, /**< SCIP data structure */
103  STPSOLPOOL** pool /**< the pool */
104  );
105 
106 
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 
113 #endif /* APPLICATIONS_STP_SRC_STPSOLPOOL_H_ */
SCIP_Bool solpool_isContained(const int *soledges, const STPSOLPOOL *pool)
Definition: solpool.c:35
SCIP_RETCODE solpool_init(SCIP *scip, STPSOLPOOL **pool, const int nedges, const int maxsize)
Definition: solpool.c:91
STPSOL * solpool_solFromIndex(STPSOLPOOL *pool, const int soindex)
Definition: solpool.c:66
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
includes various files containing graph methods used for Steiner tree problems
int index
Definition: solpool.h:42
struct stp_solution_pool STPSOLPOOL
SCIP_RETCODE solpool_addSol(SCIP *scip, const SCIP_Real obj, const int *soledges, STPSOLPOOL *pool, SCIP_Bool *success)
Definition: solpool.c:183
STPSOL ** sols
Definition: solpool.h:48
SCIP_RETCODE solpool_addSolToScip(SCIP *scip, SCIP_HEUR *heur, const GRAPH *g, const int *result, SCIP_Bool *success)
Definition: solpool.c:150
void solpool_free(SCIP *scip, STPSOLPOOL **pool)
Definition: solpool.c:122
struct stp_solution STPSOL
#define SCIP_Bool
Definition: def.h:84
SCIP_Real obj
Definition: solpool.h:40
int * soledges
Definition: solpool.h:41
#define SCIP_Real
Definition: def.h:177
SCIP callable library.