Scippy

SCIP

Solving Constraint Integer Programs

struct_reopt.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2024 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 struct_reopt.h
26 * @ingroup INTERNALAPI
27 * @brief data structures for collecting reoptimization information
28 * @author Jakob Witzig
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_STRUCT_REOPT_H__
34#define __SCIP_STRUCT_REOPT_H__
35
36#include "scip/def.h"
37#include "scip/type_clock.h"
38#include "scip/type_cons.h"
39#include "scip/type_history.h"
40#include "scip/type_lp.h"
41#include "scip/type_misc.h"
42#include "scip/type_reopt.h"
43#include "scip/type_sol.h"
44#include "scip/type_var.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50/** nodes of SCIP_SolTree */
52{
53 SCIP_SOL* sol; /**< the stored solution */
54 SCIP_SOLNODE* father; /**< pointer to the parent node */
55 SCIP_SOLNODE* child; /**< pointer to left most child node, i.e., node representing the variable
56 * with smallest solution value
57 */
58 SCIP_SOLNODE* sibling; /**< pointer to next sibling node */
59 SCIP_Real value; /**< solution value represented by this node */
60 SCIP_Bool updated; /**< flag if the solution is already updated
61 * w.r.t. the new objective function */
62#ifndef NDEBUG
63 SCIP_VAR* var; /**< variable represented by this node */
64#endif
65};
66
67/** tree for solution */
69{
70 SCIP_SOLNODE*** sols; /**< array of arrays of solutions of the reoptimization runs */
71 SCIP_SOLNODE* root; /**< root node of the solution tree */
72 int* solssize; /**< size of sols[x] arrays */
73 int* nsols; /**< number of solutions stored in sols[x] array */
74};
75
76/** data for constraints to split nodes during reoptimization */
77struct SCIP_ReoptConsData
78{
79 SCIP_VAR** vars; /**< array of variables */
80 SCIP_Real* vals; /**< array of variable coefficients or bounds */
81 SCIP_BOUNDTYPE* boundtypes; /**< array of variable bounds */
82 SCIP_Real lhs; /**< left hand side of the constraint */
83 SCIP_Real rhs; /**< right hand side of the constraint */
84 REOPT_CONSTYPE constype; /**< type of the constraint */
85 SCIP_Bool linear; /**< TRUE, iff the constraint is linear, otherwise the constraint is of
86 * type bounddisjunction
87 */
88 int varssize; /**< available size in the arrays */
89 int nvars; /**< number of entries in the arrays */
90};
91
92/** nodes of SCIP_ReoptTree */
94{
95 SCIP_REOPTCONSDATA** conss; /**< array of constraints added to the node, i.e., logic-or constraints */
96 SCIP_VAR** vars; /**< variables along the branching path up to the next stored node */
97 SCIP_VAR** afterdualvars; /**< variables along the branching path after the first decision based on dual information */
98 SCIP_REOPTCONSDATA* dualredscur; /**< dual reductions that need to be reconstructed the current round */
99 SCIP_REOPTCONSDATA* dualredsnex; /**< dual reductions that need to be reconstructed the next round */
100 SCIP_BOUNDTYPE* varboundtypes; /**< boundtypes along the branching path up to the next stored node */
101 SCIP_BOUNDTYPE* afterdualvarboundtypes; /**< boundtypes along the branching path after the first dual information */
102 SCIP_Real* varbounds; /**< bounds along the branching path up to the next stored node */
103 SCIP_Real* afterdualvarbounds; /**< bounds along the branching path after the first decision based on dual information */
104 SCIP_Real lowerbound; /**< the last lowerbound of this node in the previous iteration */
105 SCIP_Bool dualreds; /**< flag whether dual reduction were performed */
106 int nvars; /**< number of branching decisions up to the next stored node */
107 int varssize; /**< size of allocated memory */
108 int nafterdualvars; /**< number of branching decisions after the first dual information */
109 int afterdualvarssize; /**< size of allocated memory */
110 int nchilds; /**< number of child nodes */
111 int allocchildmem; /**< allocated memory for child nodes */
112 int nconss; /**< number of added constraints */
113 int consssize; /**< allocated memory for constraints */
114 unsigned int* childids; /**< array of child nodes that need to be reoptimized */
115
116 unsigned int parentID:29; /**< id of the stored parent node */
117 unsigned int reopttype:3; /**< reason for storing the node */
118};
119
120/* tree to store the current search tree */
122{
123 SCIP_REOPTNODE** reoptnodes; /**< array of SCIP_REOPTNODE */
124 SCIP_QUEUE* openids; /**< queue of open positions in the reoptnodes array */
125 int nreoptnodes; /**< number of saved nodes */
126 int nfeasnodes; /**< number of feasible nodes in the current run */
127 int ntotalfeasnodes; /**< number of feasible nodes over all runs */
128 int ninfnodes; /**< number of (LP-)infeasible nodes in the current run */
129 int ntotalinfnodes; /**< number of (LP-)infeasible nodes over all runs */
130 int nprunednodes; /**< number of pruned nodes in the current run */
131 int ntotalprunednodes; /**< number of pruned nodes over all runs */
132 int ncutoffreoptnodes; /**< number of cut off reoptimized nodes in the current run */
133 int ntotalcutoffreoptnodes; /**< number of cut off reoptimized nodes over all runs */
134 SCIP_Bool initialized; /**< is the data structure initialized? */
135 unsigned int reoptnodessize; /**< size of allocated memory for the reoptnodes array and the openid queue */
136};
137
138/** reoptimization data and solution storage */
140{
141 SCIP_SOL** prevbestsols; /**< list of best solutions of all previous rounds */
142 SCIP_Real** objs; /**< list of objective coefficients */
143 SCIP_HISTORY*** varhistory; /**< collected variable history */
144 SCIP_REOPTCONSDATA** glbconss; /**< global constraints that need to be added at the beginning of the next iteration */
145 SCIP_REOPTCONSDATA* dualreds; /**< dual reductions that probably need to be reconstructed at this node */
146 SCIP_REOPTTREE* reopttree; /**< data structure to store the current reoptimization search tree */
147 SCIP_SOLTREE* soltree; /**< tree to handle all saved solutions */
148 SCIP_RANDNUMGEN* randnumgen; /**< random number generator */
149 SCIP_CLOCK* savingtime; /**< time needed to store the nodes */
150 SCIP_CONS** addedconss; /**< array of added constraints */
151 SCIP_Real simtolastobj; /**< similarity to the last objective function */
152 SCIP_Real simtofirstobj; /**< similarity to the first objective function */
153 SCIP_Longint lastbranched; /**< number of the last branched node */
154 SCIP_Longint lastseennode; /**< node number of the last caught event */
155 int nobjvars; /**< number of variables in the objective function */
156 int addedconsssize; /**< size of addedconss array */
157 int naddedconss; /**< number of constraints added */
158 SCIP_Bool objhaschanged; /**< TRUE iff the objective fucntion has changd */
159 SCIP_Bool consadded; /**< TRUE iff a constraint was added */
160 int nactiveconss; /**< number of active constraints stored in activeconss */
161 SCIP_CONS** activeconss; /**< storage for active constraints */
162 int nmaxactiveconss; /**< maximal number of active constraints stored in activeconss */
163
164 /* hashmaps to track global bound reductions and constraints deletion during presolving */
165 SCIP_HASHMAP* glblb; /**< global lower bounds after presolving of the first problem */
166 SCIP_HASHMAP* glbub; /**< global upper bounds after presolving of the first problem */
167 SCIP_HASHSET* activeconssset; /**< set of all active constraints after presolving the first problem */
168
169 /* data structure to track decisions based on dual information */
170 SCIP_Longint currentnode; /**< number of the current node */
171 int run; /**< number of the current reoptimization run */
172 int runsize; /**< allocated memory for runs */
173 int firstobj; /**< first non empty objective function */
174 int noptsolsbyreoptsol; /**< number of successive optimal solutions found by heur_reoptsols */
175 int nglbconss; /**< number of stored global constraints */
176 int allocmemglbconss; /**< allocated memory for global constraints */
177 int ncheckedsols; /**< number of updated solutions by reoptsols */
178 int nimprovingsols; /**< number of improving solutions found by reoptsols */
179 int nglbrestarts; /**< number of global restarts */
180 int ntotallocrestarts; /**< number of local restarts over all runs */
181 int nlocrestarts; /**< number of local restarts in the current iteration */
182 int firstrestart; /**< run with the first global restart or -1 of no restart */
183 int lastrestart; /**< run with the last global restart or -1 if no restart */
184};
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif
common defines and data types used in all packages of SCIP
#define SCIP_Longint
Definition: def.h:157
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:172
SCIP_VAR ** afterdualvars
Definition: struct_reopt.h:97
SCIP_REOPTCONSDATA * dualredscur
Definition: struct_reopt.h:98
SCIP_REOPTCONSDATA * dualredsnex
Definition: struct_reopt.h:99
SCIP_BOUNDTYPE * afterdualvarboundtypes
Definition: struct_reopt.h:101
SCIP_BOUNDTYPE * varboundtypes
Definition: struct_reopt.h:100
unsigned int * childids
Definition: struct_reopt.h:114
SCIP_Bool dualreds
Definition: struct_reopt.h:105
SCIP_VAR ** vars
Definition: struct_reopt.h:96
SCIP_Real * afterdualvarbounds
Definition: struct_reopt.h:103
SCIP_REOPTCONSDATA ** conss
Definition: struct_reopt.h:95
SCIP_Real lowerbound
Definition: struct_reopt.h:104
unsigned int parentID
Definition: struct_reopt.h:116
unsigned int reopttype
Definition: struct_reopt.h:117
SCIP_Real * varbounds
Definition: struct_reopt.h:102
SCIP_QUEUE * openids
Definition: struct_reopt.h:124
unsigned int reoptnodessize
Definition: struct_reopt.h:135
SCIP_REOPTNODE ** reoptnodes
Definition: struct_reopt.h:123
int ntotalcutoffreoptnodes
Definition: struct_reopt.h:133
SCIP_Bool initialized
Definition: struct_reopt.h:134
int firstrestart
Definition: struct_reopt.h:182
int nimprovingsols
Definition: struct_reopt.h:178
SCIP_REOPTCONSDATA ** glbconss
Definition: struct_reopt.h:144
SCIP_Bool consadded
Definition: struct_reopt.h:159
int nactiveconss
Definition: struct_reopt.h:160
SCIP_SOL ** prevbestsols
Definition: struct_reopt.h:141
SCIP_REOPTTREE * reopttree
Definition: struct_reopt.h:146
SCIP_REOPTCONSDATA * dualreds
Definition: struct_reopt.h:145
int nglbrestarts
Definition: struct_reopt.h:179
SCIP_SOLTREE * soltree
Definition: struct_reopt.h:147
SCIP_Longint lastbranched
Definition: struct_reopt.h:153
int nlocrestarts
Definition: struct_reopt.h:181
int ntotallocrestarts
Definition: struct_reopt.h:180
int noptsolsbyreoptsol
Definition: struct_reopt.h:174
int nmaxactiveconss
Definition: struct_reopt.h:162
SCIP_RANDNUMGEN * randnumgen
Definition: struct_reopt.h:148
SCIP_CLOCK * savingtime
Definition: struct_reopt.h:149
SCIP_HASHMAP * glblb
Definition: struct_reopt.h:165
SCIP_Longint lastseennode
Definition: struct_reopt.h:154
SCIP_CONS ** activeconss
Definition: struct_reopt.h:161
SCIP_Longint currentnode
Definition: struct_reopt.h:170
SCIP_HASHSET * activeconssset
Definition: struct_reopt.h:167
SCIP_HISTORY *** varhistory
Definition: struct_reopt.h:143
SCIP_Bool objhaschanged
Definition: struct_reopt.h:158
SCIP_Real simtofirstobj
Definition: struct_reopt.h:152
SCIP_Real ** objs
Definition: struct_reopt.h:142
int addedconsssize
Definition: struct_reopt.h:156
SCIP_CONS ** addedconss
Definition: struct_reopt.h:150
int ncheckedsols
Definition: struct_reopt.h:177
SCIP_HASHMAP * glbub
Definition: struct_reopt.h:166
int allocmemglbconss
Definition: struct_reopt.h:176
SCIP_Real simtolastobj
Definition: struct_reopt.h:151
SCIP_SOL * sol
Definition: struct_reopt.h:53
SCIP_VAR * var
Definition: struct_reopt.h:63
SCIP_Real value
Definition: struct_reopt.h:59
SCIP_SOLNODE * child
Definition: struct_reopt.h:55
SCIP_SOLNODE * father
Definition: struct_reopt.h:54
SCIP_SOLNODE * sibling
Definition: struct_reopt.h:58
SCIP_Bool updated
Definition: struct_reopt.h:60
SCIP_SOLNODE * root
Definition: struct_reopt.h:71
SCIP_SOLNODE *** sols
Definition: struct_reopt.h:70
int * solssize
Definition: struct_reopt.h:72
type definitions for clocks and timing issues
type definitions for constraints and constraint handlers
type definitions for branching and inference history
type definitions for LP management
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:59
type definitions for miscellaneous datastructures
type definitions for collecting reoptimization information
struct SCIP_ReoptConsData SCIP_REOPTCONSDATA
Definition: type_reopt.h:51
enum Reopt_ConsType REOPT_CONSTYPE
Definition: type_reopt.h:76
type definitions for storing primal CIP solutions
type definitions for problem variables