1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   pub_history.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for branching and inference history structure
19  * @author Stefan Heinz
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PUB_HISTORY_H__
25 #define __SCIP_PUB_HISTORY_H__
26 
27 #include "scip/def.h"
28 #include "scip/type_history.h"
29 
30 #ifdef NDEBUG
31 #include "scip/struct_history.h"
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /** gets the conflict score of the history entry */
39 SCIP_EXPORT
40 SCIP_Real SCIPhistoryGetVSIDS(
41    SCIP_HISTORY*         history,            /**< branching and inference history */
42    SCIP_BRANCHDIR        dir                 /**< branching direction */
43    );
44 
45 /** get number of cutoffs counter */
46 SCIP_EXPORT
47 SCIP_Real SCIPhistoryGetCutoffSum(
48    SCIP_HISTORY*         history,            /**< branching and inference history */
49    SCIP_BRANCHDIR        dir                 /**< branching direction (downwards, or upwards) */
50    );
51 
52 /** return the number of (domain) values for which a history exists */
53 SCIP_EXPORT
54 int SCIPvaluehistoryGetNValues(
55    SCIP_VALUEHISTORY*    valuehistory        /**< value based history */
56    );
57 
58 /** return the array containing the histories for the individual (domain) values */
59 SCIP_EXPORT
60 SCIP_HISTORY** SCIPvaluehistoryGetHistories(
61    SCIP_VALUEHISTORY*    valuehistory        /**< value based history */
62    );
63 
64 /** return the array containing the (domain) values for which a history exists */
65 SCIP_EXPORT
66 SCIP_Real* SCIPvaluehistoryGetValues(
67    SCIP_VALUEHISTORY*    valuehistory        /**< value based history */
68    );
69 
70 #ifdef NDEBUG
71 
72 /* In optimized mode, the methods are implemented as defines to reduce the number of function calls and
73  * speed up the algorithms.
74  */
75 
76 #define SCIPhistoryGetVSIDS(history,dir)   ((history)->vsids[dir])
77 #define SCIPhistoryGetCutoffSum(history,dir)        ((history)->cutoffsum[dir])
78 #define SCIPvaluehistoryGetNValues(valuehistory)     (valuehistory)->nvalues
79 #define SCIPvaluehistoryGetHistories(valuehistory)      (valuehistory)->histories
80 #define SCIPvaluehistoryGetValues(valuehistory)      (valuehistory)->values
81 
82 #endif
83 
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
90