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-2017 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 /** LP solution separation method of separator */
174 static
175 SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning)
176 {/*lint --e{715}*/
177  SCIP* subscip; /* the subproblem created by rapid learning */
178  SCIP_SEPADATA* sepadata; /* separator's private data */
180  SCIP_VAR** vars; /* original problem's variables */
181  SCIP_VAR** subvars; /* subproblem's variables */
182  SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
183  SCIP_HASHMAP* varmapbw = NULL; /* mapping of sub-SCIP variables to SCIP variables */
184 
185  SCIP_CONSHDLR** conshdlrs = NULL; /* array of constraint handler's that might that might obtain conflicts */
186  int* oldnconss = NULL; /* number of constraints without rapid learning conflicts */
187 
188  SCIP_Longint nodelimit; /* node limit for the subproblem */
189 
190  int nconshdlrs; /* size of conshdlr and oldnconss array */
191  int nfixedvars; /* number of variables that could be fixed by rapid learning */
192  int nvars; /* number of variables */
193  int restartnum; /* maximal number of conflicts that should be created */
194  int i; /* counter */
195 
196  SCIP_Bool success; /* was problem creation / copying constraint successful? */
197  SCIP_RETCODE retcode; /* used for catching sub-SCIP errors in debug mode */
198 
199  int nconflicts; /* statistic: number of conflicts applied */
200  int nbdchgs; /* statistic: number of bound changes applied */
201  int n1startinfers; /* statistic: number of one side infer values */
202  int n2startinfers; /* statistic: number of both side infer values */
203 
204  SCIP_Bool soladded; /* statistic: was a new incumbent found? */
205  SCIP_Bool dualboundchg; /* statistic: was a new dual bound found? */
206  SCIP_Bool disabledualreductions; /* TRUE, if dual reductions in sub-SCIP are not valid for original SCIP,
207  * e.g., because a constraint could not be copied or a primal solution
208  * could not be copied back
209  */
210  SCIP_Bool valid;
211  int ndiscvars;
212 
213  soladded = FALSE;
214 
215  assert(sepa != NULL);
216  assert(scip != NULL);
217  assert(result != NULL);
218 
219  *result = SCIP_DIDNOTRUN;
220 
221  ndiscvars = SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip) + SCIPgetNImplVars(scip);
222 
223  /* only run when still not fixed binary variables exists */
224  if( ndiscvars == 0 )
225  return SCIP_OKAY;
226 
227  /* get separator's data */
228  sepadata = SCIPsepaGetData(sepa);
229  assert(sepadata != NULL);
230 
231  /* only run for integer programs */
232  if( !sepadata->contvars && ndiscvars != SCIPgetNVars(scip) )
233  return SCIP_OKAY;
234 
235  /* only run if there are few enough continuous variables */
236  if( sepadata->contvars && SCIPgetNContVars(scip) > sepadata->contvarsquot * SCIPgetNVars(scip) )
237  return SCIP_OKAY;
238 
239  /* do not run if pricers are present */
240  if( SCIPgetNActivePricers(scip) > 0 )
241  return SCIP_OKAY;
242 
243  /* if the separator should be exclusive to the root node, this prevents multiple calls due to restarts */
244  if( SCIPsepaGetFreq(sepa) == 0 && SCIPsepaGetNCalls(sepa) > 0 )
245  return SCIP_OKAY;
246 
247  /* call separator at most once per node */
248  if( SCIPsepaGetNCallsAtNode(sepa) > 0 )
249  return SCIP_OKAY;
250 
251  /* do not call rapid learning, if the problem is too big */
252  if( SCIPgetNVars(scip) > sepadata->maxnvars || SCIPgetNConss(scip) > sepadata->maxnconss )
253  return SCIP_OKAY;
254 
255  if( SCIPisStopped(scip) )
256  return SCIP_OKAY;
257 
258  /* check whether there is enough time and memory left */
259  SCIP_CALL( SCIPcheckCopyLimits(scip, &success) );
260 
261  if( !success)
262  return SCIP_OKAY;
263 
264  *result = SCIP_DIDNOTFIND;
265 
266  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
267 
268  /* initializing the subproblem */
269  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
270  SCIP_CALL( SCIPcreate(&subscip) );
271  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), nvars) );
272  valid = FALSE;
273 
274  /* copy the subproblem */
275  SCIP_CALL( SCIPcopyConsCompression(scip, subscip, varmapfw, NULL, "rapid", NULL, NULL, 0, FALSE, FALSE, TRUE, &valid) );
276 
277  if( sepadata->copycuts )
278  {
279  /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
280  SCIP_CALL( SCIPcopyCuts(scip, subscip, varmapfw, NULL, FALSE, NULL) );
281  }
282 
283  for( i = 0; i < nvars; i++ )
284  {
285  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
286 
287  /* change implicit integer variables to integer type */
288  if( SCIPvarGetType(subvars[i]) == SCIP_VARTYPE_IMPLINT )
289  {
290  SCIP_Bool infeasible;
291 
292  SCIP_CALL( SCIPchgVarType(subscip, subvars[i], SCIP_VARTYPE_INTEGER, &infeasible) );
293  assert(!infeasible);
294  }
295 
296  /* skip the heuristic when the sub-SCIP contains an integer variable with an infinite bound in direction of the
297  * objective function; this might lead to very bad branching decisions when enforcing a pseudo solution (#1439)
298  */
299  if( SCIPvarGetType(subvars[i]) <= SCIP_VARTYPE_INTEGER )
300  {
301  SCIP_Real lb = SCIPvarGetLbLocal(subvars[i]);
302  SCIP_Real ub = SCIPvarGetUbLocal(subvars[i]);
303  SCIP_Real obj = SCIPvarGetObj(subvars[i]);
304 
305  if( (SCIPisNegative(subscip, obj) && SCIPisInfinity(subscip, ub))
306  || (SCIPisPositive(subscip, obj) && SCIPisInfinity(subscip, -lb)) )
307  {
308  /* free local hash map */
309  SCIPhashmapFree(&varmapfw);
310 
311  SCIPdebugMsg(scip, "unbounded integer variable %s (in [%g,%g]) with objective %g -> skip heuristic\n",
312  SCIPvarGetName(subvars[i]), lb, ub, obj);
313  goto TERMINATE;
314  }
315  }
316  }
317 
318  SCIPhashmapFree(&varmapfw);
319 
320  /* This avoids dual presolving.
321  *
322  * If the copy is not valid, it should be a relaxation of the problem (constraints might have failed to be copied,
323  * but no variables should be missing because we stop earlier anyway if pricers are present).
324  * By disabling dual presolving, conflicts found in a relaxation are still valid for the original problem.
325  */
326  if( ! valid )
327  {
328  for( i = 0; i < nvars; i++ )
329  {
330  SCIP_CALL( SCIPaddVarLocks(subscip, subvars[i], 1, 1 ) );
331  }
332  }
333 
334  SCIPdebugMsg(scip, "Copying SCIP was%s valid.\n", valid ? "" : " not");
335 
336  /* mimic an FD solver: DFS, no LP solving, 1-FUIP instead of all-FUIP */
337  if( SCIPisParamFixed(subscip, "lp/solvefreq") )
338  {
339  SCIPwarningMessage(scip, "unfixing parameter lp/solvefreq in subscip of rapidlearning\n");
340  SCIP_CALL( SCIPunfixParam(subscip, "lp/solvefreq") );
341  }
342  SCIP_CALL( SCIPsetIntParam(subscip, "lp/solvefreq", -1) );
343  if( !SCIPisParamFixed(subscip, "conflict/fuiplevels") )
344  {
345  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/fuiplevels", 1) );
346  }
347  if( SCIPisParamFixed(subscip, "nodeselection/dfs/stdpriority") )
348  {
349  SCIPwarningMessage(scip, "unfixing parameter nodeselection/dfs/stdpriority in subscip of rapidlearning\n");
350  SCIP_CALL( SCIPunfixParam(subscip, "nodeselection/dfs/stdpriority") );
351  }
352  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/dfs/stdpriority", INT_MAX/4) );
353 
354  if( !SCIPisParamFixed(subscip, "propagating/pseudoobj/freq") )
355  {
356  SCIP_CALL( SCIPsetIntParam(subscip, "propagating/pseudoobj/freq", -1) );
357  }
358  if( !SCIPisParamFixed(subscip, "constraints/disableenfops") )
359  {
360  SCIP_CALL( SCIPsetBoolParam(subscip, "constraints/disableenfops", TRUE) );
361  }
362 
363  /* use inference branching */
364  if( !SCIPisParamFixed(subscip, "branching/inference/useweightedsum") )
365  {
366  SCIP_CALL( SCIPsetBoolParam(subscip, "branching/inference/useweightedsum", FALSE) );
367  }
368 
369  /* only create short conflicts */
370  if( !SCIPisParamFixed(subscip, "conflict/maxvarsfac") )
371  {
372  SCIP_CALL( SCIPsetRealParam(subscip, "conflict/maxvarsfac", 0.05) );
373  }
374 
375  /* set limits for the subproblem */
376  nodelimit = SCIPgetNLPIterations(scip);
377  nodelimit = MAX(sepadata->minnodes, nodelimit);
378  nodelimit = MIN(sepadata->maxnodes, nodelimit);
379 
380  restartnum = 1000;
381 
382 #ifdef SCIP_DEBUG
383  /* for debugging, enable full output */
384  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
385  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
386 #else
387  /* disable statistic timing inside sub SCIP and output to console */
388  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
389  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
390 #endif
391 
392  /* set limits for the subproblem */
393  SCIP_CALL( SCIPcopyLimits(scip, subscip) );
394  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit/5) );
395  SCIP_CALL( SCIPsetIntParam(subscip, "limits/restarts", 0) );
396  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/restartnum", restartnum) );
397 
398  /* forbid recursive call of heuristics and separators solving subMIPs */
399  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
400 
401  /* disable cutting plane separation */
403 
404  /* disable expensive presolving */
406 
407  /* do not abort subproblem on CTRL-C */
408  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
409 
410  /* add an objective cutoff */
411  SCIP_CALL( SCIPsetObjlimit(subscip, SCIPgetUpperbound(scip)) );
412 
413  /* create the variable mapping hash map */
414  SCIP_CALL( SCIPhashmapCreate(&varmapbw, SCIPblkmem(scip), nvars) );
415 
416  /* store reversing mapping of variables */
417  SCIP_CALL( SCIPtransformProb(subscip) );
418  for( i = 0; i < nvars; ++i)
419  {
420  SCIP_CALL( SCIPhashmapInsert(varmapbw, SCIPvarGetTransVar(subvars[i]), vars[i]) );
421  }
422 
423  /* allocate memory for constraints storage. Each constraint that will be created from now on will be a conflict.
424  * Therefore, we need to remember oldnconss to get the conflicts from the FD search.
425  */
426  nconshdlrs = 4;
427  SCIP_CALL( SCIPallocBufferArray(scip, &conshdlrs, nconshdlrs) );
428  SCIP_CALL( SCIPallocBufferArray(scip, &oldnconss, nconshdlrs) );
429 
430  /* store number of constraints before rapid learning search */
431  conshdlrs[0] = SCIPfindConshdlr(subscip, "bounddisjunction");
432  conshdlrs[1] = SCIPfindConshdlr(subscip, "setppc");
433  conshdlrs[2] = SCIPfindConshdlr(subscip, "linear");
434  conshdlrs[3] = SCIPfindConshdlr(subscip, "logicor");
435 
436  /* redundant constraints might be eliminated in presolving */
437  SCIP_CALL( SCIPpresolve(subscip));
438 
439  for( i = 0; i < nconshdlrs; ++i)
440  {
441  if( conshdlrs[i] != NULL )
442  oldnconss[i] = SCIPconshdlrGetNConss(conshdlrs[i]);
443  }
444 
445  nfixedvars = SCIPgetNFixedVars(scip);
446 
447  /* solve the subproblem */
448  retcode = SCIPsolve(subscip);
449 
450  /* Errors in solving the subproblem should not kill the overall solving process
451  * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
452  */
453  if( retcode != SCIP_OKAY )
454  {
455 #ifndef NDEBUG
456  SCIP_CALL( retcode );
457 #endif
458  SCIPwarningMessage(scip, "Error while solving subproblem in rapid learning separator; sub-SCIP terminated with code <%d>\n",retcode);
459  }
460 
461  /* if problem was already solved do not increase limits to run again */
462  if( SCIPgetStage(subscip) == SCIP_STAGE_SOLVED )
463  {
464  SCIPdebugMsg(scip, "Subscip was completely solved, status %d.\n", SCIPgetStatus(subscip));
465  }
466  /* abort solving, if limit of applied conflicts is reached */
467  else if( SCIPgetNConflictConssApplied(subscip) >= restartnum )
468  {
469  SCIPdebugMsg(scip, "finish after %" SCIP_LONGINT_FORMAT " successful conflict calls.\n", SCIPgetNConflictConssApplied(subscip));
470  }
471  /* if the first 20% of the solution process were successful, proceed */
472  else if( (sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPisFeasLT(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
473  || (sepadata->applybdchgs && SCIPgetNFixedVars(subscip) > nfixedvars)
474  || (sepadata->applyconflicts && SCIPgetNConflictConssApplied(subscip) > 0) )
475  {
476  SCIPdebugMsg(scip, "proceed solving after the first 20%% of the solution process, since:\n");
477 
478  if( SCIPgetNSols(subscip) > 0 && SCIPisFeasLE(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) )
479  {
480  SCIPdebugMsg(scip, " - there was a better solution (%f < %f)\n",SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip));
481  }
482  if( SCIPgetNFixedVars(subscip) > nfixedvars )
483  {
484  SCIPdebugMsg(scip, " - there were %d variables fixed\n", SCIPgetNFixedVars(scip)-nfixedvars );
485  }
486  if( SCIPgetNConflictConssFound(subscip) > 0 )
487  {
488  SCIPdebugMsg(scip, " - there were %" SCIP_LONGINT_FORMAT " conflict constraints created\n", SCIPgetNConflictConssApplied(subscip));
489  }
490 
491  /* set node limit to 100% */
492  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nodelimit) );
493 
494  /* solve the subproblem */
495  retcode = SCIPsolve(subscip);
496 
497  /* Errors in solving the subproblem should not kill the overall solving process
498  * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
499  */
500  if( retcode != SCIP_OKAY )
501  {
502 #ifndef NDEBUG
503  SCIP_CALL( retcode );
504 #endif
505  SCIPwarningMessage(scip, "Error while solving subproblem in rapid learning separator; sub-SCIP terminated with code <%d>\n",retcode);
506  }
507  }
508  else
509  {
510  SCIPdebugMsg(scip, "do not proceed solving after the first 20%% of the solution process.\n");
511  }
512 
513 #ifdef SCIP_DEBUG
514  SCIP_CALL( SCIPprintStatistics(subscip, NULL) );
515 #endif
516 
517  disabledualreductions = FALSE;
518 
519  /* check, whether a solution was found */
520  if( sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPfindHeur(scip, "trysol") != NULL )
521  {
522  SCIP_HEUR* heurtrysol;
523  SCIP_SOL** subsols;
524  int nsubsols;
525 
526  /* check, whether a solution was found;
527  * due to numerics, it might happen that not all solutions are feasible -> try all solutions until was declared to be feasible
528  */
529  nsubsols = SCIPgetNSols(subscip);
530  subsols = SCIPgetSols(subscip);
531  soladded = FALSE;
532  heurtrysol = SCIPfindHeur(scip, "trysol");
533 
534  /* sequentially add solutions to trysol heuristic */
535  for( i = 0; i < nsubsols && !soladded; ++i )
536  {
537  SCIPdebugMsg(scip, "Try to create new solution by copying subscip solution.\n");
538  SCIP_CALL( createNewSol(scip, subscip, subvars, heurtrysol, subsols[i], &soladded) );
539  }
540  if( !soladded || !SCIPisEQ(scip, SCIPgetSolOrigObj(subscip, subsols[i-1]), SCIPgetSolOrigObj(subscip, subsols[0])) )
541  disabledualreductions = TRUE;
542  }
543 
544  /* if the sub problem was solved completely, we update the dual bound */
545  dualboundchg = FALSE;
546  if( sepadata->applysolved && !disabledualreductions
548  {
549  /* we need to multiply the dualbound with the scaling factor and add the offset,
550  * because this information has been disregarded in the sub-SCIP
551  */
552  SCIPdebugMsg(scip, "Update old dualbound %g to new dualbound %g.\n", SCIPgetDualbound(scip), SCIPretransformObj(scip, SCIPgetDualbound(subscip)));
553 
555  dualboundchg = TRUE;
556  }
557 
558  /* check, whether conflicts were created */
559  nconflicts = 0;
560  if( sepadata->applyconflicts && !disabledualreductions && SCIPgetNConflictConssApplied(subscip) > 0 )
561  {
562  SCIP_HASHMAP* consmap;
563  int hashtablesize;
564 
565  assert(SCIPgetNConflictConssApplied(subscip) < (SCIP_Longint) INT_MAX);
566  hashtablesize = (int) SCIPgetNConflictConssApplied(subscip);
567  assert(hashtablesize < INT_MAX/5);
568 
569  /* create the variable mapping hash map */
570  SCIP_CALL( SCIPhashmapCreate(&consmap, SCIPblkmem(scip), hashtablesize) );
571 
572  /* loop over all constraint handlers that might contain conflict constraints */
573  for( i = 0; i < nconshdlrs; ++i)
574  {
575  /* copy constraints that have been created in FD run */
576  if( conshdlrs[i] != NULL && SCIPconshdlrGetNConss(conshdlrs[i]) > oldnconss[i] )
577  {
578  SCIP_CONS** conss;
579  int c;
580  int nconss;
581 
582  nconss = SCIPconshdlrGetNConss(conshdlrs[i]);
583  conss = SCIPconshdlrGetConss(conshdlrs[i]);
584 
585  /* loop over all constraints that have been added in sub-SCIP run, these are the conflicts */
586  for( c = oldnconss[i]; c < nconss; ++c)
587  {
588  SCIP_CONS* cons;
589  SCIP_CONS* conscopy;
590 
591  cons = conss[c];
592  assert(cons != NULL);
593 
594  success = FALSE;
595 
596  /* @todo assert that flags are as they should be for conflicts */
597  SCIP_CALL( SCIPgetConsCopy(subscip, scip, cons, &conscopy, conshdlrs[i], varmapbw, consmap, NULL,
600  SCIPconsIsRemovable(cons), FALSE, TRUE, &success) );
601 
602  if( success )
603  {
604  nconflicts++;
605  SCIP_CALL( SCIPaddCons(scip, conscopy) );
606  SCIP_CALL( SCIPreleaseCons(scip, &conscopy) );
607  }
608  else
609  {
610  SCIPdebugMsg(scip, "failed to copy conflict constraint %s back to original SCIP\n", SCIPconsGetName(cons));
611  }
612  }
613  }
614  }
615  SCIPhashmapFree(&consmap);
616  }
617 
618  /* check, whether tighter global bounds were detected */
619  nbdchgs = 0;
620  if( sepadata->applybdchgs && !disabledualreductions )
621  for( i = 0; i < nvars; ++i )
622  {
623  SCIP_Bool infeasible;
624  SCIP_Bool tightened;
625 
626  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetLbGlobal(subvars[i])));
627  assert(SCIPisLE(scip, SCIPvarGetLbGlobal(subvars[i]), SCIPvarGetUbGlobal(subvars[i])));
628  assert(SCIPisLE(scip, SCIPvarGetUbGlobal(subvars[i]), SCIPvarGetUbGlobal(vars[i])));
629 
630  /* update the bounds of the original SCIP, if a better bound was proven in the sub-SCIP */
631  /* @todo handle infeasible pointer? can it be set to TRUE? */
632  SCIP_CALL( SCIPtightenVarUb(scip, vars[i], SCIPvarGetUbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
633  if( tightened )
634  nbdchgs++;
635 
636  SCIP_CALL( SCIPtightenVarLb(scip, vars[i], SCIPvarGetLbGlobal(subvars[i]), FALSE, &infeasible, &tightened) );
637  if( tightened )
638  nbdchgs++;
639  }
640 
641  n1startinfers = 0;
642  n2startinfers = 0;
643 
644  /* install start values for inference branching */
645  /* @todo use different nbranching counters for pseudo cost and inference values and update inference values in the tree */
646  if( sepadata->applyinfervals && SCIPgetDepth(scip) == 0 && (!sepadata->reducedinfer || soladded || nbdchgs+nconflicts > 0) )
647  {
648  for( i = 0; i < nvars; ++i )
649  {
650  SCIP_Real downinfer;
651  SCIP_Real upinfer;
652  SCIP_Real downvsids;
653  SCIP_Real upvsids;
654  SCIP_Real downconflen;
655  SCIP_Real upconflen;
656 
657  /* copy downwards branching statistics */
658  downvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
659  downconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
660  downinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_DOWNWARDS);
661 
662  /* copy upwards branching statistics */
663  upvsids = SCIPgetVarVSIDS(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
664  upconflen = SCIPgetVarAvgConflictlength(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
665  upinfer = SCIPgetVarAvgInferences(subscip, subvars[i], SCIP_BRANCHDIR_UPWARDS);
666 
667  /* memorize statistics */
668  if( downinfer+downconflen+downvsids > 0.0 || upinfer+upconflen+upvsids != 0 )
669  n1startinfers++;
670 
671  if( downinfer+downconflen+downvsids > 0.0 && upinfer+upconflen+upvsids != 0 )
672  n2startinfers++;
673 
674  SCIP_CALL( SCIPinitVarBranchStats(scip, vars[i], 0.0, 0.0, downvsids, upvsids, downconflen, upconflen, downinfer, upinfer, 0.0, 0.0) );
675  }
676  }
677 
678  SCIPdebugMsg(scip, "Rapidlearning added %d conflicts, changed %d bounds, %s primal solution, %s dual bound improvement.\n",
679  nconflicts, nbdchgs, soladded ? "found" : "no", dualboundchg ? "found" : "no");
680 
681  SCIPdebugMsg(scip, "YYY Infervalues initialized on one side: %5.2f %% of variables, %5.2f %% on both sides\n",
682  100.0 * n1startinfers/(SCIP_Real)nvars, 100.0 * n2startinfers/(SCIP_Real)nvars);
683 
684  /* change result pointer */
685  if( nconflicts > 0 || dualboundchg )
686  *result = SCIP_CONSADDED;
687  else if( nbdchgs > 0 )
688  *result = SCIP_REDUCEDDOM;
689 
690  /* free local data */
691  assert(oldnconss != NULL);
692  assert(conshdlrs != NULL);
693  assert(varmapbw != NULL);
694  SCIPfreeBufferArray(scip, &oldnconss);
695  SCIPfreeBufferArray(scip, &conshdlrs);
696  SCIPhashmapFree(&varmapbw);
697 
698 TERMINATE:
699 
700  /* free subproblem */
701  SCIPfreeBufferArray(scip, &subvars);
702  SCIP_CALL( SCIPfree(&subscip) );
703 
704  return SCIP_OKAY;
705 }
706 
707 
708 /*
709  * separator specific interface methods
710  */
711 
712 /** creates the rapidlearning separator and includes it in SCIP */
714  SCIP* scip /**< SCIP data structure */
715  )
716 {
717  SCIP_SEPADATA* sepadata;
718  SCIP_SEPA* sepa;
719 
720  /* create rapidlearning separator data */
721  SCIP_CALL( SCIPallocBlockMemory(scip, &sepadata) );
722 
723  /* include separator */
726  sepaExeclpRapidlearning, NULL,
727  sepadata) );
728 
729  assert(sepa != NULL);
730 
731  /* set non-NULL pointers to callback methods */
732  SCIP_CALL( SCIPsetSepaCopy(scip, sepa, sepaCopyRapidlearning) );
733  SCIP_CALL( SCIPsetSepaFree(scip, sepa, sepaFreeRapidlearning) );
734 
735  /* add rapidlearning separator parameters */
736  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyconflicts",
737  "should the found conflicts be applied in the original SCIP?",
738  &sepadata->applyconflicts, TRUE, DEFAULT_APPLYCONFLICTS, NULL, NULL) );
739 
740  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applybdchgs",
741  "should the found global bound deductions be applied in the original SCIP?",
742  &sepadata->applybdchgs, TRUE, DEFAULT_APPLYBDCHGS, NULL, NULL) );
743 
744  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyinfervals",
745  "should the inference values be used as initialization in the original SCIP?",
746  &sepadata->applyinfervals, TRUE, DEFAULT_APPLYINFERVALS, NULL, NULL) );
747 
748  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/reducedinfer",
749  "should the inference values only be used when " SEPA_NAME " found other reductions?",
750  &sepadata->reducedinfer, TRUE, DEFAULT_REDUCEDINFER, NULL, NULL) );
751 
752  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applyprimalsol",
753  "should the incumbent solution be copied to the original SCIP?",
754  &sepadata->applyprimalsol, TRUE, DEFAULT_APPLYPRIMALSOL, NULL, NULL) );
755 
756  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/applysolved",
757  "should a solved status be copied to the original SCIP?",
758  &sepadata->applysolved, TRUE, DEFAULT_APPLYSOLVED, NULL, NULL) );
759 
760  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/contvars",
761  "should rapid learning be applied when there are continuous variables?",
762  &sepadata->contvars, TRUE, DEFAULT_CONTVARS, NULL, NULL) );
763 
764  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/contvarsquot",
765  "maximal portion of continuous variables to apply rapid learning",
766  &sepadata->contvarsquot, TRUE, DEFAULT_CONTVARSQUOT, 0.0, 1.0, NULL, NULL) );
767 
768  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/lpiterquot",
769  "maximal fraction of LP iterations compared to node LP iterations",
770  &sepadata->lpiterquot, TRUE, DEFAULT_LPITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
771 
772  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnvars",
773  "maximum problem size (variables) for which rapid learning will be called",
774  &sepadata->maxnvars, TRUE, DEFAULT_MAXNVARS, 0, INT_MAX, NULL, NULL) );
775 
776  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnconss",
777  "maximum problem size (constraints) for which rapid learning will be called",
778  &sepadata->maxnconss, TRUE, DEFAULT_MAXNCONSS, 0, INT_MAX, NULL, NULL) );
779 
780  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxnodes",
781  "maximum number of nodes considered in rapid learning run",
782  &sepadata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) );
783 
784  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/minnodes",
785  "minimum number of nodes considered in rapid learning run",
786  &sepadata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) );
787 
788  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/copycuts",
789  "should all active cuts from cutpool be copied to constraints in subproblem?",
790  &sepadata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
791 
792  return SCIP_OKAY;
793 }
#define SEPA_USESSUBSCIP
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:11721
#define DEFAULT_REDUCEDINFER
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:5095
SCIP_Real SCIPgetVarAvgInferences(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:26198
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
Definition: scip.c:22118
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:814
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Definition: cons.c:8140
#define SEPA_FREQ
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
Definition: scip.c:41382
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:46099
#define DEFAULT_MINNODES
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:6541
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17166
#define DEFAULT_CONTVARSQUOT
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
Definition: scip.c:45876
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip.c:12071
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17222
#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:11505
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4485
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip.c:38881
#define FALSE
Definition: def.h:64
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2765
SCIP_Real SCIPgetVarVSIDS(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:25956
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip.c:4126
int SCIPgetNActivePricers(SCIP *scip)
Definition: scip.c:5655
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:3843
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
Definition: scip.c:45888
#define TRUE
Definition: def.h:63
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
Definition: sepa.c:632
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:21255
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:5069
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:22234
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip.h:21907
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2903
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:45751
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:21937
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip.c:696
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip.h:21890
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
Definition: scip.c:7367
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip.c:4741
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
Definition: cons.c:8150
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1260
#define SCIPdebugMsg
Definition: scip.h:451
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:4202
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
Definition: scip.c:44425
int SCIPgetNContVars(SCIP *scip)
Definition: scip.c:11811
#define DEFAULT_APPLYCONFLICTS
SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
Definition: sepa.c:543
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip.c:11948
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
Definition: scip.c:25045
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17176
int SCIPsepaGetFreq(SCIP_SEPA *sepa)
Definition: sepa.c:676
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip.c:15777
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip.c:8140
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip.c:4338
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip.c:12410
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:38044
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:26316
#define DEFAULT_APPLYBDCHGS
SCIP_Real SCIPgetDualbound(SCIP *scip)
Definition: scip.c:42302
#define SEPA_DELAY
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip.c:4567
int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
Definition: sepa.c:759
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip.c:921
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip.c:15616
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip.c:3056
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip.c:45519
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7881
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
Definition: cons.c:8100
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16552
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2798
void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
Definition: sepa.c:553
#define NULL
Definition: lpi_spx1.cpp:137
#define SEPA_PRIORITY
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
Definition: scip.c:4504
#define SCIP_CALL(x)
Definition: def.h:306
SCIP_Real SCIPgetVarAvgConflictlength(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
Definition: scip.c:26144
#define DEFAULT_MAXNCONSS
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:46112
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:2524
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:7325
SCIP_Longint SCIPsepaGetNCalls(SCIP_SEPA *sepa)
Definition: sepa.c:749
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:21925
#define SCIP_Bool
Definition: def.h:61
int SCIPgetNImplVars(SCIP *scip)
Definition: scip.c:11766
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip.c:11078
int SCIPgetDepth(SCIP *scip)
Definition: scip.c:42094
#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:39843
#define DEFAULT_APPLYINFERVALS
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip.c:4625
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8080
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
Definition: cons.c:8050
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17014
SCIP_Longint SCIPgetNConflictConssFound(SCIP *scip)
Definition: scip.c:42011
int SCIPgetNSols(SCIP *scip)
Definition: scip.c:38832
SCIP_RETCODE SCIPupdateLocalDualbound(SCIP *scip, SCIP_Real newbound)
Definition: scip.c:13283
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:38090
SCIP_Longint SCIPgetNConflictConssApplied(SCIP *scip)
Definition: scip.c:42068
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
Definition: scip.c:45827
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:11676
int SCIPgetNVars(SCIP *scip)
Definition: scip.c:11631
#define SCIP_REAL_MAX
Definition: def.h:136
static SCIP_DECL_SEPAFREE(sepaFreeRapidlearning)
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
Definition: scip.c:7383
SCIP_RETCODE SCIPincludeSepaRapidlearning(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
Definition: scip.c:12679
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip.c:27323
SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
Definition: scip.c:38222
#define SCIP_Real
Definition: def.h:135
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip.c:1138
#define MIN(x, y)
Definition: memory.c:75
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
Definition: cons.c:8070
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
Definition: cons.c:8060
rapidlearning separator
#define SCIP_Longint
Definition: def.h:120
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip.c:4090
#define DEFAULT_APPLYPRIMALSOL
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16717
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:37909
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip.c:13668
#define SEPA_NAME
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:45777
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17232
SCIP_Real SCIPgetUpperbound(SCIP *scip)
Definition: scip.c:42472
#define DEFAULT_MAXNODES
#define SEPA_DESC
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2846
#define DEFAULT_APPLYSOLVED
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
Definition: var.c:16869
#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:4258
#define DEFAULT_CONTVARS
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip.c:5020
static SCIP_DECL_SEPACOPY(sepaCopyRapidlearning)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip.c:4683
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:4176
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip.c:774
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:37005