1    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2    	/*                                                                           */
3    	/*                  This file is part of the program and library             */
4    	/*         SCIP --- Solving Constraint Integer Programs                      */
5    	/*                                                                           */
6    	/*  Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB)                      */
7    	/*                                                                           */
8    	/*  Licensed under the Apache License, Version 2.0 (the "License");          */
9    	/*  you may not use this file except in compliance with the License.         */
10   	/*  You may obtain a copy of the License at                                  */
11   	/*                                                                           */
12   	/*      http://www.apache.org/licenses/LICENSE-2.0                           */
13   	/*                                                                           */
14   	/*  Unless required by applicable law or agreed to in writing, software      */
15   	/*  distributed under the License is distributed on an "AS IS" BASIS,        */
16   	/*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17   	/*  See the License for the specific language governing permissions and      */
18   	/*  limitations under the License.                                           */
19   	/*                                                                           */
20   	/*  You should have received a copy of the Apache-2.0 license                */
21   	/*  along with SCIP; see the file LICENSE. If not visit scipopt.org.         */
22   	/*                                                                           */
23   	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24   	
25   	/**@file   sepastore.h
26   	 * @ingroup INTERNALAPI
27   	 * @brief  internal methods for storing separated cuts
28   	 * @author Tobias Achterberg
29   	 * @author Leona Gottwald
30   	 */
31   	
32   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33   	
34   	#ifndef __SCIP_SEPASTORE_H__
35   	#define __SCIP_SEPASTORE_H__
36   	
37   	
38   	#include "scip/def.h"
39   	#include "blockmemshell/memory.h"
40   	#include "scip/type_implics.h"
41   	#include "scip/type_retcode.h"
42   	#include "scip/type_set.h"
43   	#include "scip/type_stat.h"
44   	#include "scip/type_event.h"
45   	#include "scip/type_lp.h"
46   	#include "scip/type_prob.h"
47   	#include "scip/type_tree.h"
48   	#include "scip/type_reopt.h"
49   	#include "scip/type_sepastore.h"
50   	#include "scip/type_branch.h"
51   	
52   	#ifdef __cplusplus
53   	extern "C" {
54   	#endif
55   	
56   	/** creates separation storage */
57   	SCIP_RETCODE SCIPsepastoreCreate(
58   	   SCIP_SEPASTORE**      sepastore,          /**< pointer to store separation storage */
59   	   BMS_BLKMEM*           blkmem,             /**< block memory */
60   	   SCIP_SET*             set                 /**< global SCIP settings */
61   	   );
62   	
63   	/** frees separation storage */
64   	SCIP_RETCODE SCIPsepastoreFree(
65   	   SCIP_SEPASTORE**      sepastore,          /**< pointer to store separation storage */
66   	   BMS_BLKMEM*           blkmem              /**< block memory */
67   	   );
68   	
69   	/** informs separation storage that the setup of the initial LP starts now */
70   	void SCIPsepastoreStartInitialLP(
71   	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
72   	   );
73   	
74   	/** informs separation storage that the setup of the initial LP is now finished */
75   	void SCIPsepastoreEndInitialLP(
76   	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
77   	   );
78   	
79   	/** informs separation storage that the following cuts should be used in any case */
80   	void SCIPsepastoreStartForceCuts(
81   	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
82   	   );
83   	
84   	/** informs separation storage that the following cuts should no longer be used in any case */
85   	void SCIPsepastoreEndForceCuts(
86   	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
87   	   );
88   	
89   	/** adds cut to separation storage and captures it */
90   	SCIP_RETCODE SCIPsepastoreAddCut(
91   	   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
92   	   BMS_BLKMEM*           blkmem,             /**< block memory */
93   	   SCIP_SET*             set,                /**< global SCIP settings */
94   	   SCIP_STAT*            stat,               /**< problem statistics data */
95   	   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
96   	   SCIP_EVENTFILTER*     eventfilter,        /**< event filter for global events */
97   	   SCIP_LP*              lp,                 /**< LP data */
98   	   SCIP_ROW*             cut,                /**< separated cut */
99   	   SCIP_Bool             forcecut,           /**< should the cut be forced to enter the LP? */
100  	   SCIP_Bool             root,               /**< are we at the root node? */
101  	   SCIP_Bool*            infeasible          /**< pointer to store whether the cut is infeasible */
102  	   );
103  	
104  	/** adds cuts to the LP and clears separation storage */
105  	SCIP_RETCODE SCIPsepastoreApplyCuts(
106  	   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
107  	   BMS_BLKMEM*           blkmem,             /**< block memory */
108  	   SCIP_SET*             set,                /**< global SCIP settings */
109  	   SCIP_STAT*            stat,               /**< problem statistics */
110  	   SCIP_PROB*            transprob,          /**< transformed problem */
111  	   SCIP_PROB*            origprob,           /**< original problem */
112  	   SCIP_TREE*            tree,               /**< branch and bound tree */
113  	   SCIP_REOPT*           reopt,              /**< reoptimization data structure */
114  	   SCIP_LP*              lp,                 /**< LP data */
115  	   SCIP_BRANCHCAND*      branchcand,         /**< branching candidate storage */
116  	   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
117  	   SCIP_EVENTFILTER*     eventfilter,        /**< global event filter */
118  	   SCIP_CLIQUETABLE*     cliquetable,        /**< clique table data structure */
119  	   SCIP_Bool             root,               /**< are we at the root node? */
120  	   SCIP_EFFICIACYCHOICE  efficiacychoice,    /**< type of solution to base efficiacy computation on */
121  	   SCIP_Bool*            cutoff              /**< pointer to store whether an empty domain was created */
122  	   );
123  	
124  	/** clears the separation storage without adding the cuts to the LP */
125  	SCIP_RETCODE SCIPsepastoreClearCuts(
126  	   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
127  	   BMS_BLKMEM*           blkmem,             /**< block memory */
128  	   SCIP_SET*             set,                /**< global SCIP settings */
129  	   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
130  	   SCIP_EVENTFILTER*     eventfilter,        /**< event filter for global events */
131  	   SCIP_LP*              lp                  /**< LP data */
132  	   );
133  	
134  	/** removes cuts that are inefficacious w.r.t. the current LP solution from separation storage without adding the cuts to the LP */
135  	SCIP_RETCODE SCIPsepastoreRemoveInefficaciousCuts(
136  	   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
137  	   BMS_BLKMEM*           blkmem,             /**< block memory */
138  	   SCIP_SET*             set,                /**< global SCIP settings */
139  	   SCIP_STAT*            stat,               /**< problem statistics data */
140  	   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
141  	   SCIP_EVENTFILTER*     eventfilter,        /**< event filter for global events */
142  	   SCIP_LP*              lp,                 /**< LP data */
143  	   SCIP_Bool             root,               /**< are we at the root node? */
144  	   SCIP_EFFICIACYCHOICE  efficiacychoice     /**< type of solution to base efficiacy computation on */
145  	   );
146  	
147  	/** indicates whether a cut is applicable
148  	 *
149  	 *  A cut is applicable if it is modifiable, not a bound change, or a bound change that changes bounds by at least epsilon.
150  	 */
151  	SCIP_Bool SCIPsepastoreIsCutApplicable(
152  	   SCIP_SET*             set,                /**< global SCIP settings */
153  	   SCIP_ROW*             cut                 /**< cut to check */
154  	   );
155  	
156  	/** get cuts in the separation storage */
157  	SCIP_ROW** SCIPsepastoreGetCuts(
158  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
159  	   );
160  	
161  	/** get number of cuts in the separation storage */
162  	int SCIPsepastoreGetNCuts(
163  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
164  	   );
165  	
166  	/** gets the total number of cutting planes added to the separation storage;
167  	 *  this is equal to the sum of added cuts directly and via the pool. */
168  	int SCIPsepastoreGetNCutsAdded(
169  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
170  	   );
171  	
172  	/** gets the number of cutting planes added to the separation storage from the cut pool */
173  	int SCIPsepastoreGetNCutsAddedViaPool(
174  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
175  	   );
176  	
177  	/** gets the number of cutting planes added to the separation storage directly */
178  	int SCIPsepastoreGetNCutsAddedDirect(
179  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
180  	   );
181  	
182  	/** get number of cuts found so far in current separation round */
183  	int SCIPsepastoreGetNCutsFoundRound(
184  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
185  	   );
186  	
187  	/** gets the total number of cutting planes applied to the LP */
188  	int SCIPsepastoreGetNCutsApplied(
189  	   SCIP_SEPASTORE*       sepastore           /**< separation storage */
190  	   );
191  	
192  	#ifdef __cplusplus
193  	}
194  	#endif
195  	
196  	#endif
197