Scippy

SCIP

Solving Constraint Integer Programs

pub_sol.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-2014 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_sol.h
17  * @ingroup PUBLICMETHODS
18  * @brief public methods for primal CIP solutions
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifndef __SCIP_PUB_SOL_H__
26 #define __SCIP_PUB_SOL_H__
27 
28 
29 #include "scip/def.h"
30 #include "scip/type_sol.h"
31 #include "scip/type_heur.h"
32 
33 #ifdef NDEBUG
34 #include "scip/struct_sol.h"
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** gets origin of solution */
42 extern
44  SCIP_SOL* sol /**< primal CIP solution */
45  );
46 
47 /** returns whether the given solution is defined on original variables */
48 extern
50  SCIP_SOL* sol /**< primal CIP solution */
51  );
52 
53 /** gets objective value of primal CIP solution which lives in the original problem space */
54 extern
56  SCIP_SOL* sol /**< primal CIP solution */
57  );
58 
59 /** gets clock time, when this solution was found */
60 extern
62  SCIP_SOL* sol /**< primal CIP solution */
63  );
64 
65 /** gets branch and bound run number, where this solution was found */
66 extern
68  SCIP_SOL* sol /**< primal CIP solution */
69  );
70 
71 /** gets node number of the specific branch and bound run, where this solution was found */
72 extern
74  SCIP_SOL* sol /**< primal CIP solution */
75  );
76 
77 /** gets node's depth, where this solution was found */
78 extern
79 int SCIPsolGetDepth(
80  SCIP_SOL* sol /**< primal CIP solution */
81  );
82 
83 /** gets heuristic, that found this solution (or NULL if it's from the tree) */
84 extern
86  SCIP_SOL* sol /**< primal CIP solution */
87  );
88 
89 /** informs the solution that it now belongs to the given primal heuristic */
90 extern
91 void SCIPsolSetHeur(
92  SCIP_SOL* sol, /**< primal CIP solution */
93  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
94  );
95 
96 /** returns unique index of given solution */
97 extern
98 int SCIPsolGetIndex(
99  SCIP_SOL* sol /**< primal CIP solution */
100  );
101 
102 
103 #ifdef NDEBUG
104 
105 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
106  * speed up the algorithms.
107  */
108 
109 #define SCIPsolGetOrigin(sol) ((sol)->solorigin)
110 #define SCIPsolIsOriginal(sol) ((sol)->solorigin == SCIP_SOLORIGIN_ORIGINAL)
111 #define SCIPsolGetOrigObj(sol) (sol)->obj
112 #define SCIPsolGetTime(sol) (sol)->time
113 #define SCIPsolGetNodenum(sol) (sol)->nodenum
114 #define SCIPsolGetRunnum(sol) (sol)->runnum
115 #define SCIPsolGetDepth(sol) (sol)->depth
116 #define SCIPsolGetHeur(sol) (sol)->heur
117 #define SCIPsolGetIndex(sol) (sol)->index
118 #define SCIPsolSetHeur(sol,newheur) ((sol)->heur = (newheur))
119 #endif
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
126