Scippy

SCIP

Solving Constraint Integer Programs

branch_distribution.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-2017 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 branch_distribution.h
17  * @ingroup BRANCHINGRULES
18  * @brief probability based branching rule based on an article by J. Pryor and J.W. Chinneck
19  * @author Gregor Hendel
20  *
21  * The distribution branching rule selects a variable based on its impact on row activity distributions. More formally,
22  * let \f$ a(x) = a_1 x_1 + \dots + a_n x_n \leq b \f$ be a row of the LP. Let further \f$ l_i, u_i \in R\f$ denote the
23  * (finite) lower and upper bound, respectively, of the \f$ i \f$-th variable \f$x_i\f$.
24  * Viewing every variable \f$x_i \f$ as (continuously) uniformly distributed within its bounds, we can approximately
25  * understand the row activity \f$a(x)\f$ as a gaussian random variate with mean value \f$ \mu = E[a(x)] = \sum_i a_i\frac{l_i + u_i}{2}\f$
26  * and variance \f$ \sigma^2 = \sum_i a_i^2 \sigma_i^2 \f$, with \f$ \sigma_i^2 = \frac{(u_i - l_i)^2}{12}\f$ for
27  * continuous and \f$ \sigma_i^2 = \frac{(u_i - l_i + 1)^2 - 1}{12}\f$ for discrete variables.
28  * With these two parameters, we can calculate the probability to satisfy the row in terms of the cumulative distribution
29  * of the standard normal distribution: \f$ P(a(x) \leq b) = \Phi(\frac{b - \mu}{\sigma})\f$.
30  *
31  * The impact of a variable on the probability to satisfy a constraint after branching can be estimated by altering
32  * the variable contribution to the sums described above. In order to keep the tree size small,
33  * variables are preferred which decrease the probability
34  * to satisfy a row because it is more likely to create infeasible subproblems.
35  *
36  * The selection of the branching variable is subject to the parameter @p scoreparam. For both branching directions,
37  * an individual score is calculated. Available options for scoring methods are:
38  * - @b d: select a branching variable with largest difference in satisfaction probability after branching
39  * - @b l: lowest cumulative probability amongst all variables on all rows (after branching).
40  * - @b h: highest cumulative probability amongst all variables on all rows (after branching).
41  * - @b v: highest number of votes for lowering row probability for all rows a variable appears in.
42  * - @b w: highest number of votes for increasing row probability for all rows a variable appears in.
43  *
44  * If the parameter @p usescipscore is set to @a TRUE, a single branching score is calculated from the respective
45  * up and down scores as defined by the SCIP branching score function (see advanced branching parameter @p scorefunc),
46  * otherwise, the variable with the single highest score is selected, and the maximizing direction is assigned
47  * higher branching priority.
48  *
49  * The original idea of probability based branching schemes appeared in:
50  *
51  * J. Pryor and J.W. Chinneck:@n
52  * Faster Integer-Feasibility in Mixed-Integer Linear Programs by Branching to Force Change@n
53  * Computers and Operations Research, vol. 38, 2011, p. 1143–1152@n
54  * (http://www.sce.carleton.ca/faculty/chinneck/docs/PryorChinneck.pdf)
55  */
56 
57 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
58 
59 #ifndef __SCIP_BRANCH_DISTRIBUTION_H__
60 #define __SCIP_BRANCH_DISTRIBUTION_H__
61 
62 
63 #include "scip/scip.h"
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 /** creates the distribution branching rule and includes it in SCIP
70  *
71  * @ingroup BranchingRuleIncludes
72  */
73 extern
75  SCIP* scip /**< SCIP data structure */
76  );
77 
78 /**@addtogroup BRANCHINGRULES
79  *
80  * @{
81  */
82 
83 /** calculate the variable's distribution parameters (mean and variance) for the bounds specified in the arguments.
84  * special treatment of infinite bounds necessary */
85 extern
87  SCIP* scip, /**< SCIP data structure */
88  SCIP_Real varlb, /**< variable lower bound */
89  SCIP_Real varub, /**< variable upper bound */
90  SCIP_VARTYPE vartype, /**< type of the variable */
91  SCIP_Real* mean, /**< pointer to store mean value */
92  SCIP_Real* variance /**< pointer to store the variance of the variable uniform distribution */
93  );
94 
95 /** calculates the cumulative distribution P(-infinity <= x <= value) that a normally distributed
96  * random variable x takes a value between -infinity and parameter \p value.
97  *
98  * The distribution is given by the respective mean and deviation. This implementation
99  * uses the error function erf().
100  */
101 extern
103  SCIP* scip, /**< current SCIP */
104  SCIP_Real mean, /**< the mean value of the distribution */
105  SCIP_Real variance, /**< the square of the deviation of the distribution */
106  SCIP_Real value /**< the upper limit of the calculated distribution integral */
107  );
108 
109 /** calculates the probability of satisfying an LP-row under the assumption
110  * of uniformly distributed variable values.
111  *
112  * For inequalities, we use the cumulative distribution function of the standard normal
113  * distribution PHI(rhs - mu/sqrt(sigma2)) to calculate the probability
114  * for a right hand side row with mean activity mu and variance sigma2 to be satisfied.
115  * Similarly, 1 - PHI(lhs - mu/sqrt(sigma2)) is the probability to satisfy a left hand side row.
116  * For equations (lhs==rhs), we use the centeredness measure p = min(PHI(lhs'), 1-PHI(lhs'))/max(PHI(lhs'), 1 - PHI(lhs')),
117  * where lhs' = lhs - mu / sqrt(sigma2).
118  */
119 extern
121  SCIP* scip, /**< current scip */
122  SCIP_ROW* row, /**< the row */
123  SCIP_Real mu, /**< the mean value of the row distribution */
124  SCIP_Real sigma2, /**< the variance of the row distribution */
125  int rowinfinitiesdown, /**< the number of variables with infinite bounds to DECREASE activity */
126  int rowinfinitiesup /**< the number of variables with infinite bounds to INCREASE activity */
127  );
128 
129 /** update the up- and downscore of a single variable after calculating the impact of branching on a
130  * particular row, depending on the chosen score parameter
131  */
132 extern
134  SCIP* scip, /**< current SCIP pointer */
135  SCIP_Real currentprob, /**< the current probability */
136  SCIP_Real newprobup, /**< the new probability if branched upwards */
137  SCIP_Real newprobdown, /**< the new probability if branched downwards */
138  SCIP_Real* upscore, /**< pointer to store the new score for branching up */
139  SCIP_Real* downscore, /**< pointer to store the new score for branching down */
140  char scoreparam /**< parameter to determine the way the score is calculated */
141  );
142 
143 /* @} */
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif
void SCIPvarCalcDistributionParameters(SCIP *scip, SCIP_Real varlb, SCIP_Real varub, SCIP_VARTYPE vartype, SCIP_Real *mean, SCIP_Real *variance)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Real SCIPcalcCumulativeDistribution(SCIP *scip, SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
SCIP_Real SCIProwCalcProbability(SCIP *scip, SCIP_ROW *row, SCIP_Real mu, SCIP_Real sigma2, int rowinfinitiesdown, int rowinfinitiesup)
#define SCIP_Real
Definition: def.h:135
SCIP_RETCODE SCIPupdateDistributionScore(SCIP *scip, SCIP_Real currentprob, SCIP_Real newprobup, SCIP_Real newprobdown, SCIP_Real *upscore, SCIP_Real *downscore, char scoreparam)
enum SCIP_Vartype SCIP_VARTYPE
Definition: type_var.h:60
SCIP callable library.
SCIP_RETCODE SCIPincludeBranchruleDistribution(SCIP *scip)