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   pub_reopt.h
26   	 * @ingroup PUBLICCOREAPI
27   	 * @brief  public methods for reoptimization
28   	 * @author Jakob Witzig
29   	 */
30   	
31   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32   	
33   	#ifndef __SCIP_PUB_REOPT_H__
34   	#define __SCIP_PUB_REOPT_H__
35   	
36   	#include "scip/def.h"
37   	#include "scip/type_lp.h"
38   	#include "scip/type_reopt.h"
39   	#include "scip/type_var.h"
40   	
41   	#ifdef NDEBUG
42   	#include "scip/struct_reopt.h"
43   	#endif
44   	
45   	#ifdef __cplusplus
46   	extern "C" {
47   	#endif
48   	
49   	/*
50   	 * ReoptNode methods
51   	 */
52   	
53   	/** returns the number of bound changes stored in the reoptnode */
54   	SCIP_EXPORT
55   	int SCIPreoptnodeGetNVars(
56   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
57   	   );
58   	
59   	/** returns the number of bound changes at the node stored at ID id */
60   	SCIP_EXPORT
61   	int SCIPreoptnodeGetNConss(
62   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
63   	   );
64   	
65   	/** returns the number of stored bound changes based on dual information in the reopttree at ID id */
66   	SCIP_EXPORT
67   	int SCIPreoptnodeGetNDualBoundChgs(
68   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
69   	   );
70   	
71   	/** returns the number of child nodes of @p reoptnode */
72   	SCIP_EXPORT
73   	int SCIPreoptnodeGetNChildren(
74   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimizzation tree */
75   	   );
76   	
77   	/* return the lower bound stored at @p ID id */
78   	SCIP_EXPORT
79   	SCIP_Real SCIPreoptnodeGetLowerbound(
80   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
81   	   );
82   	
83   	/** returns the type of the @p reoptnode */
84   	SCIP_EXPORT
85   	SCIP_REOPTTYPE SCIPreoptnodeGetType(
86   	   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
87   	   );
88   	
89   	/** create the constraint which splits the node stored at ID id on the basis of the stored dual information. */
90   	SCIP_EXPORT
91   	void SCIPreoptnodeGetSplitCons(
92   	   SCIP_REOPTNODE*       reoptnode,          /**< node of the reoptimization tree */
93   	   SCIP_VAR**            vars,               /**< array to store the variables of the constraint */
94   	   SCIP_Real*            vals,               /**< array to store the coefficients of the variables */
95   	   REOPT_CONSTYPE*       constype,           /**< type of the constraint */
96   	   int                   conssize,           /**< size of the arrays */
97   	   int*                  nvars               /**< pointer to store the size of the constraints */
98   	   );
99   	
100  	/** returns all added constraints at ID id */
101  	SCIP_EXPORT
102  	void SCIPreoptnodeGetConss(
103  	   SCIP_REOPTNODE*       reoptnode,          /**< reoptimization data structure */
104  	   SCIP_VAR***           vars,               /**< 2-dim array of variables */
105  	   SCIP_Real**           bounds,             /**< 2-dim array of bounds */
106  	   SCIP_BOUNDTYPE**      boundtypes,         /**< 2-dim array of boundtypes */
107  	   int                   mem,                /**< allocated memory for constraints */
108  	   int*                  nconss,             /**< pointer to store the number of constraints */
109  	   int*                  nvars               /**< pointer to store the number of variables */
110  	   );
111  	
112  	/** set the parent id */
113  	SCIP_EXPORT
114  	void SCIPreoptnodeSetParentID(
115  	   SCIP_REOPTNODE*       reoptnode,          /**< node of the reopttree */
116  	   unsigned int          parentid            /**< id of the parent node */
117  	   );
118  	
119  	/*
120  	 * Reopt methods
121  	 */
122  	
123  	/** returns the number of global restarts */
124  	SCIP_EXPORT
125  	int SCIPreoptGetNRestartsGlobal(
126  	   SCIP_REOPT*           reopt               /**< reoptimization data */
127  	   );
128  	
129  	/** returns the number of local restarts in the current run */
130  	int SCIPreoptGetNRestartsLocal(
131  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
132  	   );
133  	
134  	/** returns the number of local restarts over all runs */
135  	int SCIPreoptGetNTotalRestartsLocal(
136  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
137  	   );
138  	
139  	/** returns the number of iteration with the first global restarts */
140  	SCIP_EXPORT
141  	int SCIPreoptGetFirstRestarts(
142  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
143  	   );
144  	
145  	/** returns the number of iteration with the last global restarts */
146  	SCIP_EXPORT
147  	int SCIPreoptGetLastRestarts(
148  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
149  	   );
150  	
151  	/** returns the number of nodes providing an improving feasible LP solution in the current run */
152  	SCIP_EXPORT
153  	int SCIPreoptGetNFeasNodes(
154  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
155  	   );
156  	
157  	/** returns the number of nodes providing an improving feasible LP solution over all runs */
158  	SCIP_EXPORT
159  	int SCIPreoptGetNTotalFeasNodes(
160  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
161  	   );
162  	
163  	/** returns the number of nodes that exceeded the cutoff bound in the current run */
164  	SCIP_EXPORT
165  	int SCIPreoptGetNPrunedNodes(
166  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
167  	   );
168  	
169  	/** returns the number of nodes that exceeded the cutoff bound over all runs */
170  	SCIP_EXPORT
171  	int SCIPreoptGetNTotalPrunedNodes(
172  	   SCIP_REOPT*           reopt               /**< reoptimization data structure */
173  	   );
174  	
175  	/** returns the number of reoptimized nodes that were cut off in the current run */
176  	SCIP_EXPORT
177  	int SCIPreoptGetNCutoffReoptnodes(
178  	   SCIP_REOPT*           reopt               /*< reoptimization data structure */
179  	   );
180  	
181  	/** returns the number of reoptimized nodes that were cut off over all runs */
182  	SCIP_EXPORT
183  	int SCIPreoptGetNTotalCutoffReoptnodes(
184  	   SCIP_REOPT*           reopt               /*< reoptimization data structure */
185  	   );
186  	
187  	/** returns the number of stored nodes with an infeasible LP in the current run */
188  	SCIP_EXPORT
189  	int SCIPreoptGetNInfNodes(
190  	   SCIP_REOPT*           reopt               /*< reoptimization data structure */
191  	   );
192  	
193  	/** returns the number of stored nodes with an infeasible LP over all runs */
194  	SCIP_EXPORT
195  	int SCIPreoptGetNTotalInfNodes(
196  	   SCIP_REOPT*           reopt               /*< reoptimization data structure */
197  	   );
198  	
199  	#ifdef NDEBUG
200  	
201  	/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
202  	 * speed up the algorithms.
203  	 */
204  	
205  	#define SCIPreoptnodeGetNVars(reoptnode)          (reoptnode->nvars)
206  	#define SCIPreoptnodeGetNConss(reoptnode)         (reoptnode->nconss)
207  	#define SCIPreoptnodeGetNDualBoundChgs(reoptnode) (reoptnode->dualconscur->nvars)
208  	#define SCIPreoptnodeGetNChildren(reoptnode)      (reoptnode->nchilds)
209  	#define SCIPreoptnodeGetLowerbound(reoptnode)     (reoptnode->lowerbound)
210  	#define SCIPreoptnodeGetType(reoptnode)           (reoptnode->reopttype)
211  	
212  	#define SCIPreoptGetNRestartsGlobal(reopt)        (reopt->nglbrestarts)
213  	#define SCIPreoptGetNRestartsLocal(reopt)         (reopt->nlocrestarts)
214  	#define SCIPreoptGetNTotalRestartsLocal(reopt)    (reopt->ntotallocrestarts)
215  	#define SCIPreoptGetFirstRestarts(reopt)          (reopt->firstrestart)
216  	#define SCIPreoptGetLastRestarts(reopt)           (reopt->lastrestart)
217  	#define SCIPreoptGetNFeasNodes(reopt)             (reopt->reopttree->nfeasnodes)
218  	#define SCIPreoptGetNTotalFeasNodes(reopt)        (reopt->reopttree->ntotalfeasnodes)
219  	#define SCIPreoptGetNPrunedNodes(reopt)           (reopt->reopttree->nprunednodes)
220  	#define SCIPreoptGetNTotalPrunedNodes(reopt)      (reopt->reopttree->ntotalprunednodes)
221  	#define SCIPreoptGetNCutoffReoptnodes(reopt)      (reopt->reopttree->ncutoffreoptnodes)
222  	#define SCIPreoptGetNTotalCutoffReoptnodes(reopt) (reopt->reopttree->ntotalcutoffreoptnodes)
223  	#define SCIPreoptGetNInfNodes(reopt)              (reopt->reopttree->ninfsubtrees)
224  	#define SCIPreoptGetNTotalInfNodes(reopt)         (reopt->reopttree->ntotalinfnodes)
225  	
226  	#endif
227  	
228  	#ifdef __cplusplus
229  	}
230  	#endif
231  	
232  	#endif
233