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   pricestore.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for storing priced variables
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PRICESTORE_H__
25 #define __SCIP_PRICESTORE_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_set.h"
32 #include "scip/type_stat.h"
33 #include "scip/type_event.h"
34 #include "scip/type_lp.h"
35 #include "scip/type_var.h"
36 #include "scip/type_prob.h"
37 #include "scip/type_tree.h"
38 #include "scip/type_pricestore.h"
39 #include "scip/type_branch.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /** creates pricing storage */
46 SCIP_RETCODE SCIPpricestoreCreate(
47    SCIP_PRICESTORE**     pricestore          /**< pointer to store pricing storage */
48    );
49 
50 /** frees pricing storage */
51 SCIP_RETCODE SCIPpricestoreFree(
52    SCIP_PRICESTORE**     pricestore          /**< pointer to store pricing storage */
53    );
54 
55 /** informs pricing storage, that the setup of the initial LP starts now */
56 void SCIPpricestoreStartInitialLP(
57    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
58    );
59 
60 /** informs pricing storage, that the setup of the initial LP is now finished */
61 void SCIPpricestoreEndInitialLP(
62    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
63    );
64 
65 /** adds variable to pricing storage and capture it */
66 SCIP_RETCODE SCIPpricestoreAddVar(
67    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
68    BMS_BLKMEM*           blkmem,             /**< block memory */
69    SCIP_SET*             set,                /**< global SCIP settings */
70    SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
71    SCIP_LP*              lp,                 /**< LP data */
72    SCIP_VAR*             var,                /**< priced variable */
73    SCIP_Real             score,              /**< pricing score of variable (the larger, the better the variable) */
74    SCIP_Bool             root                /**< are we at the root node? */
75    );
76 
77 /** adds variable where zero violates the bounds to pricing storage, capture it */
78 SCIP_RETCODE SCIPpricestoreAddBdviolvar(
79    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
80    BMS_BLKMEM*           blkmem,             /**< block memory */
81    SCIP_SET*             set,                /**< global SCIP settings */
82    SCIP_STAT*            stat,               /**< problem statistics */
83    SCIP_LP*              lp,                 /**< LP data */
84    SCIP_BRANCHCAND*      branchcand,         /**< branching candidate storage */
85    SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
86    SCIP_VAR*             var                 /**< variable, where zero violates the bounds */
87    );
88 
89 /** adds problem variables with negative reduced costs to pricing storage */
90 SCIP_RETCODE SCIPpricestoreAddProbVars(
91    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
92    BMS_BLKMEM*           blkmem,             /**< block memory buffers */
93    SCIP_SET*             set,                /**< global SCIP settings */
94    SCIP_STAT*            stat,               /**< dynamic problem statistics */
95    SCIP_PROB*            prob,               /**< transformed problem after presolve */
96    SCIP_TREE*            tree,               /**< branch and bound tree */
97    SCIP_LP*              lp,                 /**< LP data */
98    SCIP_BRANCHCAND*      branchcand,         /**< branching candidate storage */
99    SCIP_EVENTQUEUE*      eventqueue          /**< event queue */
100    );
101 
102 /** adds priced variables to the LP */
103 SCIP_RETCODE SCIPpricestoreApplyVars(
104    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
105    BMS_BLKMEM*           blkmem,             /**< block memory buffers */
106    SCIP_SET*             set,                /**< global SCIP settings */
107    SCIP_STAT*            stat,               /**< dynamic problem statistics */
108    SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
109    SCIP_PROB*            prob,               /**< transformed problem after presolve */
110    SCIP_TREE*            tree,               /**< branch and bound tree */
111    SCIP_LP*              lp                  /**< LP data */
112    );
113 
114 /** reset variables' bounds violated by zero to its original value */
115 SCIP_RETCODE SCIPpricestoreResetBounds(
116    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
117    BMS_BLKMEM*           blkmem,             /**< block memory */
118    SCIP_SET*             set,                /**< global SCIP settings */
119    SCIP_STAT*            stat,               /**< problem statistics */
120    SCIP_LP*              lp,                 /**< LP data */
121    SCIP_BRANCHCAND*      branchcand,         /**< branching candidate storage */
122    SCIP_EVENTQUEUE*      eventqueue          /**< event queue */
123    );
124 
125 /** gets number of variables in pricing storage */
126 int SCIPpricestoreGetNVars(
127    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
128    );
129 
130 /** gets number of variables in pricing storage whose bounds must be reset */
131 int SCIPpricestoreGetNBoundResets(
132    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
133    );
134 
135 /** gets time needed to price existing problem variables */
136 SCIP_Real SCIPpricestoreGetProbPricingTime(
137    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
138    );
139 
140 /** gets total number of calls to problem variable pricing */
141 int SCIPpricestoreGetNProbPricings(
142    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
143    );
144 
145 /** gets total number of times, a problem variable was priced in */
146 int SCIPpricestoreGetNProbvarsFound(
147    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
148    );
149 
150 /** get total number of variables found so far in pricing */
151 int SCIPpricestoreGetNVarsFound(
152    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
153    );
154 
155 /** get total number of variables priced into the LP so far */
156 int SCIPpricestoreGetNVarsApplied(
157    SCIP_PRICESTORE*      pricestore          /**< pricing storage */
158    );
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif
165