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-2018 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 email to 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 
214  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
215 
216  /* initializing the subproblem */
217  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
218  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), nvars) );
219  valid = FALSE;
220 
221  /* copy the subproblem */
222  SCIP_CALL( SCIPcopyConsCompression(scip, subscip, varmapfw, NULL, "rapid", NULL, NULL, 0, FALSE, FALSE, TRUE, &valid) );
223 
224  if( sepadata->copycuts )
225  {
226  /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
227  SCIP_CALL( SCIPcopyCuts(scip, subscip, varmapfw, NULL, FALSE, NULL) );
228  }
229 
230  for( i = 0; i < nvars; i++ )
231  {
232  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
233 
234  /* change implicit integer variables to integer type */
235  if( SCIPvarGetType(subvars[i]) == SCIP_VARTYPE_IMPLINT )
236  {
237  SCIP_Bool infeasible;
238 
239  SCIP_CALL( SCIPchgVarType(subscip, subvars[i], SCIP_VARTYPE_INTEGER, &infeasible) );
240  assert(!infeasible);
241  }
242 
243  /* skip the heuristic when the sub-SCIP contains an integer variable with an infinite bound in direction of the
244  * objective function; this might lead to very bad branching decisions when enforcing a pseudo solution (#1439)
245  */
246  if( SCIPvarGetType(subvars[i]) <= SCIP_VARTYPE_INTEGER )
247  {
248  SCIP_Real lb = SCIPvarGetLbLocal(subvars[i]);
249  SCIP_Real ub = SCIPvarGetUbLocal(subvars[i]);
250  SCIP_Real obj = SCIPvarGetObj(subvars[i]);
251 
252  if( (SCIPisNegative(subscip, obj) && SCIPisInfinity(subscip, ub))
253  || (SCIPisPositive(subscip, obj) && SCIPisInfinity(subscip, -lb)) )
254  {
255  /* free local hash map */
256  SCIPhashmapFree(&varmapfw);
257 
258  SCIPdebugMsg(scip, "unbounded integer variable %s (in [%g,%g]) with objective %g -> skip heuristic\n",
259  SCIPvarGetName(subvars[i]), lb, ub, obj);
260  goto TERMINATE;
261  }
262  }
263  }
264 
265  SCIPhashmapFree(&varmapfw);
266 
267  /* This avoids dual presolving.
268  *
269  * If the copy is not valid, it should be a relaxation of the problem (constraints might have failed to be copied,
270  * but no variables should be missing because we stop earlier anyway if pricers are present).
271  * By disabling dual presolving, conflicts found in a relaxation are still valid for the original problem.
272  */
273  if( ! valid )
274  {
275  for( i = 0; i < nvars; i++ )
276  {
277  SCIP_CALL( SCIPaddVarLocks(subscip, subvars[i], 1, 1 ) );
278  }
279  }
280 
281  SCIPdebugMsg(scip, "Copying SCIP was%s valid.\n", valid ? "" : " not");
282 
283  /* mimic an FD solver: DFS, no LP solving, 1-FUIP instead of all-FUIP */
284  if( SCIPisParamFixed(subscip, "lp/solvefreq") )
285  {
286  SCIPwarningMessage(scip, "unfixing parameter lp/solvefreq in subscip of rapidlearning\n");
287  SCIP_CALL( SCIPunfixParam(subscip, "lp/solvefreq") );
288  }
289  SCIP_CALL( SCIPsetIntParam(subscip, "lp/solvefreq", -1) );
290  if( !SCIPisParamFixed(subscip, "conflict/fuiplevels") )
291  {
292  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/fuiplevels", 1) );
293  }
294  if( SCIPisParamFixed(subscip, "nodeselection/dfs/stdpriority") )
295  {
296  SCIPwarningMessage(scip, "unfixing parameter nodeselection/dfs/stdpriority in subscip of rapidlearning\n");
297  SCIP_CALL( SCIPunfixParam(subscip, "nodeselection/dfs/stdpriority") );
298  }
299  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/dfs/stdpriority", INT_MAX/4) );
300 
301  if( !SCIPisParamFixed(subscip, "propagating/pseudoobj/freq") )
302  {
303  SCIP_CALL( SCIPsetIntParam(subscip, "propagating/pseudoobj/freq", -1) );
304  }
305  if( !SCIPisParamFixed(subscip, "constraints/disableenfops") )
306  {
307  SCIP_CALL( SCIPsetBoolParam(subscip, "constraints/disableenfops", TRUE) );
308  }
309 
310  /* use inference branching */
311  if( !SCIPisParamFixed(subscip, "branching/inference/useweightedsum") )
312  {
313  SCIP_CALL( SCIPsetBoolParam(subscip, "branching/inference/useweightedsum", FALSE) );
314  }
315 
316  /* only create short conflicts */
317  if( !SCIPisParamFixed(subscip, "conflict/maxvarsfac") )
318  {
319  SCIP_CALL( SCIPsetRealParam(subscip, "conflict/maxvarsfac", 0.05) );
320  }
321 
322  /* set limits for the subproblem */
323  nodelimit = SCIPgetNLPIterations(scip);
324  nodelimit = MAX(sepadata->minnodes, nodelimit);
325  nodelimit = MIN(sepadata->maxnodes, nodelimit);
326 
327  restartnum = 1000;
328 
329  #ifdef SCIP_DEBUG
330  /* for debugging, enable full output */
331  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
332  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
333  #else
334  /* disable statistic timing inside sub SCIP and output to console */
335  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
336  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
337  #endif
338 
339  /* set limits for the subproblem */
340  SCIP_CALL( SCIPcopyLimits(scip, subscip) );
341  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit/5) );
342  SCIP_CALL( SCIPsetIntParam(subscip, "limits/restarts", 0) );
343  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/restartnum", restartnum) );
344 
345  /* forbid recursive call of heuristics and separators solving subMIPs */
346  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
347 
348  /* disable cutting plane separation */
350 
351  /* disable expensive presolving */
353 
354  /* do not abort subproblem on CTRL-C */
355  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
356 
357  /* add an objective cutoff */
358  SCIP_CALL( SCIPsetObjlimit(subscip, SCIPgetUpperbound(scip)) );
359 
360  /* create the variable mapping hash map */
361  SCIP_CALL( SCIPhashmapCreate(&varmapbw, SCIPblkmem(scip), nvars) );
362 
363  /* store reversing mapping of variables */
364  SCIP_CALL( SCIPtransformProb(subscip) );
365  for( i = 0; i < nvars; ++i)
366  {
367  SCIP_CALL( SCIPhashmapInsert(varmapbw, SCIPvarGetTransVar(subvars[i]), vars[i]) );
368  }
369 
370  /* allocate memory for constraints storage. Each constraint that will be created from now on will be a conflict.
371  * Therefore, we need to remember oldnconss to get the conflicts from the FD search.
372  */
373  nconshdlrs = 4;
374  SCIP_CALL( SCIPallocBufferArray(scip, &conshdlrs, nconshdlrs) );
375  SCIP_CALL( SCIPallocBufferArray(scip, &oldnconss, nconshdlrs) );
376 
377  /* store number of constraints before rapid learning search */
378  conshdlrs[0] = SCIPfindConshdlr(subscip, "bounddisjunction");
379  conshdlrs[1] = SCIPfindConshdlr(subscip, "setppc");
380  conshdlrs[2] = SCIPfindConshdlr(subscip, "linear");
381  conshdlrs[3] = SCIPfindConshdlr(subscip, "logicor");
382 
383  /* redundant constraints might be eliminated in presolving */
384  SCIP_CALL( SCIPpresolve(subscip));
385 
386  for( i = 0; i < nconshdlrs; ++i)
387  {
388  if( conshdlrs[i] != NULL )
389  oldnconss[i] = SCIPconshdlrGetNConss(conshdlrs[i]);
390  }
391 
392  nfixedvars = SCIPgetNFixedVars(scip);
393 
394  /* solve the subproblem, abort after errors in debug mode */
395  SCIP_CALL_ABORT( SCIPsolve(subscip) );
396 
397  /* if problem was already solved do not increase limits to run again */
398  if( SCIPgetStage(subscip) == SCIP_STAGE_SOLVED )
399  {
400  SCIPdebugMsg(scip, "Subscip was completely solved, status %d.\n", SCIPgetStatus(subscip));
401  }
402  /* abort solving, if limit of applied conflicts is reached */
403  else if( SCIPgetNConflictConssApplied(subscip) >= restartnum )
404  {
405  SCIPdebugMsg(scip, "finish after %" SCIP_LONGINT_FORMAT " successful conflict calls.\n", SCIPgetNConflictConssApplied(subscip));
406  }
407  /* if the first 20% of the solution process were successful, proceed */
408  else if( (sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPisFeasLT(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
409  || (sepadata->applybdchgs && SCIPgetNFixedVars(subscip) > nfixedvars)
410  || (sepadata->applyconflicts && SCIPgetNConflictConssApplied(subscip) > 0) )
411  {
412  SCIPdebugMsg(scip, "proceed solving after the first 20%% of the solution process, since:\n");
413 
414  if( SCIPgetNSols(subscip) > 0 && SCIPisFeasLE(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
415  {
416  SCIPdebugMsg(scip, " - there was a better solution (%f < %f)\n",SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip));
417  }
418  if( SCIPgetNFixedVars(subscip) > nfixedvars )
419  {
420  SCIPdebugMsg(scip, " - there were %d variables fixed\n", SCIPgetNFixedVars(scip)-nfixedvars );
421  }
422  if( SCIPgetNConflictConssFound(subscip) > 0 )
423  {
424  SCIPdebugMsg(scip, " - there were %" SCIP_LONGINT_FORMAT " conflict constraints created\n", SCIPgetNConflictConssApplied(subscip));
425  }
426 
427  /* set node limit to 100% */
428  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit) );
429 
430  /* solve the subproblem, abort after errors in debug mode */
431  SCIP_CALL_ABORT( SCIPsolve(subscip) );
432  }
433  else
434  {
435  SCIPdebugMsg(scip, "do not proceed solving after the first 20%% of the solution process.\n");
436  }
437 
438  #ifdef SCIP_DEBUG
439  SCIP_CALL( SCIPprintStatistics(subscip, NULL) );
440  #endif
441 
442  disabledualreductions = FALSE;
443 
444  /* check, whether a solution was found */
445  if( sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPfindHeur(scip, "trysol") != NULL )
446  {
447  SCIP_HEUR* heurtrysol;
448  SCIP_SOL** subsols;
449  int nsubsols;
450 
451  /* check, whether a solution was found;
452  * due to numerics, it might happen that not all solutions are feasible -> try all solutions until was declared to be feasible
453  */
454  nsubsols = SCIPgetNSols(subscip);
455  subsols = SCIPgetSols(subscip);
456  soladded = FALSE;
457  heurtrysol = SCIPfindHeur(scip, "trysol");
458 
459  /* sequentially add solutions to trysol heuristic */
460  for( i = 0; i < nsubsols && !soladded; ++i )
461  {
462  SCIPdebugMsg(scip, "Try to create new solution by copying subscip solution.\n");
463  SCIP_CALL( createNewSol(scip, subscip, subvars, heurtrysol, subsols[i], &soladded) );
464  }
465  if( !soladded || !SCIPisEQ(scip, SCIPgetSolOrigObj(subscip, subsols[i-1]), SCIPgetSolOrigObj(subscip, subsols[0])) )
466  disabledualreductions = TRUE;
467  }
468 
469  /* if the sub problem was solved completely, we update the dual bound */
470  dualboundchg = FALSE;
471  if( sepadata->applysolved && !disabledualreductions
473  {
474  /* we need to multiply the dualbound with the scaling factor and add the offset,
475  * because this information has been disregarded in the sub-SCIP
476  */
477  SCIPdebugMsg(scip, "Update old dualbound %g to new dualbound %g.\n", SCIPgetDualbound(scip), SCIPretransformObj(scip, SCIPgetDualbound(subscip)));
478 
480  dualboundchg = TRUE;
481  }
482 
483  /* check, whether conflicts were created */
484  nconflicts = 0;
485  if( sepadata->applyconflicts && !disabledualreductions && SCIPgetNConflictConssApplied(subscip) > 0 )
486  {
487  SCIP_HASHMAP* consmap;
488  int hashtablesize;
489 
490  assert(SCIPgetNConflictConssApplied(subscip) < (SCIP_Longint) INT_MAX);
491  hashtablesize = (int) SCIPgetNConflictConssApplied(subscip);
492  assert(hashtablesize < INT_MAX/5);
493 
494  /* create the variable mapping hash map */
495  SCIP_CALL( SCIPhashmapCreate(&consmap, SCIPblkmem(scip), hashtablesize) );
496 
497  /* loop over all constraint handlers that might contain conflict constraints */
498  for( i = 0; i < nconshdlrs; ++i)
499  {
500  /* copy constraints that have been created in FD run */
501  if( conshdlrs[i] != NULL && SCIPconshdlrGetNConss(conshdlrs[i]) > oldnconss[i] )
502  {
503  SCIP_CONS** conss;
504  int c;
505  int nconss;
506 
507  nconss = SCIPconshdlrGetNConss(conshdlrs[i]);
508  conss = SCIPconshdlrGetConss(conshdlrs[i]);
509 
510  /* loop over all constraints that have been added in sub-SCIP run, these are the conflicts */
511  for( c = oldnconss[i]; c < nconss; ++c)
512  {
513  SCIP_CONS* cons;
514  SCIP_CONS* conscopy;
515 
516  cons = conss[c];
517  assert(cons != NULL);
518 
519  success = FALSE;
520 
521  /* @todo assert that flags are as they should be for conflicts */
522  SCIP_CALL( SCIPgetConsCopy(subscip, scip, cons, &conscopy, conshdlrs[i], varmapbw, consmap, NULL,
525  SCIPconsIsRemovable(cons), FALSE, TRUE, &success) );
526 
527  if( success )
528  {
529  nconflicts++;
530  SCIP_CALL( SCIPaddCons(scip, conscopy) );
531  SCIP_CALL( SCIPreleaseCons(scip, &conscopy) );
532  }
533  else
534  {
535  SCIPdebugMsg(scip, "failed to copy conflict constraint %s back to original SCIP\n", SCIPconsGetName(cons));
536  }
537  }
538  }
539  }
540  SCIPhashmapFree(&consmap);
541  }
542 
543  /* check, whether tighter global bounds were detected */
544  nbdchgs = 0;
545  if( sepadata->applybdchgs && !disabledualreductions )
546  for( i = 0; i < nvars; ++i )
547  {
548  SCIP_Bool infeasible;
549  SCIP_Bool tightened;
550 
551  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetLbGlobal(subvars[i])));
552  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(subvars[i]), SCIPvarGetUbGlobal(subvars[i])));
553  assert(SCIPisLE(scip, SCIPvarGetUbGlobal(subvars[i]), SCIPvarGetUbGlobal(vars[i])));
554 
555  /* update the bounds of the original SCIP, if a better bound was proven in the sub-SCIP */
556  /* @todo handle infeasible pointer? can it be set to TRUE? */
557  SCIP_CALL( SCIPtightenVarUb(scip, vars[i], SCIPvarGetUbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
558  if( tightened )
559  nbdchgs++;
560 
561  SCIP_CALL( SCIPtightenVarLb(scip, vars[i], SCIPvarGetLbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
562  if( tightened )
563  nbdchgs++;
564  }
565 
566  n1startinfers = 0;
567  n2startinfers = 0;
568 
569  /* install start values for inference branching */
570  /* @todo use different nbranching counters for pseudo cost and inference values and update inference values in the tree */
571  if( sepadata->applyinfervals && SCIPgetDepth(scip) == 0 && (!sepadata->reducedinfer || soladded || nbdchgs+nconflicts > 0) )
572  {
573  for( i = 0; i < nvars; ++i )
574  {
575  SCIP_Real downinfer;
576  SCIP_Real upinfer;
577  SCIP_Real downvsids;
578  SCIP_Real upvsids;
579  SCIP_Real downconflen;
580  SCIP_Real upconflen;
581 
582  /* copy downwards branching statistics */
583  downvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
584  downconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
585  downinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
586 
587  /* copy upwards branching statistics */
588  upvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
589  upconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
590  upinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
591 
592  /* memorize statistics */
593  if( downinfer+downconflen+downvsids > 0.0 || upinfer+upconflen+upvsids != 0 )
594  n1startinfers++;
595 
596  if( downinfer+downconflen+downvsids > 0.0 && upinfer+upconflen+upvsids != 0 )
597  n2startinfers++;
598 
599  SCIP_CALL( SCIPinitVarBranchStats(scip, vars[i], 0.0, 0.0, downvsids, upvsids, downconflen, upconflen, downinfer, upinfer, 0.0, 0.0) );
600  }
601  }
602 
603  SCIPdebugMsg(scip, "Rapidlearning added %d conflicts, changed %d bounds, %s primal solution, %s dual bound improvement.\n",
604  nconflicts, nbdchgs, soladded ? "found" : "no", dualboundchg ? "found" : "no");
605 
606  SCIPdebugMsg(scip, "YYY Infervalues initialized on one side: %5.2f %% of variables, %5.2f %% on both sides\n",
607  100.0 * n1startinfers/(SCIP_Real)nvars, 100.0 * n2startinfers/(SCIP_Real)nvars);
608 
609  /* change result pointer */
610  if( nconflicts > 0 || dualboundchg )
611  *result = SCIP_CONSADDED;
612  else if( nbdchgs > 0 )
613  *result = SCIP_REDUCEDDOM;
614 
615  /* free local data */
616  assert(oldnconss != NULL);
617  assert(conshdlrs != NULL);
618  assert(varmapbw != NULL);
619  SCIPfreeBufferArray(scip, &oldnconss);
620  SCIPfreeBufferArray(scip, &conshdlrs);
621  SCIPhashmapFree(&varmapbw);
622 
623  TERMINATE:
624 
625  /* free subproblem */
626  SCIPfreeBufferArray(scip, &subvars);
627  return SCIP_OKAY;
628 }
629 
630 /** LP solution separation method of separator */
631 static
632 SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning)
633 {/*lint --e{715}*/
634  SCIP* subscip; /* the subproblem created by rapid learning */
635  SCIP_SEPADATA* sepadata; /* separator's private data */
636  int ndiscvars;
637  SCIP_Bool success;
638  SCIP_RETCODE retcode;
639 
640  assert(sepa != NULL);
641  assert(scip != NULL);
642  assert(result != NULL);
643 
644  *result = SCIP_DIDNOTRUN;
645 
646  ndiscvars = SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip) + SCIPgetNImplVars(scip);
647 
648  /* only run when still not fixed binary variables exists */
649  if( ndiscvars == 0 )
650  return SCIP_OKAY;
651 
652  /* get separator's data */
653  sepadata = SCIPsepaGetData(sepa);
654  assert(sepadata != NULL);
655 
656  /* only run for integer programs */
657  if( !sepadata->contvars && ndiscvars != SCIPgetNVars(scip) )
658  return SCIP_OKAY;
659 
660  /* only run if there are few enough continuous variables */
661  if( sepadata->contvars && SCIPgetNContVars(scip) > sepadata->contvarsquot * SCIPgetNVars(scip) )
662  return SCIP_OKAY;
663 
664  /* do not run if pricers are present */
665  if( SCIPgetNActivePricers(scip) > 0 )
666  return SCIP_OKAY;
667 
668  /* if the separator should be exclusive to the root node, this prevents multiple calls due to restarts */
669  if( SCIPsepaGetFreq(sepa) == 0 && SCIPsepaGetNCalls(sepa) > 0 )
670  return SCIP_OKAY;
671 
672  /* call separator at most once per node */
673  if( SCIPsepaGetNCallsAtNode(sepa) > 0 )
674  return SCIP_OKAY;
675 
676  /* do not call rapid learning, if the problem is too big */
677  if( SCIPgetNVars(scip) > sepadata->maxnvars || SCIPgetNConss(scip) > sepadata->maxnconss )
678  return SCIP_OKAY;
679 
680  if( SCIPisStopped(scip) )
681  return SCIP_OKAY;
682 
683  /* check whether there is enough time and memory left */
684  SCIP_CALL( SCIPcheckCopyLimits(scip, &success) );
685 
686  if( !success)
687  return SCIP_OKAY;
688 
689  *result = SCIP_DIDNOTFIND;
690 
691  SCIP_CALL( SCIPcreate(&subscip) );
692 
693  retcode = setupAndSolveSubscipRapidlearning(scip, subscip, sepadata, result);
694 
695  SCIP_CALL( SCIPfree(&subscip) );
696 
697  return retcode;
698 }
699 
700 
701 /*
702  * separator specific interface methods
703  */
704 
705 /** creates the rapidlearning separator and includes it in SCIP */
707  SCIP* scip /**< SCIP data structure */
708  )
709 {
710  SCIP_SEPADATA* sepadata;
711  SCIP_SEPA* sepa;
712 
713  /* create rapidlearning separator data */
714  SCIP_CALL( SCIPallocBlockMemory(scip, &sepadata) );
715 
716  /* include separator */
719  sepaExeclpRapidlearning, NULL,
720  sepadata) );
721 
722  assert(sepa != NULL);
723 
724  /* set non-NULL pointers to callback methods */
725  SCIP_CALL( SCIPsetSepaCopy(scip, sepa, sepaCopyRapidlearning) );
726  SCIP_CALL( SCIPsetSepaFree(scip, sepa, sepaFreeRapidlearning) );
727 
728  /* add rapidlearning separator parameters */
729  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyconflicts",
730  "should the found conflicts be applied in the original SCIP?",
731  &sepadata->applyconflicts, TRUE, DEFAULT_APPLYCONFLICTS, NULL, NULL) );
732 
733  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applybdchgs",
734  "should the found global bound deductions be applied in the original SCIP?",
735  &sepadata->applybdchgs, TRUE, DEFAULT_APPLYBDCHGS, NULL, NULL) );
736 
737  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyinfervals",
738  "should the inference values be used as initialization in the original SCIP?",
739  &sepadata->applyinfervals, TRUE, DEFAULT_APPLYINFERVALS, NULL, NULL) );
740 
741  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/reducedinfer",
742  "should the inference values only be used when " SEPA_NAME " found other reductions?",
743  &sepadata->reducedinfer, TRUE, DEFAULT_REDUCEDINFER, NULL, NULL) );
744 
745  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyprimalsol",
746  "should the incumbent solution be copied to the original SCIP?",
747  &sepadata->applyprimalsol, TRUE, DEFAULT_APPLYPRIMALSOL, NULL, NULL) );
748 
749  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applysolved",
750  "should a solved status be copied to the original SCIP?",
751  &sepadata->applysolved, TRUE, DEFAULT_APPLYSOLVED, NULL, NULL) );
752 
753  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/contvars",
754  "should rapid learning be applied when there are continuous variables?",
755  &sepadata->contvars, TRUE, DEFAULT_CONTVARS, NULL, NULL) );
756 
757  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/contvarsquot",
758  "maximal portion of continuous variables to apply rapid learning",
759  &sepadata->contvarsquot, TRUE, DEFAULT_CONTVARSQUOT, 0.0, 1.0, NULL, NULL) );
760 
761  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/lpiterquot",
762  "maximal fraction of LP iterations compared to node LP iterations",
763  &sepadata->lpiterquot, TRUE, DEFAULT_LPITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
764 
765  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnvars",
766  "maximum problem size (variables) for which rapid learning will be called",
767  &sepadata->maxnvars, TRUE, DEFAULT_MAXNVARS, 0, INT_MAX, NULL, NULL) );
768 
769  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnconss",
770  "maximum problem size (constraints) for which rapid learning will be called",
771  &sepadata->maxnconss, TRUE, DEFAULT_MAXNCONSS, 0, INT_MAX, NULL, NULL) );
772 
773  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnodes",
774  "maximum number of nodes considered in rapid learning run",
775  &sepadata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) );
776 
777  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/minnodes",
778  "minimum number of nodes considered in rapid learning run",
779  &sepadata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) );
780 
781  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/copycuts",
782  "should all active cuts from cutpool be copied to constraints in subproblem?",
783  &sepadata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
784 
785  return SCIP_OKAY;
786 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SEPA_USESSUBSCIP
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:11902
#define DEFAULT_REDUCEDINFER
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:5158
SCIP_Real SCIPgetVarAvgInferences(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:26636
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
Definition: scip.c:22523
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:821
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Definition: cons.c:8245
#define SEPA_FREQ
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
Definition: scip.c:42333
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:47311
#define DEFAULT_MINNODES
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:6604
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17276
#define DEFAULT_CONTVARSQUOT
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
Definition: scip.c:47088
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip.c:12252
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17332
#define DEFAULT_LPITERQUOT
static SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning)
#define DEFAULT_COPYCUTS
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip.c:11686
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4485
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip.c:39832
#define FALSE
Definition: def.h:64
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2793
SCIP_Real SCIPgetVarVSIDS(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:26394
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip.c:4192
int SCIPgetNActivePricers(SCIP *scip)
Definition: scip.c:5718
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.c:3884
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
Definition: scip.c:47100
#define TRUE
Definition: def.h:63
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
Definition: sepa.c:646
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
Definition: scip.c:21660
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:5132
public methods for problem variables
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
Definition: scip.c:22639
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip.h:22602
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2931
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:46963
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:22632
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip.c:748
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip.h:22585
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
Definition: scip.c:7427
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip.c:4804
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
Definition: cons.c:8255
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1267
#define SCIPdebugMsg
Definition: scip.h:455
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.c:4265
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
Definition: scip.c:45651
int SCIPgetNContVars(SCIP *scip)
Definition: scip.c:11992
#define DEFAULT_APPLYCONFLICTS
SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
Definition: sepa.c:557
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip.c:12129
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
Definition: scip.c:25479
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17286
int SCIPsepaGetFreq(SCIP_SEPA *sepa)
Definition: sepa.c:690
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip.c:16115
static SCIP_RETCODE setupAndSolveSubscipRapidlearning(SCIP *scip, SCIP *subscip, SCIP_SEPADATA *sepadata, SCIP_RESULT *result)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip.c:8225
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip.c:4401
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip.c:12591
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:38948
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.c:26754
#define DEFAULT_APPLYBDCHGS
SCIP_Real SCIPgetDualbound(SCIP *scip)
Definition: scip.c:43256
#define SEPA_DELAY
int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
Definition: sepa.c:773
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip.c:4630
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip.c:928
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip.c:15954
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip.c:3065
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip.c:46731
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7986
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
Definition: cons.c:8205
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16662
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2826
void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
Definition: sepa.c:567
#define SEPA_PRIORITY
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
Definition: scip.c:4567
#define SCIP_CALL(x)
Definition: def.h:350
SCIP_Real SCIPgetVarAvgConflictlength(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:26582
#define DEFAULT_MAXNCONSS
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:47324
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4515
#define DEFAULT_MAXNVARS
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.c:2533
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.c:7385
SCIP_Longint SCIPsepaGetNCalls(SCIP_SEPA *sepa)
Definition: sepa.c:763
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:22620
#define SCIP_Bool
Definition: def.h:61
int SCIPgetNImplVars(SCIP *scip)
Definition: scip.c:11947
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip.c:11246
int SCIPgetDepth(SCIP *scip)
Definition: scip.c:43045
#define MAX(x, y)
Definition: tclique_def.h:75
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.c:40794
#define DEFAULT_APPLYINFERVALS
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip.c:4688
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8185
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
Definition: cons.c:8155
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17124
SCIP_Longint SCIPgetNConflictConssFound(SCIP *scip)
Definition: scip.c:42962
int SCIPgetNSols(SCIP *scip)
Definition: scip.c:39783
SCIP_RETCODE SCIPupdateLocalDualbound(SCIP *scip, SCIP_Real newbound)
Definition: scip.c:13469
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:38994
SCIP_Longint SCIPgetNConflictConssApplied(SCIP *scip)
Definition: scip.c:43019
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
Definition: scip.c:47039
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:11857
int SCIPgetNVars(SCIP *scip)
Definition: scip.c:11812
#define SCIP_REAL_MAX
Definition: def.h:150
static SCIP_DECL_SEPAFREE(sepaFreeRapidlearning)
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
Definition: scip.c:7443
SCIP_RETCODE SCIPincludeSepaRapidlearning(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
Definition: scip.c:12862
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip.c:27761
SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
Definition: scip.c:39126
#define SCIP_Real
Definition: def.h:149
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip.c:1145
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
Definition: cons.c:8175
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
Definition: cons.c:8165
rapidlearning separator
#define SCIP_Longint
Definition: def.h:134
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip.c:4156
#define DEFAULT_APPLYPRIMALSOL
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16827
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:38813
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip.c:13935
#define SEPA_NAME
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:46989
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17342
SCIP_Real SCIPgetUpperbound(SCIP *scip)
Definition: scip.c:43426
#define DEFAULT_MAXNODES
#define SEPA_DESC
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2874
#define SCIP_CALL_ABORT(x)
Definition: def.h:329
#define DEFAULT_APPLYSOLVED
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
Definition: var.c:16979
#define SEPA_MAXBOUNDDIST
default SCIP plugins
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.c:4321
#define DEFAULT_CONTVARS
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip.c:5083
static SCIP_DECL_SEPACOPY(sepaCopyRapidlearning)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip.c:4746
struct SCIP_SepaData SCIP_SEPADATA
Definition: type_sepa.h:38
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.c:4239
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip.c:780
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:37878