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   cutpool.h
26   	 * @ingroup INTERNALAPI
27   	 * @brief  internal methods for storing cuts in a cut pool
28   	 * @author Tobias Achterberg
29   	 */
30   	
31   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32   	
33   	#ifndef __SCIP_CUTPOOL_H__
34   	#define __SCIP_CUTPOOL_H__
35   	
36   	
37   	#include "scip/def.h"
38   	#include "blockmemshell/memory.h"
39   	#include "scip/type_event.h"
40   	#include "scip/type_retcode.h"
41   	#include "scip/type_result.h"
42   	#include "scip/type_set.h"
43   	#include "scip/type_sol.h"
44   	#include "scip/type_stat.h"
45   	#include "scip/type_lp.h"
46   	#include "scip/type_sepastore.h"
47   	#include "scip/type_cutpool.h"
48   	#include "scip/pub_cutpool.h"
49   	
50   	#ifdef __cplusplus
51   	extern "C" {
52   	#endif
53   	
54   	/** creates cut pool */
55   	SCIP_RETCODE SCIPcutpoolCreate(
56   	   SCIP_CUTPOOL**        cutpool,            /**< pointer to store cut pool */
57   	   BMS_BLKMEM*           blkmem,             /**< block memory */
58   	   SCIP_SET*             set,                /**< global SCIP settings */
59   	   int                   agelimit,           /**< maximum age a cut can reach before it is deleted from the pool */
60   	   SCIP_Bool             globalcutpool       /**< is this the global cut pool of SCIP? */
61   	   );
62   	
63   	/** frees cut pool */
64   	SCIP_RETCODE SCIPcutpoolFree(
65   	   SCIP_CUTPOOL**        cutpool,            /**< pointer to store cut pool */
66   	   BMS_BLKMEM*           blkmem,             /**< block memory */
67   	   SCIP_SET*             set,                /**< global SCIP settings */
68   	   SCIP_LP*              lp                  /**< current LP data */
69   	   );
70   	
71   	/** removes all rows from the cut pool */
72   	SCIP_RETCODE SCIPcutpoolClear(
73   	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
74   	   BMS_BLKMEM*           blkmem,             /**< block memory */
75   	   SCIP_SET*             set,                /**< global SCIP settings */
76   	   SCIP_LP*              lp                  /**< current LP data */
77   	   );
78   	
79   	/** checks if cut is already existing */
80   	SCIP_Bool SCIPcutpoolIsCutNew(
81   	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
82   	   SCIP_SET*             set,                /**< global SCIP settings */
83   	   SCIP_ROW*             row                 /**< cutting plane to add */
84   	   );
85   	
86   	/** if not already existing, adds row to cut pool and captures it */
87   	SCIP_RETCODE SCIPcutpoolAddRow(
88   	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
89   	   BMS_BLKMEM*           blkmem,             /**< block memory */
90   	   SCIP_SET*             set,                /**< global SCIP settings */
91   	   SCIP_STAT*            stat,               /**< problem statistics data */
92   	   SCIP_LP*              lp,                 /**< current LP data */
93   	   SCIP_ROW*             row                 /**< cutting plane to add */
94   	   );
95   	
96   	/** adds row to cut pool and captures it; doesn't check for multiple cuts */
97   	SCIP_RETCODE SCIPcutpoolAddNewRow(
98   	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
99   	   BMS_BLKMEM*           blkmem,             /**< block memory */
100  	   SCIP_SET*             set,                /**< global SCIP settings */
101  	   SCIP_STAT*            stat,               /**< problem statistics data */
102  	   SCIP_LP*              lp,                 /**< current LP data */
103  	   SCIP_ROW*             row                 /**< cutting plane to add */
104  	   );
105  	
106  	/** removes the LP row from the cut pool */
107  	SCIP_RETCODE SCIPcutpoolDelRow(
108  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
109  	   BMS_BLKMEM*           blkmem,             /**< block memory */
110  	   SCIP_SET*             set,                /**< global SCIP settings */
111  	   SCIP_STAT*            stat,               /**< problem statistics data */
112  	   SCIP_LP*              lp,                 /**< current LP data */
113  	   SCIP_ROW*             row                 /**< row to remove */
114  	   );
115  	
116  	/** separates cuts of the cut pool */
117  	SCIP_RETCODE SCIPcutpoolSeparate(
118  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
119  	   BMS_BLKMEM*           blkmem,             /**< block memory */
120  	   SCIP_SET*             set,                /**< global SCIP settings */
121  	   SCIP_STAT*            stat,               /**< problem statistics data */
122  	   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
123  	   SCIP_EVENTFILTER*     eventfilter,        /**< event filter for global events */
124  	   SCIP_LP*              lp,                 /**< current LP data */
125  	   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
126  	   SCIP_SOL*             sol,                /**< solution to be separated (or NULL for LP-solution) */
127  	   SCIP_Bool             cutpoolisdelayed,   /**< is the cutpool delayed (count cuts found)? */
128  	   SCIP_Bool             root,               /**< are we at the root node? */
129  	   SCIP_RESULT*          result              /**< pointer to store the result of the separation call */
130  	   );
131  	
132  	/** adds the maximum number of cuts that were stored in the pool;
133  	 *  this is primarily used to keep statistics when SCIP performs a restart */
134  	void SCIPcutpoolAddMaxNCuts(
135  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
136  	   SCIP_Longint          ncuts               /**< number of cuts to add */
137  	   );
138  	
139  	/** sets time in seconds used for separating cuts from the pool;
140  	 *  this is primarily used to keep statistics when SCIP performs a restart */
141  	void SCIPcutpoolSetTime(
142  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
143  	   SCIP_Real             time                /**< poolclock time */
144  	   );
145  	
146  	/** adds the number of times the cut pool was separated;
147  	 *  this is primarily used to keep statistics when SCIP performs a restart */
148  	void SCIPcutpoolAddNCalls(
149  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
150  	   SCIP_Longint          ncalls              /**< ncalls */
151  	   );
152  	
153  	/** adds the number of times the cut pool was separated at the root;
154  	 *  this is primarily used to keep statistics when SCIP performs a restart */
155  	void SCIPcutpoolAddNRootCalls(
156  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
157  	   SCIP_Longint          nrootcalls          /**< nrootcalls */
158  	);
159  	
160  	/** adds the total number of cuts that were added to the pool;
161  	 *  this is primarily used to keep statistics when SCIP performs a restart */
162  	void SCIPcutpoolAddNCutsFound(
163  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
164  	   SCIP_Longint          ncutsfound          /**< total number of cuts added to cut pool */
165  	   );
166  	
167  	/** adds the total number of cuts that were separated from the pool;
168  	 *  this is primarily used to keep statistics when SCIP performs a restart */
169  	void SCIPcutpoolAddNCutsAdded(
170  	   SCIP_CUTPOOL*         cutpool,            /**< cut pool */
171  	   SCIP_Longint          ncutsadded          /**< total number of cuts added from cut pool to sepastore */
172  	   );
173  	
174  	#ifdef __cplusplus
175  	}
176  	#endif
177  	
178  	#endif
179