sepa_rapidlearning.c
Go to the documentation of this file.
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 38 #define SEPA_DELAY FALSE /**< should separation method be delayed, if other separators found cuts? */ 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? 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? */ 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 */ 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 */ 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? */ 77 int maxnconss; /**< maximum problem size (constraints) for which rapid learning will be called */ 80 SCIP_Bool contvars; /**< should rapid learning be applied when there are continuous variables? */ 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 185 SCIP_CONSHDLR** conshdlrs; /* array of constraint handler's that might that might obtain conflicts */ 208 SCIP_Bool disabledualreductions; /* TRUE, if dual reductions in sub-SCIP are not valid for original SCIP, 238 if( sepadata->contvars && SCIPgetNContVars(scip) > sepadata->contvarsquot * SCIPgetNVars(scip) ) 245 /* if the separator should be exclusive to the root node, this prevents multiple calls due to restarts */ 267 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) ); 297 * If the copy is not valid, it should be a relaxation of the problem (constraints might have failed to be copied, 299 * By disabling dual presolving, conflicts found in a relaxation are still valid for the original problem. 324 SCIPwarningMessage(scip, "unfixing parameter nodeselection/dfs/stdpriority in subscip of rapidlearning\n"); 363 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */ 415 /* allocate memory for constraints storage. Each constraint that will be created from now on will be a conflict. 443 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop. 450 SCIPwarningMessage(scip, "Error while solving subproblem in rapid learning separator; sub-SCIP terminated with code <%d>\n",retcode); 461 SCIPdebugMessage("finish after %" SCIP_LONGINT_FORMAT " successful conflict calls.\n", SCIPgetNConflictConssApplied(subscip)); 464 else if( (sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPisFeasLT(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) ) 470 if( SCIPgetNSols(subscip) > 0 && SCIPisFeasLE(scip, SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip) ) ) 472 SCIPdebugMessage(" - there was a better solution (%f < %f)\n",SCIPgetUpperbound(subscip), SCIPgetUpperbound(scip)); 480 SCIPdebugMessage(" - there were %" SCIP_LONGINT_FORMAT " conflict constraints created\n", SCIPgetNConflictConssApplied(subscip)); 490 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop. 497 SCIPwarningMessage(scip, "Error while solving subproblem in rapid learning separator; sub-SCIP terminated with code <%d>\n",retcode); 512 if( sepadata->applyprimalsol && SCIPgetNSols(subscip) > 0 && SCIPfindHeur(scip, "trysol") != NULL ) 519 * due to numerics, it might happen that not all solutions are feasible -> try all solutions until was declared to be feasible 532 if( !soladded || !SCIPisEQ(scip, SCIPgetSolOrigObj(subscip, subsols[i-1]), SCIPgetSolOrigObj(subscip, subsols[0])) ) 539 && (SCIPgetStatus(subscip) == SCIP_STATUS_OPTIMAL || SCIPgetStatus(subscip) == SCIP_STATUS_INFEASIBLE) ) 544 SCIPdebugMessage("Update old dualbound %g to new dualbound %g.\n", SCIPgetDualbound(scip), SCIPretransformObj(scip, SCIPgetDualbound(subscip))); 546 SCIP_CALL( SCIPupdateLocalDualbound(scip, SCIPretransformObj(scip, SCIPgetDualbound(subscip))) ); 552 if( sepadata->applyconflicts && !disabledualreductions && SCIPgetNConflictConssApplied(subscip) > 0 ) 563 SCIP_CALL( SCIPhashmapCreate(&consmap, SCIPblkmem(scip), SCIPcalcHashtableSize(hashtablesize)) ); 590 SCIP_CALL( SCIPgetConsCopy(subscip, scip, cons, &conscopy, conshdlrs[i], varmapbw, consmap, NULL, 591 SCIPconsIsInitial(cons), SCIPconsIsSeparated(cons), SCIPconsIsEnforced(cons), SCIPconsIsChecked(cons), 603 SCIPdebugMessage("failed to copy conflict constraint %s back to original SCIP\n", SCIPconsGetName(cons)); 625 SCIP_CALL( SCIPtightenVarUb(scip, vars[i], SCIPvarGetUbGlobal(subvars[i]), FALSE, &infeasible, &tightened) ); 629 SCIP_CALL( SCIPtightenVarLb(scip, vars[i], SCIPvarGetLbGlobal(subvars[i]), FALSE, &infeasible, &tightened) ); 638 /* @todo use different nbranching counters for pseudo cost and inference values and update inference values in the tree */ 639 if( sepadata->applyinfervals && SCIPgetDepth(scip) == 0 && (!sepadata->reducedinfer || soladded || nbdchgs+nconflicts > 0) ) 667 SCIP_CALL( SCIPinitVarBranchStats(scip, vars[i], 0.0, 0.0, downvsids, upvsids, downconflen, upconflen, downinfer, upinfer, 0.0, 0.0) ); 671 SCIPdebugPrintf("XXX Rapidlearning added %d conflicts, changed %d bounds, %s primal solution, %s dual bound improvement.\n", nconflicts, nbdchgs, soladded ? "found" : "no", 674 SCIPdebugPrintf("YYY Infervalues initialized on one side: %5.2f %% of variables, %5.2f %% on both sides\n", 714 SCIP_CALL( SCIPincludeSepaBasic(scip, &sepa, SEPA_NAME, SEPA_DESC, SEPA_PRIORITY, SEPA_FREQ, SEPA_MAXBOUNDDIST,
Definition: type_result.h:33 SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name) Definition: scip.c:5878 Definition: struct_scip.h:53 void SCIPwarningMessage(SCIP *scip, const char *formatstr,...) Definition: scip.c:1248 SCIP_Real SCIPgetVarAvgConflictlength(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir) Definition: scip.c:23769 SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41920 SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr) Definition: cons.c:4258 static SCIP_DECL_SEPAEXECLP(sepaExeclpRapidlearning) Definition: sepa_rapidlearning.c:179 Definition: struct_var.h:196 SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize) Definition: misc.c:2057 SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value) Definition: scip.c:4046 SCIP_RETCODE SCIPincludeSepaRapidlearning(SCIP *scip) Definition: sepa_rapidlearning.c:707 SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored) Definition: scip.c:36299 SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value) Definition: scip.c:4109 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 *success) Definition: scip.c:2365 public methods for problem variables void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin) Definition: misc.c:2116 Definition: struct_sepa.h:36 SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree))) Definition: scip.c:6718 SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded) Definition: scip.c:2883 Definition: struct_sol.h:50 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:3547 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:3573 SCIP_RETCODE SCIPupdateLocalDualbound(SCIP *scip, SCIP_Real newbound) Definition: scip.c:12252 Definition: struct_misc.h:101 SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid) Definition: scip.c:3254 Definition: type_result.h:35 Definition: struct_cons.h:36 Definition: type_paramset.h:54 Definition: struct_cons.h:116 Definition: type_stat.h:52 SCIP_Real SCIPgetVarAvgInferences(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir) Definition: scip.c:23823 SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur) Definition: scip.c:34002 SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet) Definition: scip.c:4457 Definition: type_retcode.h:33 SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals) Definition: scip.c:35020 Definition: type_result.h:42 Definition: struct_heur.h:75 SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible) Definition: scip.c:22681 SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened) Definition: scip.c:20193 Definition: type_var.h:55 SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value) Definition: scip.c:4001 SCIP_Longint SCIPgetNConflictConssFound(SCIP *scip) Definition: scip.c:38057 SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy))) Definition: scip.c:6702 Definition: type_var.h:54 SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet) Definition: scip.c:4382 Definition: type_set.h:43 SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet) Definition: scip.c:4431 static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success) Definition: sepa_rapidlearning.c:94 Definition: type_history.h:34 static SCIP_DECL_SEPAFREE(sepaFreeRapidlearning) Definition: sepa_rapidlearning.c:159 Definition: type_history.h:35 Definition: type_result.h:43 SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2) Definition: scip.c:41933 SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened) Definition: scip.c:20299 SCIP_Longint SCIPgetNConflictConssApplied(SCIP *scip) Definition: scip.c:38114 rapidlearning separator SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals) Definition: scip.c:34885 SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup) Definition: scip.c:19399 SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value) Definition: scip.c:3938 SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars) Definition: scip.c:10572 SCIP_Real SCIPgetVarVSIDS(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir) Definition: scip.c:23581 SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value) Definition: scip.c:3797 SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image) Definition: misc.c:2094 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:23941 Definition: type_paramset.h:53 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:6660 Definition: objbranchrule.h:33 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:3629 default SCIP plugins Definition: type_stat.h:53 static SCIP_DECL_SEPACOPY(sepaCopyRapidlearning) Definition: sepa_rapidlearning.c:145 |