pub_reopt.h 8.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*                                                                           */
/*                  This file is part of the program and library             */
/*         SCIP --- Solving Constraint Integer Programs                      */
/*                                                                           */
/*    Copyright (C) 2002-2020 Konrad-Zuse-Zentrum                            */
/*                            fuer Informationstechnik Berlin                */
/*                                                                           */
/*  SCIP is distributed under the terms of the ZIB Academic License.         */
/*                                                                           */
/*  You should have received a copy of the ZIB Academic License              */
/*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
/*                                                                           */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/**@file   pub_reopt.h
 * @ingroup PUBLICCOREAPI
 * @brief  public methods for reoptimization
 * @author Jakob Witzig
 */

/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/

#ifndef __SCIP_PUB_REOPT_H__
#define __SCIP_PUB_REOPT_H__

#include "scip/def.h"
#include "scip/type_lp.h"
#include "scip/type_reopt.h"
#include "scip/type_var.h"

#ifdef NDEBUG
#include "scip/struct_reopt.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*
 * ReoptNode methods
 */

/** returns the number of bound changes stored in the reoptnode */
SCIP_EXPORT
int SCIPreoptnodeGetNVars(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
   );

/** returns the number of bound changes at the node stored at ID id */
SCIP_EXPORT
int SCIPreoptnodeGetNConss(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
   );

/** returns the number of stored bound changes based on dual information in the reopttree at ID id */
SCIP_EXPORT
int SCIPreoptnodeGetNDualBoundChgs(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
   );

/** returns the number of child nodes of @p reoptnode */
SCIP_EXPORT
int SCIPreoptnodeGetNChildren(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimizzation tree */
   );

/* return the lower bound stored at @p ID id */
SCIP_EXPORT
SCIP_Real SCIPreoptnodeGetLowerbound(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
   );

/** returns the type of the @p reoptnode */
SCIP_EXPORT
SCIP_REOPTTYPE SCIPreoptnodeGetType(
   SCIP_REOPTNODE*       reoptnode           /**< node of the reoptimization tree */
   );

/** create the constraint which splits the node stored at ID id on the basis of the stored dual information. */
SCIP_EXPORT
void SCIPreoptnodeGetSplitCons(
   SCIP_REOPTNODE*       reoptnode,          /**< node of the reoptimization tree */
   SCIP_VAR**            vars,               /**< array to store the variables of the constraint */
   SCIP_Real*            vals,               /**< array to store the coefficients of the variables */
   REOPT_CONSTYPE*       constype,           /**< type of the constraint */
   int                   conssize,           /**< size of the arrays */
   int*                  nvars               /**< pointer to store the size of the constraints */
   );

/** returns all added constraints at ID id */
SCIP_EXPORT
void SCIPreoptnodeGetConss(
   SCIP_REOPTNODE*       reoptnode,          /**< reoptimization data structure */
   SCIP_VAR***           vars,               /**< 2-dim array of variables */
   SCIP_Real**           bounds,             /**< 2-dim array of bounds */
   SCIP_BOUNDTYPE**      boundtypes,         /**< 2-dim array of boundtypes */
   int                   mem,                /**< allocated memory for constraints */
   int*                  nconss,             /**< pointer to store the number of constraints */
   int*                  nvars               /**< pointer to store the number of variables */
   );

/** set the parent id */
SCIP_EXPORT
void SCIPreoptnodeSetParentID(
   SCIP_REOPTNODE*       reoptnode,          /**< node of the reopttree */
   unsigned int          parentid            /**< id of the parent node */
   );

/*
 * Reopt methods
 */

/** returns the number of global restarts */
SCIP_EXPORT
int SCIPreoptGetNRestartsGlobal(
   SCIP_REOPT*           reopt               /**< reoptimization data */
   );

/** returns the number of local restarts in the current run */
int SCIPreoptGetNRestartsLocal(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of local restarts over all runs */
int SCIPreoptGetNTotalRestartsLocal(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of iteration with the first global restarts */
SCIP_EXPORT
int SCIPreoptGetFirstRestarts(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of iteration with the last global restarts */
SCIP_EXPORT
int SCIPreoptGetLastRestarts(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of nodes providing an improving feasible LP solution in the current run */
SCIP_EXPORT
int SCIPreoptGetNFeasNodes(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of nodes providing an improving feasible LP solution over all runs */
SCIP_EXPORT
int SCIPreoptGetNTotalFeasNodes(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of nodes that exceeded the cutoff bound in the current run */
SCIP_EXPORT
int SCIPreoptGetNPrunedNodes(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of nodes that exceeded the cutoff bound over all runs */
SCIP_EXPORT
int SCIPreoptGetNTotalPrunedNodes(
   SCIP_REOPT*           reopt               /**< reoptimization data structure */
   );

/** returns the number of reoptimized nodes that were cut off in the current run */
SCIP_EXPORT
int SCIPreoptGetNCutoffReoptnodes(
   SCIP_REOPT*           reopt               /*< reoptimization data structure */
   );

/** returns the number of reoptimized nodes that were cut off over all runs */
SCIP_EXPORT
int SCIPreoptGetNTotalCutoffReoptnodes(
   SCIP_REOPT*           reopt               /*< reoptimization data structure */
   );

/** returns the number of stored nodes with an infeasible LP in the current run */
SCIP_EXPORT
int SCIPreoptGetNInfNodes(
   SCIP_REOPT*           reopt               /*< reoptimization data structure */
   );

/** returns the number of stored nodes with an infeasible LP over all runs */
SCIP_EXPORT
int SCIPreoptGetNTotalInfNodes(
   SCIP_REOPT*           reopt               /*< reoptimization data structure */
   );

#ifdef NDEBUG

/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
 * speed up the algorithms.
 */

#define SCIPreoptnodeGetNVars(reoptnode)          (reoptnode->nvars)
#define SCIPreoptnodeGetNConss(reoptnode)         (reoptnode->nconss)
#define SCIPreoptnodeGetNDualBoundChgs(reoptnode) (reoptnode->dualconscur->nvars)
#define SCIPreoptnodeGetNChildren(reoptnode)      (reoptnode->nchilds)
#define SCIPreoptnodeGetLowerbound(reoptnode)     (reoptnode->lowerbound)
#define SCIPreoptnodeGetType(reoptnode)           (reoptnode->reopttype)

#define SCIPreoptGetNRestartsGlobal(reopt)        (reopt->nglbrestarts)
#define SCIPreoptGetNRestartsLocal(reopt)         (reopt->nlocrestarts)
#define SCIPreoptGetNTotalRestartsLocal(reopt)    (reopt->ntotallocrestarts)
#define SCIPreoptGetFirstRestarts(reopt)          (reopt->firstrestart)
#define SCIPreoptGetLastRestarts(reopt)           (reopt->lastrestart)
#define SCIPreoptGetNFeasNodes(reopt)             (reopt->reopttree->nfeasnodes)
#define SCIPreoptGetNTotalFeasNodes(reopt)        (reopt->reopttree->ntotalfeasnodes)
#define SCIPreoptGetNPrunedNodes(reopt)           (reopt->reopttree->nprunednodes)
#define SCIPreoptGetNTotalPrunedNodes(reopt)      (reopt->reopttree->ntotalprunednodes)
#define SCIPreoptGetNCutoffReoptnodes(reopt)      (reopt->reopttree->ncutoffreoptnodes)
#define SCIPreoptGetNTotalCutoffReoptnodes(reopt) (reopt->reopttree->ntotalcutoffreoptnodes)
#define SCIPreoptGetNInfNodes(reopt)              (reopt->reopttree->ninfsubtrees)
#define SCIPreoptGetNTotalInfNodes(reopt)         (reopt->reopttree->ntotalinfnodes)

#endif

#ifdef __cplusplus
}
#endif

#endif