misc.c
Go to the documentation of this file.
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
104 else if( i < norigvars1 && (j >= norigvars2 || SCIPvarGetProbindex(origvars1[i]) < SCIPvarGetProbindex(origvars2[j])) )
110 else if( j < norigvars2 && (i >= norigvars1 || SCIPvarGetProbindex(origvars1[i]) > SCIPvarGetProbindex(origvars2[j])) )
140 SCIP_Bool* violatesvarbnds /* pointer to variable to store whether the solution violates orig varbnds (can be NULL) */
187 if( GCGgetDecompositionMode(gcg) != GCG_DECMODE_ORIGINAL && !GCGmasterIsSolValid(gcg, mastersol) )
206 SCIP_CALL( SCIPgetVarsData(masterprob, &mastervarsall, &nmastervarsall, NULL, NULL, NULL, NULL) );
269 SCIP_CALL( SCIPgetVarsData(masterprob, &mastervarsall, &nmastervarsall, NULL, NULL, NULL, NULL) );
356 /* we also want to take into account variables representing rays, that have a small value (between normal and feas eps),
368 /* the original variable is a linking variable: just transfer the solution value of the direct copy (this is done later) */
372 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origvars[j]), origvals[j] * mastervals[i], SCIPvarGetName(mastervars[i]));
381 /* variable was directly transferred to the master problem (only in linking conss or linking variable) */
390 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origvars[0]), origvals[0] * mastervals[i], SCIPvarGetName(mastervars[i]));
417 /* the original variable is a linking variable: just transfer the solution value of the direct copy (this is done above) */
430 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origpricingvars[norigpricingvars-1]), mastervals[i] * origvals[j], SCIPvarGetName(mastervars[i]));
432 SCIP_CALL( SCIPincSolVal(origprob, *origsol, origpricingvars[norigpricingvars-1], mastervals[i] * origvals[j]) );
438 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origpricingvars[blocknrs[blocknr]]), origvals[j], SCIPvarGetName(mastervars[i]) );
440 SCIP_CALL( SCIPincSolVal(origprob, *origsol, origpricingvars[blocknrs[blocknr]], origvals[j]) );
468 assert(SCIPisFeasGE(masterprob, mastervals[i], 0.0) && SCIPisFeasLT(masterprob, mastervals[i], 1.0));
487 /* the original variable is a linking variable: just transfer the solution value of the direct copy (this is done above) */
501 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origpricingvars[norigpricingvars-1]), origvals[j] * increaseval, SCIPvarGetName(mastervars[i]) );
503 SCIP_CALL( SCIPincSolVal(origprob, *origsol, origpricingvars[norigpricingvars-1], origvals[j] * increaseval) );
508 SCIPdebugMessage("Increasing value of %s by %f because of %s\n", SCIPvarGetName(origpricingvars[blocknrs[blocknr]]), origvals[j] * increaseval, SCIPvarGetName(mastervars[i]) );
509 SCIP_CALL( SCIPincSolVal(origprob, *origsol, origpricingvars[blocknrs[blocknr]], origvals[j] * increaseval) );
520 /* if the value assigned to the block is equal to 1, this block is full and we take the next block */
563 if( !SCIPisFeasGE(origprob, SCIPgetSolVal(origprob, *origsol, vars[i]), lb) || !SCIPisFeasLE(origprob, SCIPgetSolVal(origprob, *origsol, vars[i]), ub) )
574/* transforms given values of the given original variables into values of the given master variables
619 /* variable belongs to no block (or is a linking variable), so it was transferred directly to the master problem,
640 if ( SCIPisFeasEQ(origprob, SCIPvarGetLbGlobal(varmastervars[0]), SCIPvarGetUbGlobal(varmastervars[0])) )
651 SCIPdebugMessage("OrigVar %s [%f,%f]\n", SCIPvarGetName(origvars[i]), SCIPvarGetLbGlobal(origvars[i]),
660 /* variable belongs to exactly one block, so we have to look at all master variables and increase their values
749 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, "\nOriginal Program Solution statistics:\n");
773 if( SCIPgetStage(origprob) >= SCIP_STAGE_PRESOLVING && GCGgetDecompositionMode(gcg) != GCG_DECMODE_ORIGINAL )
813 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, "\nDetection did not take place so far\n");
817 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, "\nStart writing complete detection information:\n");
GCG Benders' decomposition.
SCIP_Bool GCGdetectionTookPlace(GCG *gcg, SCIP_Bool original)
Definition: cons_decomp.cpp:4722
SCIP_RETCODE GCGconshdlrDecompPrintDetectorStatistics(GCG *gcg, FILE *file)
display statistics about detectors
Definition: cons_decomp.cpp:4533
SCIP_RETCODE GCGconshdlrDecompPrintScoreStatistics(GCG *gcg, FILE *file)
display statistics about scores
Definition: cons_decomp.cpp:4555
constraint handler for structure detection
SCIP_RETCODE GCGprintDecompStatistics(GCG *gcg, FILE *file, GCG_DECOMP *decomp)
Definition: decomp.c:3827
#define SCIP_MAXSTRLEN
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define EPSEQ(x, y, eps)
#define SCIP_CALL(x)
#define TRUE
#define FALSE
GCG interface methods.
sorting functions, adapted from SCIP's sorttpl to include userdata
GCG_EXPORT void GCGsortPtrPtr(void **ptrarray1, void **ptrarray2, GCG_DECL_SORTPTRCOMP((*ptrcomp)), void *userdata, int len)
SCIP_VAR ** GCGoriginalVarGetMastervars(SCIP_VAR *var)
Definition: gcgvar.c:666
SCIP_VAR ** GCGpricingVarGetOrigvars(SCIP_VAR *var)
Definition: gcgvar.c:1100
SCIP_Real * GCGoriginalVarGetMastervals(SCIP_VAR *var)
Definition: gcgvar.c:684
SCIP_VAR * GCGoriginalVarGetPricingVar(SCIP_VAR *var)
Definition: gcgvar.c:281
SCIP_VAR * GCGpricingVarGetOriginalVar(SCIP_VAR *var)
Definition: gcgvar.c:590
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
SCIP_RETCODE GCGmasterPrintSimplexIters(GCG *gcg, FILE *file)
Definition: pricer_gcg.cpp:6736
SCIP_Bool GCGmasterIsSolValid(GCG *gcg, SCIP_SOL *mastersol)
Definition: pricer_gcg.cpp:6681
void GCGpricerPrintPricingStatistics(GCG *gcg, FILE *file)
Definition: pricer_gcg.cpp:5875
SCIP_RETCODE GCGtransformMastersolToOrigsol(GCG *gcg, SCIP_SOL *mastersol, SCIP_SOL **origsol, SCIP_Bool ignorelocalvarbnds, SCIP_Bool *violatesvarbnds)
Definition: misc.c:135
SCIP_RETCODE GCGprintPartitionInformation(GCG *gcg, FILE *file)
Definition: cons_decomp.cpp:1982
SCIP_RETCODE GCGprintBlockcandidateInformation(GCG *gcg, FILE *file)
Definition: cons_decomp.cpp:1946
SCIP_RETCODE GCGprintCompleteDetectionTime(GCG *gcg, FILE *file)
Definition: cons_decomp.cpp:1968
SCIP_RETCODE GCGprintDecompInformation(GCG *gcg, FILE *file)
Definition: cons_decomp.cpp:2000
GCG_EXPORT SCIP_SOL * GCGgetBendersRelaxationSol(GCG *gcg)
Definition: relax_gcg.c:5273
SCIP_Real GCGtransformOrigvalsToMastervals(GCG *gcg, SCIP_VAR **origvars, SCIP_Real *origvals, int norigvars, SCIP_VAR **mastervars, SCIP_Real *mastervals, int nmastervars)
Definition: misc.c:576
GCG_EXPORT GCG_DECMODE GCGgetDecompositionMode(GCG *gcg)
Definition: relax_gcg.c:5294
SCIP_RETCODE GCGprintCompleteDetectionStatistics(GCG *gcg, FILE *file)
Definition: misc.c:801
SCIP_STAGE SCIPgetStage(SCIP *scip)
const char * SCIPgetProbName(SCIP *scip)
int SCIPgetNContVars(SCIP *scip)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
int SCIPgetNFixedVars(SCIP *scip)
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_BENDERS * SCIPfindBenders(SCIP *scip, const char *name)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_PRICER * SCIPfindPricer(SCIP *scip, const char *name)
SCIP_RELAX * SCIPfindRelax(SCIP *scip, const char *name)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_RETCODE SCIPincSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real incval)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
void SCIPprintSolutionStatistics(SCIP *scip, FILE *file)
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
int SCIPsnprintf(char *t, int len, const char *s,...)
#define NULL
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: class_conspartition.cpp:44
GCG variable pricer.
public methods for GCG variables
#define SCIPdebugMessage
GCG relaxator.
Prints information about the best decomposition.
Definition: struct_decomp.h:53
Definition: struct_gcg.h:55
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE
SCIP_STAGE_PRESOLVING
SCIP_STAGE_SOLVING
SCIP_STAGE_PRESOLVED
SCIP_VARTYPE_INTEGER