Scippy

SCIP

Solving Constraint Integer Programs

sepa_rapidlearning.c
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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file sepa_rapidlearning.c
17  * @brief rapidlearning separator
18  * @author Timo Berthold
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 #ifndef NDEBUG
25 #include <string.h>
26 #endif
27 
29 #include "scip/scipdefplugins.h"
30 #include "scip/pub_var.h"
31 
32 #define SEPA_NAME "rapidlearning"
33 #define SEPA_DESC "rapid learning heuristic and separator"
34 #define SEPA_PRIORITY -1200000
35 #define SEPA_FREQ -1
36 #define SEPA_MAXBOUNDDIST 1.0
37 #define SEPA_USESSUBSCIP TRUE /**< does the separator use a secondary SCIP instance? */
38 #define SEPA_DELAY FALSE /**< should separation method be delayed, if other separators found cuts? */
39 
40 #define DEFAULT_APPLYCONFLICTS TRUE /**< should the found conflicts be applied in the original SCIP? */
41 #define DEFAULT_APPLYBDCHGS TRUE /**< should the found global bound deductions be applied in the original SCIP?
42  * apply only if conflicts and incumbent solution will be copied too
43  */
44 #define DEFAULT_APPLYINFERVALS TRUE /**< should the inference values be used as initialization in the original SCIP? */
45 #define DEFAULT_REDUCEDINFER FALSE /**< should the inference values only be used when rapid learning found other reductions? */
46 #define DEFAULT_APPLYPRIMALSOL TRUE /**< should the incumbent solution be copied to the original SCIP? */
47 #define DEFAULT_APPLYSOLVED TRUE /**< should a solved status be copied to the original SCIP? */
48 
49 #define DEFAULT_MAXNVARS 10000 /**< maximum problem size (variables) for which rapid learning will be called */
50 #define DEFAULT_MAXNCONSS 10000 /**< maximum problem size (constraints) for which rapid learning will be called */
51 
52 #define DEFAULT_MINNODES 500 /**< minimum number of nodes considered in rapid learning run */
53 #define DEFAULT_MAXNODES 5000 /**< maximum number of nodes considered in rapid learning run */
54 
55 #define DEFAULT_CONTVARS FALSE /**< should rapid learning be applied when there are continuous variables? */
56 #define DEFAULT_CONTVARSQUOT 0.3 /**< maximal portion of continuous variables to apply rapid learning */
57 #define DEFAULT_LPITERQUOT 0.2 /**< maximal fraction of LP iterations compared to node LP iterations */
58 #define DEFAULT_COPYCUTS TRUE /**< should all active cuts from the cutpool of the
59  * original scip be copied to constraints of the subscip
60  */
61 
62 
63 /*
64  * Data structures
65  */
66 
67 /** separator data */
68 struct SCIP_SepaData
69 {
70  SCIP_Bool applyconflicts; /**< should the found conflicts be applied in the original SCIP? */
71  SCIP_Bool applybdchgs; /**< should the found global bound deductions be applied in the original SCIP? */
72  SCIP_Bool applyinfervals; /**< should the inference values be used as initialization in the original SCIP? */
73  SCIP_Bool reducedinfer; /**< should the inference values only be used when rapid learning found other reductions? */
74  SCIP_Bool applyprimalsol; /**< should the incumbent solution be copied to the original SCIP? */
75  SCIP_Bool applysolved; /**< should a solved status ba copied to the original SCIP? */
76  int maxnvars; /**< maximum problem size (variables) for which rapid learning will be called */
77  int maxnconss; /**< maximum problem size (constraints) for which rapid learning will be called */
78  int minnodes; /**< minimum number of nodes considered in rapid learning run */
79  int maxnodes; /**< maximum number of nodes considered in rapid learning run */
80  SCIP_Bool contvars; /**< should rapid learning be applied when there are continuous variables? */
81  SCIP_Real contvarsquot; /**< maximal portion of continuous variables to apply rapid learning */
82  SCIP_Real lpiterquot; /**< maximal fraction of LP iterations compared to node LP iterations */
83  SCIP_Bool copycuts; /**< should all active cuts from cutpool be copied to constraints in
84  * subproblem?
85  */
86 };
87 
88 /** creates a new solution for the original problem by copying the solution of the subproblem */
89 static
91  SCIP* scip, /**< original SCIP data structure */
92  SCIP* subscip, /**< SCIP structure of the subproblem */
93  SCIP_VAR** subvars, /**< the variables of the subproblem */
94  SCIP_HEUR* heur, /**< trysol heuristic structure */
95  SCIP_SOL* subsol, /**< solution of the subproblem */
96  SCIP_Bool* success /**< used to store whether new solution was found or not */
97  )
98 {
99  SCIP_VAR** vars; /* the original problem's variables */
100  int nvars;
101  SCIP_Real* subsolvals; /* solution values of the subproblem */
102  SCIP_SOL* newsol; /* solution to be created for the original problem */
103 
104  assert( scip != NULL );
105  assert( subscip != NULL );
106  assert( subvars != NULL );
107  assert( heur != NULL );
108  assert( subsol != NULL );
109  assert( success != NULL );
110 
111  /* get variables' data */
112  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
113  /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
114  * since constraint copying may have required the copy of variables that are fixed in the main SCIP
115  */
116  assert(nvars <= SCIPgetNOrigVars(subscip));
117 
118  SCIP_CALL( SCIPallocBufferArray(scip, &subsolvals, nvars) );
119 
120  /* copy the solution */
121  SCIP_CALL( SCIPgetSolVals(subscip, subsol, nvars, subvars, subsolvals) );
122 
123  /* create new solution for the original problem */
124  SCIP_CALL( SCIPcreateSol(scip, &newsol, heur) );
125  SCIP_CALL( SCIPsetSolVals(scip, newsol, nvars, vars, subsolvals) );
126 
127  /* check feasibility of new solution and pass it to trysol heuristic */
128  SCIP_CALL( SCIPtrySolFree(scip, &newsol, FALSE, FALSE, TRUE, TRUE, TRUE, success) );
129 
130  SCIPfreeBufferArray(scip, &subsolvals);
131 
132  return SCIP_OKAY;
133 }
134 
135 /*
136  * Callback methods of separator
137  */
138 
139 /** copy method for separator plugins (called when SCIP copies plugins) */
140 static
141 SCIP_DECL_SEPACOPY(sepaCopyRapidlearning)
142 { /*lint --e{715}*/
143  assert(scip != NULL);
144  assert(sepa != NULL);
145  assert(strcmp(SCIPsepaGetName(sepa), SEPA_NAME) == 0);
146 
147  /* call inclusion method of constraint handler */
149 
150  return SCIP_OKAY;
151 }
152 
153 /** destructor of separator to free user data (called when SCIP is exiting) */
154 static
155 SCIP_DECL_SEPAFREE(sepaFreeRapidlearning)
156 { /*lint --e{715}*/
157  SCIP_SEPADATA* sepadata;
158 
159  assert(sepa != NULL);
160  assert(strcmp(SCIPsepaGetName(sepa), SEPA_NAME) == 0);
161  assert(scip != NULL);
162 
163  /* free separator data */
164  sepadata = SCIPsepaGetData(sepa);
165  assert(sepadata != NULL);
166  SCIPfreeBlockMemory(scip, &sepadata);
167  SCIPsepaSetData(sepa, NULL);
168 
169  return SCIP_OKAY;
170 }
171 
172 
173 /** setup and solve sub-SCIP */
174 static
176  SCIP* scip, /**< SCIP data structure */
177  SCIP* subscip, /**< subSCIP data structure */
178  SCIP_SEPADATA* sepadata, /**< separator data */
179  SCIP_RESULT* result /**< result pointer */
180  )
181 {
182  SCIP_VAR** vars; /* original problem's variables */
183  SCIP_VAR** subvars; /* subproblem's variables */
184  SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
185  SCIP_HASHMAP* varmapbw = NULL; /* mapping of sub-SCIP variables to SCIP variables */
186 
187  SCIP_CONSHDLR** conshdlrs = NULL; /* array of constraint handler's that might that might obtain conflicts */
188  int* oldnconss = NULL; /* number of constraints without rapid learning conflicts */
189 
190  SCIP_Longint nodelimit; /* node limit for the subproblem */
191 
192  int nconshdlrs; /* size of conshdlr and oldnconss array */
193  int nfixedvars; /* number of variables that could be fixed by rapid learning */
194  int nvars; /* number of variables */
195  int restartnum; /* maximal number of conflicts that should be created */
196  int i; /* counter */
197 
198  SCIP_Bool success; /* was problem creation / copying constraint successful? */
199 
200  int nconflicts; /* statistic: number of conflicts applied */
201  int nbdchgs; /* statistic: number of bound changes applied */
202  int n1startinfers; /* statistic: number of one side infer values */
203  int n2startinfers; /* statistic: number of both side infer values */
204 
205  SCIP_Bool soladded = FALSE; /* statistic: was a new incumbent found? */
206  SCIP_Bool dualboundchg; /* statistic: was a new dual bound found? */
207  SCIP_Bool disabledualreductions; /* TRUE, if dual reductions in sub-SCIP are not valid for original SCIP,
208  * e.g., because a constraint could not be copied or a primal solution
209  * could not be copied back
210  */
211  SCIP_Bool valid;
212 
213  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
214 
215  /* initializing the subproblem */
216  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
217  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), nvars) );
218  valid = FALSE;
219 
220  /* copy the subproblem */
221  SCIP_CALL( SCIPcopyConsCompression(scip, subscip, varmapfw, NULL, "rapid", NULL, NULL, 0, FALSE, FALSE, TRUE, &valid) );
222 
223  if( sepadata->copycuts )
224  {
225  /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
226  SCIP_CALL( SCIPcopyCuts(scip, subscip, varmapfw, NULL, FALSE, NULL) );
227  }
228 
229  for( i = 0; i < nvars; i++ )
230  {
231  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
232 
233  /* change implicit integer variables to integer type */
234  if( SCIPvarGetType(subvars[i]) == SCIP_VARTYPE_IMPLINT )
235  {
236  SCIP_Bool infeasible;
237 
238  SCIP_CALL( SCIPchgVarType(subscip, subvars[i], SCIP_VARTYPE_INTEGER, &infeasible) );
239  assert(!infeasible);
240  }
241 
242  /* skip the heuristic when the sub-SCIP contains an integer variable with an infinite bound in direction of the
243  * objective function; this might lead to very bad branching decisions when enforcing a pseudo solution (#1439)
244  */
245  if( SCIPvarGetType(subvars[i]) <= SCIP_VARTYPE_INTEGER )
246  {
247  SCIP_Real lb = SCIPvarGetLbLocal(subvars[i]);
248  SCIP_Real ub = SCIPvarGetUbLocal(subvars[i]);
249  SCIP_Real obj = SCIPvarGetObj(subvars[i]);
250 
251  if( (SCIPisNegative(subscip, obj) && SCIPisInfinity(subscip, ub))
252  || (SCIPisPositive(subscip, obj) && SCIPisInfinity(subscip, -lb)) )
253  {
254  /* free local hash map */
255  SCIPhashmapFree(&varmapfw);
256 
257  SCIPdebugMsg(scip, "unbounded integer variable %s (in [%g,%g]) with objective %g -> skip heuristic\n",
258  SCIPvarGetName(subvars[i]), lb, ub, obj);
259  goto TERMINATE;
260  }
261  }
262  }
263 
264  SCIPhashmapFree(&varmapfw);
265 
266  /* This avoids dual presolving.
267  *
268  * If the copy is not valid, it should be a relaxation of the problem (constraints might have failed to be copied,
269  * but no variables should be missing because we stop earlier anyway if pricers are present).
270  * By disabling dual presolving, conflicts found in a relaxation are still valid for the original problem.
271  */
272  if( ! valid )
273  {
274  for( i = 0; i < nvars; i++ )
275  {
276  SCIP_CALL( SCIPaddVarLocksType(subscip, subvars[i], SCIP_LOCKTYPE_MODEL, 1, 1 ) );
277  }
278  }
279 
280  SCIPdebugMsg(scip, "Copying SCIP was%s valid.\n", valid ? "" : " not");
281 
282  /* mimic an FD solver: DFS, no LP solving, 1-FUIP instead of all-FUIP */
283  if( SCIPisParamFixed(subscip, "lp/solvefreq") )
284  {
285  SCIPwarningMessage(scip, "unfixing parameter lp/solvefreq in subscip of rapidlearning\n");
286  SCIP_CALL( SCIPunfixParam(subscip, "lp/solvefreq") );
287  }
288  SCIP_CALL( SCIPsetIntParam(subscip, "lp/solvefreq", -1) );
289  if( !SCIPisParamFixed(subscip, "conflict/fuiplevels") )
290  {
291  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/fuiplevels", 1) );
292  }
293  if( SCIPisParamFixed(subscip, "nodeselection/dfs/stdpriority") )
294  {
295  SCIPwarningMessage(scip, "unfixing parameter nodeselection/dfs/stdpriority in subscip of rapidlearning\n");
296  SCIP_CALL( SCIPunfixParam(subscip, "nodeselection/dfs/stdpriority") );
297  }
298  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/dfs/stdpriority", INT_MAX/4) );
299 
300  if( !SCIPisParamFixed(subscip, "propagating/pseudoobj/freq") )
301  {
302  SCIP_CALL( SCIPsetIntParam(subscip, "propagating/pseudoobj/freq", -1) );
303  }
304  if( !SCIPisParamFixed(subscip, "constraints/disableenfops") )
305  {
306  SCIP_CALL( SCIPsetBoolParam(subscip, "constraints/disableenfops", TRUE) );
307  }
308 
309  /* use inference branching */
310  if( !SCIPisParamFixed(subscip, "branching/inference/useweightedsum") )
311  {
312  SCIP_CALL( SCIPsetBoolParam(subscip, "branching/inference/useweightedsum", FALSE) );
313  }
314 
315  /* only create short conflicts */
316  if( !SCIPisParamFixed(subscip, "conflict/maxvarsfac") )
317  {
318  SCIP_CALL( SCIPsetRealParam(subscip, "conflict/maxvarsfac", 0.05) );
319  }
320 
321  /* set limits for the subproblem */
322  nodelimit = SCIPgetNLPIterations(scip);
323  nodelimit = MAX(sepadata->minnodes, nodelimit);
324  nodelimit = MIN(sepadata->maxnodes, nodelimit);
325 
326  restartnum = 1000;
327 
328  #ifdef SCIP_DEBUG
329  /* for debugging, enable full output */
330  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
331  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
332  #else
333  /* disable statistic timing inside sub SCIP and output to console */
334  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
335  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
336  #endif
337 
338  /* set limits for the subproblem */
339  SCIP_CALL( SCIPcopyLimits(scip, subscip) );
340  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit/5) );
341  SCIP_CALL( SCIPsetIntParam(subscip, "limits/restarts", 0) );
342  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/restartnum", restartnum) );
343 
344  /* forbid recursive call of heuristics and separators solving subMIPs */
345  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
346 
347  /* disable cutting plane separation */
349 
350  /* disable expensive presolving */
352 
353  /* do not abort subproblem on CTRL-C */
354  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
355 
356  /* add an objective cutoff */
357  SCIP_CALL( SCIPsetObjlimit(subscip, SCIPgetUpperbound(scip)) );
358 
359  /* create the variable mapping hash map */
360  SCIP_CALL( SCIPhashmapCreate(&varmapbw, SCIPblkmem(scip), nvars) );
361 
362  /* store reversing mapping of variables */
363  SCIP_CALL( SCIPtransformProb(subscip) );
364  for( i = 0; i < nvars; ++i)
365  {
366  SCIP_CALL( SCIPhashmapInsert(varmapbw, SCIPvarGetTransVar(subvars[i]), vars[i]) );
367  }
368 
369  /* allocate memory for constraints storage. Each constraint that will be created from now on will be a conflict.
370  * Therefore, we need to remember oldnconss to get the conflicts from the FD search.
371  */
372  nconshdlrs = 4;
373  SCIP_CALL( SCIPallocBufferArray(scip, &conshdlrs, nconshdlrs) );
374  SCIP_CALL( SCIPallocBufferArray(scip, &oldnconss, nconshdlrs) );
375 
376  /* store number of constraints before rapid learning search */
377  conshdlrs[0] = SCIPfindConshdlr(subscip, "bounddisjunction");
378  conshdlrs[1] = SCIPfindConshdlr(subscip, "setppc");
379  conshdlrs[2] = SCIPfindConshdlr(subscip, "linear");
380  conshdlrs[3] = SCIPfindConshdlr(subscip, "logicor");
381 
382  /* redundant constraints might be eliminated in presolving */
383  SCIP_CALL( SCIPpresolve(subscip));
384 
385  for( i = 0; i < nconshdlrs; ++i)
386  {
387  if( conshdlrs[i] != NULL )
388  oldnconss[i] = SCIPconshdlrGetNConss(conshdlrs[i]);
389  }
390 
391  nfixedvars = SCIPgetNFixedVars(scip);
392 
393  /* solve the subproblem, abort after errors in debug mode */
394  SCIP_CALL_ABORT( SCIPsolve(subscip) );
395 
396  /* if problem was already solved do not increase limits to run again */
397  if( SCIPgetStage(subscip) == SCIP_STAGE_SOLVED )
398  {
399  SCIPdebugMsg(scip, "Subscip was completely solved, status %d.\n", SCIPgetStatus(subscip));
400  }
401  /* abort solving, if limit of applied conflicts is reached */
402  else if( SCIPgetNConflictConssApplied(subscip) >= restartnum )
403  {
404  SCIPdebugMsg(scip, "finish after %" SCIP_LONGINT_FORMAT " successful conflict calls.\n", SCIPgetNConflictConssApplied(subscip));
405  }
406  /* if the first 20% of the solution process were successful, proceed */
407  else if( (sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPisFeasLT(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
408  || (sepadata->applybdchgs && SCIPgetNFixedVars(subscip) > nfixedvars)
409  || (sepadata->applyconflicts && SCIPgetNConflictConssApplied(subscip) > 0) )
410  {
411  SCIPdebugMsg(scip, "proceed solving after the first 20%% of the solution process, since:\n");
412 
413  if( SCIPgetNSols(subscip) > 0 && SCIPisFeasLE(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
414  {
415  SCIPdebugMsg(scip, " - there was a better solution (%f < %f)\n",SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip));
416  }
417  if( SCIPgetNFixedVars(subscip) > nfixedvars )
418  {
419  SCIPdebugMsg(scip, " - there were %d variables fixed\n", SCIPgetNFixedVars(scip)-nfixedvars );
420  }
421  if( SCIPgetNConflictConssFound(subscip) > 0 )
422  {
423  SCIPdebugMsg(scip, " - there were %" SCIP_LONGINT_FORMAT " conflict constraints created\n", SCIPgetNConflictConssApplied(subscip));
424  }
425 
426  /* set node limit to 100% */
427  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit) );
428 
429  /* solve the subproblem, abort after errors in debug mode */
430  SCIP_CALL_ABORT( SCIPsolve(subscip) );
431  }
432  else
433  {
434  SCIPdebugMsg(scip, "do not proceed solving after the first 20%% of the solution process.\n");
435  }
436 
437  #ifdef SCIP_DEBUG
438  SCIP_CALL( SCIPprintStatistics(subscip, NULL) );
439  #endif
440 
441  disabledualreductions = FALSE;
442 
443  /* check, whether a solution was found */
444  if( sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPfindHeur(scip, "trysol") != NULL )
445  {
446  SCIP_HEUR* heurtrysol;
447  SCIP_SOL** subsols;
448  int nsubsols;
449 
450  /* check, whether a solution was found;
451  * due to numerics, it might happen that not all solutions are feasible -> try all solutions until was declared to be feasible
452  */
453  nsubsols = SCIPgetNSols(subscip);
454  subsols = SCIPgetSols(subscip);
455  soladded = FALSE;
456  heurtrysol = SCIPfindHeur(scip, "trysol");
457 
458  /* sequentially add solutions to trysol heuristic */
459  for( i = 0; i < nsubsols && !soladded; ++i )
460  {
461  SCIPdebugMsg(scip, "Try to create new solution by copying subscip solution.\n");
462  SCIP_CALL( createNewSol(scip, subscip, subvars, heurtrysol, subsols[i], &soladded) );
463  }
464  if( !soladded || !SCIPisEQ(scip, SCIPgetSolOrigObj(subscip, subsols[i-1]), SCIPgetSolOrigObj(subscip, subsols[0])) )
465  disabledualreductions = TRUE;
466  }
467 
468  /* if the sub problem was solved completely, we update the dual bound */
469  dualboundchg = FALSE;
470  if( sepadata->applysolved && !disabledualreductions
472  {
473  /* we need to multiply the dualbound with the scaling factor and add the offset,
474  * because this information has been disregarded in the sub-SCIP
475  */
476  SCIPdebugMsg(scip, "Update old dualbound %g to new dualbound %g.\n", SCIPgetDualbound(scip), SCIPretransformObj(scip, SCIPgetDualbound(subscip)));
477 
479  dualboundchg = TRUE;
480  }
481 
482  /* check, whether conflicts were created */
483  nconflicts = 0;
484  if( sepadata->applyconflicts && !disabledualreductions && SCIPgetNConflictConssApplied(subscip) > 0 )
485  {
486  SCIP_HASHMAP* consmap;
487  int hashtablesize;
488 
489  assert(SCIPgetNConflictConssApplied(subscip) < (SCIP_Longint) INT_MAX);
490  hashtablesize = (int) SCIPgetNConflictConssApplied(subscip);
491  assert(hashtablesize < INT_MAX/5);
492 
493  /* create the variable mapping hash map */
494  SCIP_CALL( SCIPhashmapCreate(&consmap, SCIPblkmem(scip), hashtablesize) );
495 
496  /* loop over all constraint handlers that might contain conflict constraints */
497  for( i = 0; i < nconshdlrs; ++i)
498  {
499  /* copy constraints that have been created in FD run */
500  if( conshdlrs[i] != NULL && SCIPconshdlrGetNConss(conshdlrs[i]) > oldnconss[i] )
501  {
502  SCIP_CONS** conss;
503  int c;
504  int nconss;
505 
506  nconss = SCIPconshdlrGetNConss(conshdlrs[i]);
507  conss = SCIPconshdlrGetConss(conshdlrs[i]);
508 
509  /* loop over all constraints that have been added in sub-SCIP run, these are the conflicts */
510  for( c = oldnconss[i]; c < nconss; ++c)
511  {
512  SCIP_CONS* cons;
513  SCIP_CONS* conscopy;
514 
515  cons = conss[c];
516  assert(cons != NULL);
517 
518  success = FALSE;
519 
520  /* @todo assert that flags are as they should be for conflicts */
521  SCIP_CALL( SCIPgetConsCopy(subscip, scip, cons, &conscopy, conshdlrs[i], varmapbw, consmap, NULL,
524  SCIPconsIsRemovable(cons), FALSE, TRUE, &success) );
525 
526  if( success )
527  {
528  nconflicts++;
529  SCIP_CALL( SCIPaddCons(scip, conscopy) );
530  SCIP_CALL( SCIPreleaseCons(scip, &conscopy) );
531  }
532  else
533  {
534  SCIPdebugMsg(scip, "failed to copy conflict constraint %s back to original SCIP\n", SCIPconsGetName(cons));
535  }
536  }
537  }
538  }
539  SCIPhashmapFree(&consmap);
540  }
541 
542  /* check, whether tighter global bounds were detected */
543  nbdchgs = 0;
544  if( sepadata->applybdchgs && !disabledualreductions )
545  for( i = 0; i < nvars; ++i )
546  {
547  SCIP_Bool infeasible;
548  SCIP_Bool tightened;
549 
550  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetLbGlobal(subvars[i])));
551  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(subvars[i]), SCIPvarGetUbGlobal(subvars[i])));
552  assert(SCIPisLE(scip, SCIPvarGetUbGlobal(subvars[i]), SCIPvarGetUbGlobal(vars[i])));
553 
554  /* update the bounds of the original SCIP, if a better bound was proven in the sub-SCIP */
555  /* @todo handle infeasible pointer? can it be set to TRUE? */
556  SCIP_CALL( SCIPtightenVarUb(scip, vars[i], SCIPvarGetUbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
557  if( tightened )
558  nbdchgs++;
559 
560  SCIP_CALL( SCIPtightenVarLb(scip, vars[i], SCIPvarGetLbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
561  if( tightened )
562  nbdchgs++;
563  }
564 
565  n1startinfers = 0;
566  n2startinfers = 0;
567 
568  /* install start values for inference branching */
569  /* @todo use different nbranching counters for pseudo cost and inference values and update inference values in the tree */
570  if( sepadata->applyinfervals && SCIPgetDepth(scip) == 0 && (!sepadata->reducedinfer || soladded || nbdchgs+nconflicts > 0) )
571  {
572  for( i = 0; i < nvars; ++i )
573  {
574  SCIP_Real downinfer;
575  SCIP_Real upinfer;
576  SCIP_Real downvsids;
577  SCIP_Real upvsids;
578  SCIP_Real downconflen;
579  SCIP_Real upconflen;
580 
581  /* copy downwards branching statistics */
582  downvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
583  downconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
584  downinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
585 
586  /* copy upwards branching statistics */
587  upvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
588  upconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
589  upinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
590 
591  /* memorize statistics */
592  if( downinfer+downconflen+downvsids > 0.0 || upinfer+upconflen+upvsids != 0 )
593  n1startinfers++;
594 
595  if( downinfer+downconflen+downvsids > 0.0 && upinfer+upconflen+upvsids != 0 )
596  n2startinfers++;
597 
598  SCIP_CALL( SCIPinitVarBranchStats(scip, vars[i], 0.0, 0.0, downvsids, upvsids, downconflen, upconflen, downinfer, upinfer, 0.0, 0.0) );
599  }
600  }
601 
602  SCIPdebugMsg(scip, "Rapidlearning added %d conflicts, changed %d bounds, %s primal solution, %s dual bound improvement.\n",
603  nconflicts, nbdchgs, soladded ? "found" : "no", dualboundchg ? "found" : "no");
604 
605  SCIPdebugMsg(scip, "YYY Infervalues initialized on one side: %5.2f %% of variables, %5.2f %% on both sides\n",
606  100.0 * n1startinfers/(SCIP_Real)nvars, 100.0 * n2startinfers/(SCIP_Real)nvars);
607 
608  /* change result pointer */
609  if( nconflicts > 0 || dualboundchg )
610  *result = SCIP_CONSADDED;
611  else if( nbdchgs > 0 )
612  *result = SCIP_REDUCEDDOM;
613 
614  /* free local data */
615  assert(oldnconss != NULL);
616  assert(conshdlrs != NULL);
617  assert(varmapbw != NULL);
618  SCIPfreeBufferArray(scip, &oldnconss);
619  SCIPfreeBufferArray(scip, &conshdlrs);
620  SCIPhashmapFree(&varmapbw);
621 
622  TERMINATE:
623 
624  /* we are in SCIP_STAGE_SOLVED, so we need to free the transformed problem before releasing the locks */
625  SCIP_CALL( SCIPfreeTransform(subscip) );
626 
627  /* remove all locks that were added to avoid dual presolving */
628  for( i = 0; i < nvars; i++ )
629  {
630  SCIP_CALL( SCIPaddVarLocksType(subscip, subvars[i], SCIP_LOCKTYPE_MODEL, -1, -1 ) );
631  }
632 
633  /* free subproblem */
634  SCIPfreeBufferArray(scip, &subvars);
635 
636  return SCIP_OKAY;
637 }
638 
639 /** LP solution separation method of separator */
640 static
641 SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning)
642 {/*lint --e{715}*/
643  SCIP* subscip; /* the subproblem created by rapid learning */
644  SCIP_SEPADATA* sepadata; /* separator's private data */
645  int ndiscvars;
646  SCIP_Bool success;
647  SCIP_RETCODE retcode;
648 
649  assert(sepa != NULL);
650  assert(scip != NULL);
651  assert(result != NULL);
652 
653  *result = SCIP_DIDNOTRUN;
654 
655  ndiscvars = SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip) + SCIPgetNImplVars(scip);
656 
657  /* only run when still not fixed binary variables exists */
658  if( ndiscvars == 0 )
659  return SCIP_OKAY;
660 
661  /* get separator's data */
662  sepadata = SCIPsepaGetData(sepa);
663  assert(sepadata != NULL);
664 
665  /* only run for integer programs */
666  if( !sepadata->contvars && ndiscvars != SCIPgetNVars(scip) )
667  return SCIP_OKAY;
668 
669  /* only run if there are few enough continuous variables */
670  if( sepadata->contvars && SCIPgetNContVars(scip) > sepadata->contvarsquot * SCIPgetNVars(scip) )
671  return SCIP_OKAY;
672 
673  /* do not run if pricers are present */
674  if( SCIPgetNActivePricers(scip) > 0 )
675  return SCIP_OKAY;
676 
677  /* if the separator should be exclusive to the root node, this prevents multiple calls due to restarts */
678  if( SCIPsepaGetFreq(sepa) == 0 && SCIPsepaGetNCalls(sepa) > 0 )
679  return SCIP_OKAY;
680 
681  /* call separator at most once per node */
682  if( SCIPsepaGetNCallsAtNode(sepa) > 0 )
683  return SCIP_OKAY;
684 
685  /* do not call rapid learning, if the problem is too big */
686  if( SCIPgetNVars(scip) > sepadata->maxnvars || SCIPgetNConss(scip) > sepadata->maxnconss )
687  return SCIP_OKAY;
688 
689  if( SCIPisStopped(scip) )
690  return SCIP_OKAY;
691 
692  /* check whether there is enough time and memory left */
693  SCIP_CALL( SCIPcheckCopyLimits(scip, &success) );
694 
695  if( !success)
696  return SCIP_OKAY;
697 
698  *result = SCIP_DIDNOTFIND;
699 
700  SCIP_CALL( SCIPcreate(&subscip) );
701 
702  retcode = setupAndSolveSubscipRapidlearning(scip, subscip, sepadata, result);
703 
704  SCIP_CALL( SCIPfree(&subscip) );
705 
706  return retcode;
707 }
708 
709 
710 /*
711  * separator specific interface methods
712  */
713 
714 /** creates the rapidlearning separator and includes it in SCIP */
716  SCIP* scip /**< SCIP data structure */
717  )
718 {
719  SCIP_SEPADATA* sepadata;
720  SCIP_SEPA* sepa;
721 
722  /* create rapidlearning separator data */
723  SCIP_CALL( SCIPallocBlockMemory(scip, &sepadata) );
724 
725  /* include separator */
728  sepaExeclpRapidlearning, NULL,
729  sepadata) );
730 
731  assert(sepa != NULL);
732 
733  /* set non-NULL pointers to callback methods */
734  SCIP_CALL( SCIPsetSepaCopy(scip, sepa, sepaCopyRapidlearning) );
735  SCIP_CALL( SCIPsetSepaFree(scip, sepa, sepaFreeRapidlearning) );
736 
737  /* add rapidlearning separator parameters */
738  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyconflicts",
739  "should the found conflicts be applied in the original SCIP?",
740  &sepadata->applyconflicts, TRUE, DEFAULT_APPLYCONFLICTS, NULL, NULL) );
741 
742  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applybdchgs",
743  "should the found global bound deductions be applied in the original SCIP?",
744  &sepadata->applybdchgs, TRUE, DEFAULT_APPLYBDCHGS, NULL, NULL) );
745 
746  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyinfervals",
747  "should the inference values be used as initialization in the original SCIP?",
748  &sepadata->applyinfervals, TRUE, DEFAULT_APPLYINFERVALS, NULL, NULL) );
749 
750  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/reducedinfer",
751  "should the inference values only be used when " SEPA_NAME " found other reductions?",
752  &sepadata->reducedinfer, TRUE, DEFAULT_REDUCEDINFER, NULL, NULL) );
753 
754  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyprimalsol",
755  "should the incumbent solution be copied to the original SCIP?",
756  &sepadata->applyprimalsol, TRUE, DEFAULT_APPLYPRIMALSOL, NULL, NULL) );
757 
758  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applysolved",
759  "should a solved status be copied to the original SCIP?",
760  &sepadata->applysolved, TRUE, DEFAULT_APPLYSOLVED, NULL, NULL) );
761 
762  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/contvars",
763  "should rapid learning be applied when there are continuous variables?",
764  &sepadata->contvars, TRUE, DEFAULT_CONTVARS, NULL, NULL) );
765 
766  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/contvarsquot",
767  "maximal portion of continuous variables to apply rapid learning",
768  &sepadata->contvarsquot, TRUE, DEFAULT_CONTVARSQUOT, 0.0, 1.0, NULL, NULL) );
769 
770  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/lpiterquot",
771  "maximal fraction of LP iterations compared to node LP iterations",
772  &sepadata->lpiterquot, TRUE, DEFAULT_LPITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
773 
774  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnvars",
775  "maximum problem size (variables) for which rapid learning will be called",
776  &sepadata->maxnvars, TRUE, DEFAULT_MAXNVARS, 0, INT_MAX, NULL, NULL) );
777 
778  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnconss",
779  "maximum problem size (constraints) for which rapid learning will be called",
780  &sepadata->maxnconss, TRUE, DEFAULT_MAXNCONSS, 0, INT_MAX, NULL, NULL) );
781 
782  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnodes",
783  "maximum number of nodes considered in rapid learning run",
784  &sepadata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) );
785 
786  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/minnodes",
787  "minimum number of nodes considered in rapid learning run",
788  &sepadata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) );
789 
790  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/copycuts",
791  "should all active cuts from cutpool be copied to constraints in subproblem?",
792  &sepadata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
793 
794  return SCIP_OKAY;
795 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SEPA_USESSUBSCIP
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2973
int SCIPgetNContVars(SCIP *scip)
Definition: scip_prob.c:2167
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
#define DEFAULT_REDUCEDINFER
#define NULL
Definition: def.h:253
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:686
SCIP_EXPORT int SCIPsepaGetFreq(SCIP_SEPA *sepa)
Definition: sepa.c:740
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:876
#define SEPA_FREQ
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
Definition: scip_var.c:5121
#define DEFAULT_MINNODES
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:466
SCIP_EXPORT SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
Definition: var.c:17055
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8275
SCIP_Real SCIPgetVarAvgInferences(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip_var.c:9246
SCIP_RETCODE SCIPaddVarLocksType(SCIP *scip, SCIP_VAR *var, SCIP_LOCKTYPE locktype, int nlocksdown, int nlocksup)
Definition: scip_var.c:4200
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:122
#define DEFAULT_CONTVARSQUOT
#define DEFAULT_LPITERQUOT
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
Definition: scip_var.c:5237
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip_solve.c:354
static SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning)
#define DEFAULT_COPYCUTS
SCIP_RETCODE SCIPgetConsCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_CONS *sourcecons, SCIP_CONS **targetcons, SCIP_CONSHDLR *sourceconshdlr, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool global, SCIP_Bool *valid)
Definition: scip_copy.c:1285
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4593
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3037
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1987
#define FALSE
Definition: def.h:73
SCIP_Real SCIPgetVarAvgConflictlength(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip_var.c:9192
SCIP_EXPORT SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17200
SCIP_EXPORT SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16903
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
Definition: cons.c:8245
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2535
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3078
SCIP_RETCODE SCIPincludeSepaRapidlearning(SCIP *scip)
int SCIPgetNImplVars(SCIP *scip)
Definition: scip_prob.c:2122
public methods for problem variables
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
Definition: scip_sepa.c:141
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:47
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:95
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip_param.c:891
SCIP_Real SCIPgetUpperbound(SCIP *scip)
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:78
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip_solve.c:2374
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:2911
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define DEFAULT_APPLYCONFLICTS
SCIP_Real SCIPgetVarVSIDS(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip_var.c:9004
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2077
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip_heur.c:248
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip_prob.c:1421
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2205
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip_param.c:612
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:282
SCIP_EXPORT const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16738
static SCIP_RETCODE setupAndSolveSubscipRapidlearning(SCIP *scip, SCIP *subscip, SCIP_SEPADATA *sepadata, SCIP_RESULT *result)
SCIP_RETCODE SCIPcopyConsCompression(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2639
#define DEFAULT_APPLYBDCHGS
#define SEPA_DELAY
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:47
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:1814
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip_prob.c:2304
#define SEPA_PRIORITY
#define SCIP_CALL(x)
Definition: def.h:365
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:940
#define DEFAULT_MAXNCONSS
SCIP_EXPORT SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
Definition: sepa.c:607
SCIP_EXPORT const char * SCIPsepaGetName(SCIP_SEPA *sepa)
Definition: sepa.c:696
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2427
#define DEFAULT_MAXNVARS
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:375
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
Definition: cons.c:8345
SCIP_RETCODE SCIPinitVarBranchStats(SCIP *scip, SCIP_VAR *var, SCIP_Real downpscost, SCIP_Real uppscost, SCIP_Real downvsids, SCIP_Real upvsids, SCIP_Real downconflen, SCIP_Real upconflen, SCIP_Real downinfer, SCIP_Real upinfer, SCIP_Real downcutoff, SCIP_Real upcutoff)
Definition: scip_var.c:9364
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1254
int SCIPgetDepth(SCIP *scip)
Definition: scip_tree.c:637
#define SCIP_Bool
Definition: def.h:70
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2891
SCIP_RETCODE SCIPincludeSepaBasic(SCIP *scip, SCIP_SEPA **sepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
Definition: scip_sepa.c:99
SCIP_EXPORT SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17362
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip_param.c:209
#define DEFAULT_APPLYINFERVALS
#define MIN(x, y)
Definition: def.h:223
SCIP_Longint SCIPgetNConflictConssFound(SCIP *scip)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
Definition: cons.c:8255
int SCIPgetNActivePricers(SCIP *scip)
Definition: scip_pricer.c:338
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Definition: cons.c:8335
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2947
SCIP_EXPORT SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17408
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:129
#define SCIP_REAL_MAX
Definition: def.h:165
SCIP_EXPORT SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17418
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip_param.c:554
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1389
#define SCIP_LONGINT_FORMAT
Definition: def.h:156
#define MAX(x, y)
Definition: def.h:222
static SCIP_DECL_SEPAFREE(sepaFreeRapidlearning)
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
Definition: cons.c:8265
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2254
SCIP_EXPORT SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17352
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4563
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1861
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:73
SCIP_RETCODE SCIPupdateLocalDualbound(SCIP *scip, SCIP_Real newbound)
Definition: scip_prob.c:3642
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2925
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:8076
#define SCIP_Real
Definition: def.h:164
SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
Definition: scip_sol.c:1567
rapidlearning separator
#define SCIP_Longint
Definition: def.h:149
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip_param.c:438
#define DEFAULT_APPLYPRIMALSOL
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2032
#define SEPA_NAME
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2765
SCIP_EXPORT void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
Definition: sepa.c:617
#define DEFAULT_MAXNODES
#define SEPA_DESC
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:314
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
Definition: scip_sepa.c:157
SCIP_EXPORT SCIP_Longint SCIPsepaGetNCalls(SCIP_SEPA *sepa)
Definition: sepa.c:813
#define SCIP_CALL_ABORT(x)
Definition: def.h:344
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1109
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
Definition: scip_var.c:8084
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:355
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip_sol.c:3218
#define DEFAULT_APPLYSOLVED
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_EXPORT int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
Definition: sepa.c:823
#define SEPA_MAXBOUNDDIST
default SCIP plugins
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
Definition: cons.c:8295
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:496
#define DEFAULT_CONTVARS
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:966
static SCIP_DECL_SEPACOPY(sepaCopyRapidlearning)
SCIP_Longint SCIPgetNConflictConssApplied(SCIP *scip)
struct SCIP_SepaData SCIP_SEPADATA
Definition: type_sepa.h:38
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip_solve.c:3327
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435