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   struct_branch.h
17  * @ingroup INTERNALAPI
18  * @brief  datastructures for branching rules and branching candidate storage
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_STRUCT_BRANCH_H__
25 #define __SCIP_STRUCT_BRANCH_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_var.h"
30 #include "scip/type_branch.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /** branching candidate storage */
37 struct SCIP_BranchCand
38 {
39    SCIP_VAR**            lpcands;            /**< candidates for branching on LP solution (fractional integer variables) */
40    SCIP_Real*            lpcandssol;         /**< solution values of LP candidates */
41    SCIP_Real*            lpcandsfrac;        /**< fractionalities of LP candidates */
42    SCIP_VAR**            externcands;        /**< external candidates for branching, e.g. given by relaxation */
43    SCIP_Real*            externcandsscore;   /**< scores of external candidates, e.g. infeasibilities */
44    SCIP_Real*            externcandssol;     /**< values in solution of external candidates */
45    SCIP_VAR**            pseudocands;        /**< candidates for branching on pseudo solution (non-fixed integer variables) */
46    SCIP_Longint          validlpcandslp;     /**< lp number for which lpcands are valid */
47    int                   lpcandssize;        /**< number of available slots in lpcands array */
48    int                   nlpcands;           /**< number of candidates for branching on LP solution */
49    int                   npriolpcands;       /**< number of LP candidates with largest branch priority value */
50    int                   npriolpbins;        /**< number of binary LP candidates with largest branch priority value */
51    int                   nimpllpfracs;       /**< number of implicit variables with fractional LP solution value */
52    int                   lpmaxpriority;      /**< maximal branch priority of all LP candidates */
53    int                   externcandssize;    /**< number of available slots in externcands array */
54    int                   nexterncands;       /**< number of external candidates for branching */
55    int                   nprioexterncands;   /**< number of external candidates with largest branch priority value */
56    int                   nprioexternbins;    /**< number of binary external candidates with largest branch priority value */
57    int                   nprioexternints;    /**< number of integer external candidates with largest branch priority value */
58    int                   nprioexternimpls;   /**< number of implicit integer external candidates with largest branch priority value */
59    int                   externmaxpriority;  /**< maximal branch priority of all external candidates */
60    int                   pseudocandssize;    /**< number of available slots in pseudocands array */
61    int                   npseudocands;       /**< number of candidates for branching on pseudo solution */
62    int                   npriopseudocands;   /**< number of pseudo candidates with largest branch priority value */
63    int                   npriopseudobins;    /**< number of binary pseudo candidates with largest branch priority value */
64    int                   npriopseudoints;    /**< number of integer pseudo candidates with largest branch priority value */
65    int                   pseudomaxpriority;  /**< maximal branch priority of all pseudo candidates */
66 };
67 
68 /** branching rule */
69 struct SCIP_Branchrule
70 {
71    SCIP_Real             maxbounddist;       /**< maximal relative distance from current node's dual bound to primal bound
72                                               *   compared to best node's dual bound for applying branching rule
73                                               *   (0.0: only on current best node, 1.0: on all nodes) */
74    SCIP_Longint          nlpcalls;           /**< number of times, this branching rule was called on an LP solution */
75    SCIP_Longint          nexterncalls;       /**< number of times, this branching rule was called on external candidates */
76    SCIP_Longint          npseudocalls;       /**< number of times, this branching rule was called on a pseudo solution */
77    SCIP_Longint          ncutoffs;           /**< number of cutoffs found so far by this branching rule */
78    SCIP_Longint          ncutsfound;         /**< number of cutting planes found so far by this branching rule */
79    SCIP_Longint          nconssfound;        /**< number of cutting constraints added so far by this branching rule (not
80                                               *   counting constraint additions to child nodes used for branching) */
81    SCIP_Longint          ndomredsfound;      /**< number of domain reductions found so far by this branching rule */
82    SCIP_Longint          nchildren;          /**< number of children created so far by this branching rule */
83    char*                 name;               /**< name of branching rule */
84    char*                 desc;               /**< description of branching rule */
85    SCIP_DECL_BRANCHCOPY  ((*branchcopy));    /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
86    SCIP_DECL_BRANCHFREE  ((*branchfree));    /**< destructor of branching rule */
87    SCIP_DECL_BRANCHINIT  ((*branchinit));    /**< initialize branching rule */
88    SCIP_DECL_BRANCHEXIT  ((*branchexit));    /**< deinitialize branching rule */
89    SCIP_DECL_BRANCHINITSOL((*branchinitsol));/**< solving process initialization method of branching rule */
90    SCIP_DECL_BRANCHEXITSOL((*branchexitsol));/**< solving process deinitialization method of branching rule */
91    SCIP_DECL_BRANCHEXECLP((*branchexeclp));  /**< branching execution method for fractional LP solutions */
92    SCIP_DECL_BRANCHEXECEXT((*branchexecext));/**< branching execution method for external candidates */
93    SCIP_DECL_BRANCHEXECPS((*branchexecps));  /**< branching execution method for not completely fixed pseudo solutions */
94    SCIP_BRANCHRULEDATA*  branchruledata;     /**< branching rule data */
95    SCIP_CLOCK*           setuptime;          /**< time spend for setting up this branchrule for the next stages */
96    SCIP_CLOCK*           branchclock;        /**< branching rule execution time */
97    int                   priority;           /**< priority of the branching rule */
98    int                   maxdepth;           /**< maximal depth level, up to which this branching rule should be used (or -1) */
99    SCIP_Bool             initialized;        /**< is branching rule initialized? */
100    SCIP_Bool             isobjbranchrule;    /**< is branching rule an obj branching rule? */
101 };
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif
108