Scippy

SCIP

Solving Constraint Integer Programs

benderscut_opt.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 scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file benderscut_opt.h
17  * @ingroup BENDERSCUTS
18  * @brief Generates a standard Benders' decomposition optimality cut
19  * @author Stephen J. Maher
20  *
21  * The classical Benders' decomposition optimality cuts arise from a feasible instance of the Benders' decomposition
22  * subproblem. The optimality cuts are an underestimator of the subproblem objective function value. Auxiliary
23  * variables, \f$\varphi\f$ are added to the master problem as a lower bound on the subproblem objective function value.
24  *
25  * Consider a linear Benders' decomposition subproblem that takes the master problem solution \f$\bar{x}\f$ as input:
26  * \f[
27  * z(\bar{x}) = \min\{d^{T}y : Ty \geq h - H\bar{x}, y \geq 0\}
28  * \f]
29  * If the subproblem is feasible, and \f$z(\bar{x}) > \varphi\f$ (indicating that the current underestimators are not
30  * optimal) then the Benders' decomposition optimality cut can be generated from the optimal dual solution of the
31  * subproblem. Let \f$w\f$ be the vector corresponding to the optimal dual solution of the Benders' decomposition
32  * subproblem. The resulting cut is:
33  * \f[
34  * \varphi \geq w^{T}(h - Hx)
35  * \f]
36  *
37  * Next, consider a nonlinear Benders' decomposition subproblem that takes the master problem solution \f$\bar{x}\f$ as input:
38  * \f[
39  * z(\bar{x}) = \min\{d^{T}y : g(\bar{x},y) \leq 0, y \geq 0\}
40  * \f]
41  * If the subproblem is feasible, and \f$z(\bar{x}) > \varphi\f$ (indicating that the current underestimators are not
42  * optimal) then the Benders' decomposition optimality cut can be generated from the optimal dual solution of the
43  * subproblem. Let \f$w\f$ be the vector corresponding to the optimal dual solution of the Benders' decomposition subproblem.
44  * The resulting cut is:
45  * \f[
46  * \varphi \geq z(\bar{x}) + w^{T} \nabla_x g(\bar{x}, y) (x-\bar{x})
47  * \f]
48  *
49  */
50 
51 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
52 
53 #ifndef __SCIP_BENDERSCUT_OPT_H__
54 #define __SCIP_BENDERSCUT_OPT_H__
55 
56 
57 #include "scip/def.h"
58 #include "scip/type_benders.h"
59 #include "scip/type_benderscut.h"
60 #include "scip/type_cons.h"
61 #include "scip/type_lp.h"
62 #include "scip/type_misc.h"
63 #include "scip/type_nlp.h"
64 #include "scip/type_retcode.h"
65 #include "scip/type_scip.h"
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 /** creates the optimality Benders' decomposition cut and includes it in SCIP
73  *
74  * @ingroup BenderscutIncludes
75  */
76 SCIP_EXPORT
78  SCIP* scip, /**< SCIP data structure */
79  SCIP_BENDERS* benders /**< Benders' decomposition */
80  );
81 
82 /** @addtogroup BENDERSCUTS
83  * @{
84  */
85 
86 /** Generates a classical Benders' optimality cut using the dual solutions from the subproblem or the input arrays. If
87  * the dual solutions are input as arrays, then a mapping between the array indices and the rows/variables is required.
88  * This method can also be used to generate a feasiblity, is a problem to minimise the infeasibilities has been solved
89  * to generate the dual solutions
90  */
91 SCIP_EXPORT
93  SCIP* masterprob, /**< the SCIP instance of the master problem */
94  SCIP* subproblem, /**< the SCIP instance of the pricing problem */
95  SCIP_BENDERS* benders, /**< the benders' decomposition */
96  SCIP_BENDERSCUT* benderscut, /**< the benders' decomposition cut method */
97  SCIP_SOL* sol, /**< primal CIP solution */
98  int probnumber, /**< the number of the pricing problem */
99  char* cutname, /**< the name for the cut to be generated */
100  SCIP_Real objective, /**< the objective function of the subproblem */
101  SCIP_Real* primalvals, /**< the primal solutions for the NLP, can be NULL */
102  SCIP_Real* consdualvals, /**< dual variables for the constraints, can be NULL */
103  SCIP_Real* varlbdualvals, /**< the dual variables for the variable lower bounds, can be NULL */
104  SCIP_Real* varubdualvals, /**< the dual variables for the variable upper bounds, can be NULL */
105  SCIP_HASHMAP* row2idx, /**< mapping between the row in the subproblem to the index in the dual array, can be NULL */
106  SCIP_HASHMAP* var2idx, /**< mapping from variable of the subproblem to the index in the dual arrays, can be NULL */
107  SCIP_BENDERSENFOTYPE type, /**< the enforcement type calling this function */
108  SCIP_Bool addcut, /**< should the Benders' cut be added as a cut or constraint */
109  SCIP_Bool feasibilitycut, /**< is this called for the generation of a feasibility cut */
110  SCIP_RESULT* result /**< the result from solving the subproblems */
111  );
112 
113 /** adds the gradient of a nonlinear row in the current NLP solution of a subproblem to a linear row or constraint in the master problem
114  *
115  * Only computes gradient w.r.t. master problem variables.
116  * Computes also the directional derivative, that is, mult times gradient times solution.
117  */
118 SCIP_EXPORT
120  SCIP* masterprob, /**< the SCIP instance of the master problem */
121  SCIP* subproblem, /**< the SCIP instance of the subproblem */
122  SCIP_BENDERS* benders, /**< the benders' decomposition structure */
123  SCIP_NLROW* nlrow, /**< nonlinear row */
124  SCIP_Real mult, /**< multiplier */
125  SCIP_Real* primalvals, /**< the primal solutions for the NLP, can be NULL */
126  SCIP_HASHMAP* var2idx, /**< mapping from variable of the subproblem to the index in the dual arrays, can be NULL */
127  SCIP_Real* dirderiv, /**< storage to add directional derivative */
128  SCIP_VAR*** vars, /**< pointer to array of variables in the generated cut with non-zero coefficient */
129  SCIP_Real** vals, /**< pointer to array of coefficients of the variables in the generated cut */
130  int* nvars, /**< the number of variables in the cut */
131  int* varssize /**< the number of variables in the array */
132  );
133 
134 /** @} */
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
type definitions for miscellaneous datastructures
type definitions for NLP management
type definitions for expression interpreter
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
enum SCIP_BendersEnfoType SCIP_BENDERSENFOTYPE
Definition: type_benders.h:42
type definitions for return codes for SCIP methods
type definitions for LP management
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPgenerateAndApplyBendersOptCut(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_BENDERSCUT *benderscut, SCIP_SOL *sol, int probnumber, char *cutname, SCIP_Real objective, SCIP_Real *primalvals, SCIP_Real *consdualvals, SCIP_Real *varlbdualvals, SCIP_Real *varubdualvals, SCIP_HASHMAP *row2idx, SCIP_HASHMAP *var2idx, SCIP_BENDERSENFOTYPE type, SCIP_Bool addcut, SCIP_Bool feasibilitycut, SCIP_RESULT *result)
#define SCIP_Bool
Definition: def.h:84
SCIP_RETCODE SCIPaddNlRowGradientBenderscutOpt(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_NLROW *nlrow, SCIP_Real mult, SCIP_Real *primalvals, SCIP_HASHMAP *var2idx, SCIP_Real *dirderiv, SCIP_VAR ***vars, SCIP_Real **vals, int *nvars, int *varssize)
type definitions for Benders&#39; decomposition methods
type definitions for Benders&#39; decomposition cut
SCIP_RETCODE SCIPincludeBenderscutOpt(SCIP *scip, SCIP_BENDERS *benders)
#define SCIP_Real
Definition: def.h:177
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers