46ScipParaDiffSubproblem::ScipParaDiffSubproblem(
50 SCIP_VAR **newBranchVars,
51 SCIP_Real *newBranchBounds,
52 SCIP_BOUNDTYPE *newBoundTypes,
54 SCIP_CONS **addedConss
55 ) : localInfoIncluded(0),
56 nBoundChanges(0), indicesAmongSolvers(0), branchBounds(0), boundTypes(0),
60 bendersLinearConss(0),
69 int nParentBranchVars = 0;
74 if( parentDiffSubproblem )
85 if( parentDiffSubproblem )
87 for( i = 0; i < nParentBranchVars; i ++ )
96 for(
int v = nNewBranchVars -1 ; v >= 0; --v )
98 SCIP_VAR *transformVar = newBranchVars[v];
99 SCIP_Real scalar = 1.0;
100 SCIP_Real constant = 0.0;
101 SCIP_CALL_ABORT( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) );
102 if( transformVar == NULL )
continue;
103 if( SCIPvarGetIndex(transformVar) >= scipParaSolver->
getNOrgVars() )
continue;
108 scalar == 1.0 && constant == 0.0 )
130 branchBounds[i] = ( newBranchBounds[v] - constant ) / scalar;
137 boundTypes[i] = SCIP_BoundType(1 - newBoundTypes[v]);
139 if( SCIPvarGetType(transformVar) != SCIP_VARTYPE_CONTINUOUS )
143 if( SCIPvarGetProbindex(transformVar) >= scipParaSolver->
getNOrgVars() )
156 std::cout <<
"ORG(L):"
157 << SCIPvarGetName(transformVar) <<
":"
158 << scipParaSolver->
getOrgVarLb(SCIPvarGetProbindex(transformVar))
162 << scipParaSolver->
getOrgVarUb(SCIPvarGetProbindex(transformVar)) << std::endl;
174 std::cout <<
"ORG(U):"
175 << SCIPvarGetName(transformVar) <<
":"
176 << scipParaSolver->
getOrgVarLb(SCIPvarGetProbindex(transformVar))
180 << scipParaSolver->
getOrgVarUb(SCIPvarGetProbindex(transformVar)) << std::endl;
209 assert( SCIPvarGetType(transformVar) != SCIP_VARTYPE_BINARY
218 if( SCIPvarGetProbindex(transformVar) >= scipParaSolver->
getNOrgVars() )
233 std::cout <<
"ORG(L):"
234 << SCIPvarGetName(transformVar) <<
":"
235 << scipParaSolver->
getOrgVarLb(SCIPvarGetProbindex(transformVar))
239 << scipParaSolver->
getOrgVarUb(SCIPvarGetProbindex(transformVar)) << std::endl;
255 std::cout <<
"ORG(U):"
256 << SCIPvarGetName(transformVar) <<
":"
257 << scipParaSolver->
getOrgVarLb(SCIPvarGetProbindex(transformVar))
261 << scipParaSolver->
getOrgVarUb(SCIPvarGetProbindex(transformVar)) << std::endl;
297 if( nAddedConss > 0 )
300 int nLinearConss = 0;
301 int nSetppcConss = 0;
302 for(
int c = 0; c < nAddedConss; c++ )
304 SCIP_CONS* cons = addedConss[c];
305 assert(cons != NULL);
306 const char *conshdlrname = SCIPconshdlrGetName(SCIPconsGetHdlr(cons));
307 if( std::strcmp(conshdlrname,
"linear") == 0 )
311 else if( std::strcmp(conshdlrname,
"setppc") == 0 )
315 else if( std::strcmp(conshdlrname,
"conjunction") == 0 )
321 THROW_LOGICAL_ERROR2(
"invalid constraint type sets on ScipParaDiffSubproblem; consname = ", conshdlrname);
356#ifdef UG_DEBUG_SOLUTION
357 includeOptimalSol = 0;
367 SCIP_CONS **addedConss
370 std::list<BranchConsLinearInfoPtr> branchConsList;
372 int lNewConsNames = 0;
374 for(
int c = 0; c < nAddedConss; ++c )
376 SCIP_CONS* cons = addedConss[c];
377 assert(cons != NULL);
378 const char *conshdlrname = SCIPconshdlrGetName(SCIPconsGetHdlr(cons));
379 if( std::strcmp(conshdlrname,
"linear") != 0 )
continue;
382 SCIP_Bool success = FALSE;
384 SCIP_CALL_ABORT(SCIPgetConsNVars(scip,cons,&ncols, &success));
393 branchConsLinearInfo->
linearCoefs =
new double[ncols];
395 if( !SCIPisInfinity(scip, -SCIPgetLhsLinear(scip, cons)) )
397 lhs = SCIPgetLhsLinear(scip, addedConss[c]);
401 lhs = -SCIPinfinity(scip);
403 if( !SCIPisInfinity(scip, SCIPgetRhsLinear(scip, cons)) )
405 rhs = SCIPgetRhsLinear(scip, addedConss[c]);
409 rhs = SCIPinfinity(scip);
412 SCIP_VAR** vars = SCIPgetVarsLinear(scip, cons);
413 SCIP_Real* vals = SCIPgetValsLinear(scip, cons);
416 bool removeConss =
false;
417 for( i = 0; i < ncols; ++i )
419 SCIP_VAR *transformVar = vars[i];
420 SCIP_Real scalar = vals[i];
421 SCIP_Real constant = 0.0;
422 if( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) == SCIP_INVALIDDATA )
424 if( transformVar == NULL )
427 if( !SCIPisInfinity(scip, -SCIPgetLhsLinear(scip, cons)) )
431 if( !SCIPisInfinity(scip, SCIPgetRhsLinear(scip, cons)) )
455 assert( !SCIPisInfinity(scip, -SCIPgetLhsLinear(scip, cons)) == !SCIPisInfinity(scip, -lhs) );
456 assert( !SCIPisInfinity(scip, SCIPgetRhsLinear(scip, cons)) == !SCIPisInfinity(scip, rhs) );
459 branchConsLinearInfo->
consName =
new char[std::strlen(SCIPconsGetName(cons))+1];
460 lNewConsNames += ( std::strlen(SCIPconsGetName(cons)) + 1);
461 std::strcpy(branchConsLinearInfo->
consName, SCIPconsGetName(cons));
462 branchConsList.push_back(branchConsLinearInfo);
468 delete branchConsLinearInfo;
469 if( removeConss ==
true )
476 THROW_LOGICAL_ERROR1(
"Something wrong to make a branching linear constraint for original problem");
480 assert(
static_cast<int>(branchConsList.size()) == (nLinearConss - nRemoved) );
484 int nParentConss = 0;
489 if( nParentConss > 0 || branchConsList.size() > 0 )
493 if( nParentConss > 0 )
511 char *parentConsName = 0;
514 if( nParentConss > 0 )
518 for(; i < nParentConss; i++ )
530 std::strcpy(destConsName,parentConsName);
531 destConsName += (std::strlen(parentConsName) + 1);
532 parentConsName += (std::strlen(parentConsName) + 1);
536 int nNewBranchLinearConss = branchConsList.size();
537 for(; i < ( nParentConss + nNewBranchLinearConss ); i++ )
539 assert(!branchConsList.empty());
541 branchConsList.pop_front();
553 std::strcpy(destConsName, branchConsLinearInfo->
consName);
554 destConsName += std::strlen(branchConsLinearInfo->
consName) + 1;
557 delete [] branchConsLinearInfo->
consName;
558 delete branchConsLinearInfo;
570 SCIP_CONS **addedConss
573 std::list<BranchConsSetppcInfoPtr> branchConsList;
575 int lNewConsNames = 0;
577 for(
int c = 0; c < nAddedConss; ++c )
579 SCIP_CONS* cons = addedConss[c];
580 assert(cons != NULL);
581 const char *conshdlrname = SCIPconshdlrGetName(SCIPconsGetHdlr(cons));
582 if( std::strcmp(conshdlrname,
"setppc") != 0 )
continue;
585 SCIP_Bool success = FALSE;
587 SCIP_CALL_ABORT(SCIPgetConsNVars(scip,cons,&ncols, &success));
595 branchConsSetppcInfo->
setppcType = SCIPgetTypeSetppc(scip, cons);
598 SCIP_VAR** vars = SCIPgetVarsSetppc(scip, cons);
601 bool removeConss =
false;
602 for( i = 0; i < ncols; ++i )
604 SCIP_VAR *transformVar = vars[i];
605 SCIP_Real scalar = 1.0;
606 SCIP_Real constant = 0.0;
607 if( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) == SCIP_INVALIDDATA )
609 if( transformVar == NULL )
627 branchConsSetppcInfo->
idxSetppcVars[i] = SCIPvarGetIndex(transformVar);
633 branchConsSetppcInfo->
consName =
new char[std::strlen(SCIPconsGetName(cons))+1];
634 lNewConsNames += std::strlen(SCIPconsGetName(cons))+1;
635 std::strcpy(branchConsSetppcInfo->
consName, SCIPconsGetName(cons));
636 branchConsList.push_back(branchConsSetppcInfo);
641 delete branchConsSetppcInfo;
642 if( removeConss ==
true )
649 THROW_LOGICAL_ERROR1(
"Something wrong to make a branching linear constraint for original problem");
653 assert(
static_cast<int>(branchConsList.size()) == (nSetppcConss - nRemoved) );
657 int nParentConss = 0;
662 if( nParentConss > 0 || branchConsList.size() > 0 )
666 if( nParentConss > 0 )
682 char *parentConsName = 0;
685 if( nParentConss > 0 )
689 for(; i < nParentConss; i++ )
698 std::strcpy(destConsName,parentConsName);
699 destConsName += (std::strlen(parentConsName) + 1);
700 parentConsName += (std::strlen(parentConsName) + 1);
704 int nNewBranchSetppcConss = branchConsList.size();
705 for(; i < ( nParentConss + nNewBranchSetppcConss ); i++ )
707 assert(!branchConsList.empty());
709 branchConsList.pop_front();
717 std::strcpy(destConsName, branchConsSetppcInfo->
consName);
718 destConsName += (std::strlen(branchConsSetppcInfo->
consName) + 1);
720 delete [] branchConsSetppcInfo->
consName;
721 delete branchConsSetppcInfo;
733 std::list<LocalNodeInfoPtr> localCutsList;
740 cuts = SCIPgetPoolCuts(scip);
741 ncuts = SCIPgetNPoolCuts(scip);
744 int *orgVarIndexies =
new int[scipParaSolver->
getNOrgVars()];
745 double *orgVarCoefficients =
new double[scipParaSolver->
getNOrgVars()];
747 for(
int c = 0; c < ncuts; ++c )
750 bool removeConss =
false;
751 row = SCIPcutGetRow(cuts[c]);
752 assert(!SCIProwIsLocal(row));
753 assert(!SCIProwIsModifiable(row));
754 if( SCIPcutGetAge(cuts[c]) == 0 && SCIProwIsInLP(row) )
761 cols = SCIProwGetCols(row);
762 ncols = SCIProwGetNNonz(row);
769 if( !SCIPisInfinity(scip, -SCIProwGetLhs(row)) )
771 lhs = SCIProwGetLhs(row) - SCIProwGetConstant(row);
775 lhs = -SCIPinfinity(scip);
777 if( !SCIPisInfinity(scip, SCIProwGetRhs(row)) )
779 rhs = SCIProwGetRhs(row) - SCIProwGetConstant(row);
783 rhs = SCIPinfinity(scip);
786 for(
int j = 0; j < scipParaSolver->
getNOrgVars(); j++ )
788 orgVarIndexies[j] = -1;
789 orgVarCoefficients[j] = 0.0;
791 SCIP_Real *vals = SCIProwGetVals(row);
792 for( i = 0; i < ncols; ++i )
795 SCIP_VAR *transformVar = SCIPcolGetVar(cols[i]);
796 SCIP_Real scalar = vals[i];
797 SCIP_Real constant = 0.0;
798 if( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) == SCIP_INVALIDDATA )
803 if( transformVar == NULL )
809 if( !SCIPisInfinity(scip, -SCIProwGetLhs(row)) )
813 if( !SCIPisInfinity(scip, SCIProwGetRhs(row)) )
833 index = SCIPvarGetIndex(transformVar);
836 assert( index >= 0 && index < scipParaSolver->getNOrgVars() );
837 if( orgVarIndexies[index] == -1 )
839 orgVarIndexies[index] = index;
840 orgVarCoefficients[index] = scalar;
844 orgVarCoefficients[index] += scalar;
845 std::cout <<
"*** Duplicate index = " << index <<
", value = " << scalar << std::endl;
850 assert( !SCIPisInfinity(scip, -SCIProwGetLhs(row)) == !SCIPisInfinity(scip, -lhs) );
851 assert( !SCIPisInfinity(scip, SCIProwGetRhs(row)) == !SCIPisInfinity(scip, rhs) );
853 for (
int j = 0; j < scipParaSolver->
getNOrgVars(); j++ )
855 if( orgVarIndexies[j] >= 0 )
858 localNodeInfo->
linearCoefs[nRowCols] = orgVarCoefficients[j];
862 assert( nRowCols > 0 );
867 localCutsList.push_back(localNodeInfo);
873 delete localNodeInfo;
874 if( removeConss ==
true )
886 delete [] orgVarIndexies;
887 delete [] orgVarCoefficients;
894 int nParentConss = 0;
895 if( parentDiffSubproblem && parentDiffSubproblem->
linearConss )
900 if( conflictConsList ) nConflicts += conflictConsList->size();
901 if( nParentConss > 0 || nConflicts > 0 || localCutsList.size() > 0 )
915 for(; i < nParentConss; i++ )
929 int nLocalCuts = localCutsList.size();
930 for(; i < ( nParentConss + nLocalCuts ); i++ )
932 assert(!localCutsList.empty());
934 localCutsList.pop_front();
950 if( i < linearConss->nLinearConss )
952 assert( conflictConsList );
953 std::list<LocalNodeInfoPtr>::iterator pos;
954 pos = conflictConsList->begin();
957 assert( pos != conflictConsList->end() );
974#if SCIP_APIVERSION > 39
975 std::list<LocalNodeInfoPtr> bendersCutsList;
979 int nVars = SCIPgetNVars(scip);
980 SCIP_Var **vars =
new SCIP_Var*[nVars];
981 SCIP_Real *values =
new SCIP_Real[nVars];
982 int nActiveBenders = SCIPgetNActiveBenders(scip);
983 SCIP_BENDERS** benders = SCIPgetBenders(scip);
985 for(
int i = 0; i < nActiveBenders; i++ )
987 int nCuts = SCIPbendersGetNStoredCuts(benders[i]);
988 for (
int cutidx = 0; cutidx < nCuts; cutidx++ )
993 SCIP_CALL_ABORT( SCIPbendersGetStoredCutOrigData(benders[i], cutidx, &vars, &values, &lhs, &rhs, &nVarsInCut, nVars) );
994 assert(nVarsInCut <= nVars);
998 localNodeInfo->
linearCoefs =
new double[nVarsInCut];
999 for(
int j = 0; j < nVarsInCut; j++ )
1013 bendersCutsList.push_back(localNodeInfo);
1026 if( nParentConss > 0 || bendersCutsList.size() > 0 )
1040 for(; i < nParentConss; i++ )
1054 int nBendersCuts = bendersCutsList.size();
1055 for(; i < ( nParentConss + nBendersCuts ); i++ )
1057 assert(!bendersCutsList.empty());
1059 bendersCutsList.pop_front();
1089 for(
int i = 0; i < SCIPgetNConshdlrs(scip); ++i )
1091 SCIP_CONSHDLR* conshdlr = SCIPgetConshdlrs(scip)[i];
1092 int nactiveconss = SCIPconshdlrGetNActiveConss(conshdlr);
1093 if( nactiveconss > 0
1094 && std::string(SCIPconshdlrGetName(conshdlr)) == std::string(
"bounddisjunction") )
1097 SCIP_CONS **conss = SCIPconshdlrGetConss(conshdlr);
1114 for(
int c = 0; c < nactiveconss; c++ )
1133 SCIP_VAR **vars = SCIPgetVarsBounddisjunction(scip, conss[c]);
1134 SCIP_BOUNDTYPE *types = SCIPgetBoundtypesBounddisjunction(scip, conss[c]);
1135 SCIP_Real *bounds = SCIPgetBoundsBounddisjunction(scip, conss[c]);
1138 if( SCIPvarGetStatus(vars[v]) == SCIP_VARSTATUS_MULTAGGR )
1142 SCIP_VAR *transformVar = vars[v];
1143 SCIP_Real scalar = 1.0;
1144 SCIP_Real constant = 0.0;
1145 SCIP_CALL_ABORT( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) );
1235 SCIP_CALL_ABORT( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, NULL, NULL) );
1236 int ngenvars = nbinvars+nintvars;
1250 for(
int i = 0; i < ngenvars; ++i )
1252 assert( SCIPvarGetType(vars[i]) == SCIP_VARTYPE_BINARY || SCIPvarGetType(vars[i]) == SCIP_VARTYPE_INTEGER );
1253 SCIP_VAR *transformVar = vars[i];
1254 SCIP_Real scalar = 1.0;
1255 SCIP_Real constant = 0.0;
1256 SCIP_CALL_ABORT( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) );
1281 SCIP_BRANCHDIR branchdir1;
1282 SCIP_BRANCHDIR branchdir2;
1285 branchdir1 = SCIP_BRANCHDIR_DOWNWARDS;
1286 branchdir2 = SCIP_BRANCHDIR_UPWARDS;
1290 branchdir1 = SCIP_BRANCHDIR_UPWARDS;
1291 branchdir2 = SCIP_BRANCHDIR_DOWNWARDS;
1320 SCIP_CALL_ABORT( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, NULL, NULL) );
1321 int ngenvars = nbinvars+nintvars;
1344 for(
int i = 0; i < ngenvars; i++ )
1346 assert( SCIPvarGetType(vars[i]) == SCIP_VARTYPE_BINARY || SCIPvarGetType(vars[i]) == SCIP_VARTYPE_INTEGER );
1348 SCIP_VAR *transformVar = vars[i];
1349 SCIP_Real scalar = 1.0;
1350 SCIP_Real constant = 0.0;
1351 SCIP_CALL_ABORT( SCIPvarGetOrigvarSum(&transformVar, &scalar, &constant ) );
1356 SCIP_VALUEHISTORY* valuehistory = SCIPvarGetValuehistory(vars[i]);
1357 if( valuehistory != NULL )
1359 SCIP_HISTORY** histories;
1362 histories = SCIPvaluehistoryGetHistories(valuehistory);
1363 values = SCIPvaluehistoryGetValues(valuehistory);
1441 SCIP_CALL_ABORT( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, NULL, NULL) );
1442 int ngenvars = nbinvars+nintvars;
1455 for(
int i = 0; i < ngenvars; ++i )
1457 assert( SCIPvarGetType(vars[i]) == SCIP_VARTYPE_BINARY || SCIPvarGetType(vars[i]) == SCIP_VARTYPE_INTEGER );
1475 gzstream::ogzstream &out
1483#ifdef UG_SCIP_V31_CHECK_POINT_FILES
1490 out.write((
char *)&
branchBounds[i],
sizeof(SCIP_Real));
1491 out.write((
char *)&
boundTypes[i],
sizeof(
int));
1511 out.write((
char *)&dummyZero,
sizeof(
int));
1536 out.write((
char *)&dummyZero,
sizeof(
int));
1537 out.write((
char *)&dummyZero,
sizeof(
int));
1548 out.write((
char *)&
branchBounds[i],
sizeof(SCIP_Real));
1549 out.write((
char *)&
boundTypes[i],
sizeof(
int));
1572 out.write((
char *)&dummyZero,
sizeof(
int));
1593 out.write((
char *)&dummyZero,
sizeof(
int));
1614 out.write((
char *)&dummyZero,
sizeof(
int));
1644 out.write((
char *)&dummyZero,
sizeof(
int));
1670 out.write((
char *)&dummyZero,
sizeof(
int));
1671 out.write((
char *)&dummyZero,
sizeof(
int));
1702 out.write((
char *)&dummyZero,
sizeof(
int));
1707#ifdef UG_DEBUG_SOLUTION
1708 out.write((
char *)&includeOptimalSol,
sizeof(
int));
1716 gzstream::igzstream &in,
1717 bool onlyBoundChanges
1724#ifdef UG_SCIP_V31_CHECK_POINT_FILES
1738 in.read((
char *)&
boundTypes[i],
sizeof(
int));
1741 if( !onlyBoundChanges )
1743 in.read((
char *)&dummyInt1,
sizeof(
int));
1769 in.read((
char *)&dummyInt1,
sizeof(
int));
1770 in.read((
char *)&dummyInt2,
sizeof(
int));
1807 SCIP_Real dummyReal;
1810 in.read((
char *)&nConss,
sizeof(
int));
1813 for(
int i = 0; i < nConss; i++ )
1816 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1817 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1818 in.read((
char *)&nCoefs,
sizeof(
int));
1820 for(
int j = 0; j < nCoefs; j++ )
1822 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1823 in.read((
char *)&dummyInt,
sizeof(
int));
1829 in.read((
char *)&dummyInt,
sizeof(
int));
1830 in.read((
char *)&nStats,
sizeof(
int));
1832 for(
int i = 0; i < nStats; i++ )
1834 in.read((
char *)&dummyInt,
sizeof(
int));
1835 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1836 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1837 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1838 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1839 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1840 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1841 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1842 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1843 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1844 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
1862 in.read((
char *)&
boundTypes[i],
sizeof(
int));
1865 in.read((
char *)&dummyInt1,
sizeof(
int));
1895 in.read((
char *)&dummyInt1,
sizeof(
int));
1920 if( !onlyBoundChanges )
1922 in.read((
char *)&dummyInt1,
sizeof(
int));
1948 in.read((
char *)&dummyInt1,
sizeof(
int));
1997 in.read((
char *)&dummyInt1,
sizeof(
int));
1998 in.read((
char *)&dummyInt2,
sizeof(
int));
2031 in.read((
char *)&dummyInt1,
sizeof(
int));
2082 SCIP_Real dummyReal;
2085 in.read((
char *)&nConss,
sizeof(
int));
2088 for(
int i = 0; i < nConss; i++ )
2091 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2092 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2093 in.read((
char *)&nCoefs,
sizeof(
int));
2095 for(
int j = 0; j < nCoefs; j++ )
2097 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2098 in.read((
char *)&dummyInt,
sizeof(
int));
2104 SCIP_Bool bBool = 0;
2105 SCIP_Real bReal = 0.0;
2106 SCIP_BOUNDTYPE bType = SCIP_BOUNDTYPE_LOWER;
2107 in.read((
char *)&nBTemp,
sizeof(
int));
2110 in.read((
char *)&bInt,
sizeof(
int));
2111 for(
int i = 0; i < nBTemp; i++ )
2114 in.read((
char *)&nBtemp2,
sizeof(
int));
2115 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2116 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2117 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2118 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2119 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2120 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2121 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2122 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2123 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2124 in.read((
char *)&bBool,
sizeof(SCIP_Bool));
2127 for(
int j = 0; j < nBtemp2; j++ )
2129 in.read((
char *)&bInt,
sizeof(
int));
2130 in.read((
char *)&bType,
sizeof(SCIP_BOUNDTYPE));
2131 in.read((
char *)&bReal,
sizeof(SCIP_Real));
2140 in.read((
char *)&dummyInt,
sizeof(
int));
2141 in.read((
char *)&nStats,
sizeof(
int));
2145 for(
int i = 0; i < nStats; i++ )
2147 in.read((
char *)&dummyInt,
sizeof(
int));
2148 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2149 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2150 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2151 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2152 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2153 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2154 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2155 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2156 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2157 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2161 in.read((
char *)&nTemp1,
sizeof(
int));
2164 in.read((
char *)&dummyInt,
sizeof(
int));
2165 for(
int i = 0; i < nTemp1; i++)
2168 in.read((
char *)&dummyInt,
sizeof(
int));
2169 in.read((
char *)&nTemp2,
sizeof(
int));
2172 for(
int j = 0; j < nTemp2; j++ )
2174 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2175 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2176 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2177 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2178 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2179 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2180 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2181 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2182 in.read((
char *)&dummyReal,
sizeof(SCIP_Real));
2190#ifdef UG_DEBUG_SOLUTION
2191 in.read((
char *)&includeOptimalSol,
sizeof(
int));
2215 if( probindex < 0 )
continue;
2217 switch(
static_cast<SCIP_VARTYPE
>(scipInstance->
getVarType( probindex ) ) )
2219 case SCIP_VARTYPE_BINARY:
2228 for( k = 0 ; k < n; k++ )
2234 (*fixedVars)[n].nSameValue = 0;
2237 (*fixedVars)[n].mnode = 0;
2238 (*fixedVars)[n].next = 0;
2239 (*fixedVars)[n].prev = 0;
2242 case SCIP_VARTYPE_INTEGER:
2243 case SCIP_VARTYPE_IMPLINT:
2244 case SCIP_VARTYPE_CONTINUOUS:
2281 for(k = 0; k < n; k++ )
2287 (*fixedVars)[n].nSameValue = 0;
2290 (*fixedVars)[n].mnode = 0;
2291 (*fixedVars)[n].next = 0;
2292 (*fixedVars)[n].prev = 0;
2302 delete [] *fixedVars;
2318 int nNewBranches = 0;
2330 bool updated =
false;
2331 for(
int j = 0; j < n; j++ )
2371 for(
int j = 0; j < n; j++ )
2385#ifdef UG_DEBUG_SOLUTION
2386 diffSubproblem->includeOptimalSol = includeOptimalSol;
2388 return diffSubproblem;
2396 std::ostringstream s;
2403 s <<
"branchBounds[" << i <<
"] = " <<
branchBounds[i] << std::endl;
2404 s <<
"boudTypes[" << i <<
"] = " <<
static_cast<int>(
boundTypes[i]) << std::endl;
2480 s <<
"varValue[" << i <<
"][" << j <<
"] = " <<
varValues->
varValue[i][j] << std::endl;
UG::ParaDiffSubproblem * createParaDiffSubproblem()
int * nVarsBoundDisjunction
SCIP_Bool * flagBoundDisjunctionInitial
SCIP_Bool * flagBoundDisjunctionDynamic
SCIP_Bool * flagBoundDisjunctionCheck
int ** idxBoundDisjunctionVars
SCIP_Bool * flagBoundDisjunctionStickingatnode
SCIP_Bool * flagBoundDisjunctionRemovable
SCIP_BOUNDTYPE ** boundTypesBoundDisjunction
SCIP_Bool * flagBoundDisjunctionEnforce
SCIP_Real ** boundsBoundDisjunction
SCIP_Bool * flagBoundDisjunctionModifiable
SCIP_Bool * flagBoundDisjunctionLocal
int nTotalVarsBoundDisjunctions
SCIP_Bool * flagBoundDisjunctionPropagate
SCIP_Bool * flagBoundDisjunctionSeparate
int ** idxLinearCoefsVars
int ** idxLinearCoefsVars
SCIP_Real ** varValueDowninfer
SCIP_Real ** varValueDownconflen
SCIP_Real ** varValueUpinfer
SCIP_Real ** varValueUpcutoff
SCIP_Real ** varVlaueUpvsids
SCIP_Real ** varValueDowncutoff
SCIP_Real ** varValueUpconflen
SCIP_Real ** varValueDownvsids
SCIP_BOUNDTYPE getBoundType(int i)
int * indicesAmongSolvers
void addBranchLinearConss(SCIP *scip, ScipParaSolver *scipParaSolver, int nLenarConss, int nAddedConss, SCIP_CONS **addedConss)
BbParaDiffSubproblem * createDiffSubproblem(UG::ParaComm *comm, UG::ParaInitiator *initiator, int n, UG::BbParaFixedVariable *fixedVars)
const std::string toString()
void read(UG::ParaComm *comm, gzstream::igzstream &in, bool onlyBoundChanges)
ScipParaDiffSubproblemBranchLinearCons * branchLinearConss
ScipParaDiffSubproblemBoundDisjunctions * boundDisjunctions
SCIP_Real getBranchBound(int i)
void addBranchVarStats(SCIP *scip, ScipParaSolver *scipParaSolver)
SCIP_BOUNDTYPE * boundTypes
void addLocalNodeInfo(SCIP *scip, ScipParaSolver *scipParaSolver)
ScipParaDiffSubproblemVarBranchStats * varBranchStats
int getFixedVariables(UG::ParaInstance *instance, UG::BbParaFixedVariable **fixedVars)
void addBranchSetppcConss(SCIP *scip, ScipParaSolver *scipParaSolver, int nSetpartConss, int nAddedConss, SCIP_CONS **addedConss)
ScipParaDiffSubproblemVarValues * varValues
void addInitialBranchVarStats(int minDepth, int maxDepth, SCIP *scip)
ScipParaDiffSubproblemBranchSetppcCons * branchSetppcConss
void write(gzstream::ogzstream &out)
void addBoundDisjunctions(SCIP *scip, ScipParaSolver *scipParaSolver)
ScipParaDiffSubproblemLinearCons * linearConss
ScipParaDiffSubproblemLinearCons * bendersLinearConss
void addVarValueStats(SCIP *scip, ScipParaSolver *scipParaSolver)
SCIP_Real getVarLb(int i)
int getOrigProbIndex(int index)
SCIP_Real getVarUb(int i)
bool isOriginalIndeciesMap()
bool isCopyIncreasedVariables()
int getOriginalIndex(int index)
double getOrgVarLb(int i)
std::list< LocalNodeInfoPtr > * getConflictConsList()
double getOrgVarUb(int i)
bool isOriginalIndeciesMap()
ScipParaDiffSubproblem * getParentDiffSubproblem()
Class for the difference between instance and subproblem.
double getTightenedVarLbs(int i)
get tightened variable lower bound TODO: this function should be in inherited class
bool areTightenedVarBounds()
check if there are tightened lower or upper bound TODO: this function should be in inherited class
double getTightenedVarUbs(int i)
get tightened variable upper bound TODO: this function should be in inherited class
void updateNTransferredLocalCuts(int n)
update number of transferred local cuts
ParaTask * getCurrentNode()
get current ParaNode object
void updateNTransferredBendersCuts(int n)
update number of transferred benders cuts
ParaParamSet * getParaParamSet()
get ParaParamSet object
bool isRacingStage()
check if Solver is in racing stage or not
Base class of communicator object.
bool getBoolParamValue(int param)
get bool parameter value
bool isRootTask()
check if root task or not
static ScipParaCommTh * comm
struct ParaSCIP::BranchConsSetppcInfo_t BranchConsSetppcInfo
struct ParaSCIP::LocalNodeInfo_t LocalNodeInfo
struct ParaSCIP::BranchConsLinearInfo_t BranchConsLinearInfo
static const int TransferBendersCuts
static const int TransferBranchStats
static const int TransferVarValueStats
static const int TransferConflicts
static const int TransferConflictCuts
static const int TransferLocalCuts
static const int RacingStatBranching
static const int NoSolverPresolvingAtRoot
Base class of communicator for UG Framework.
#define THROW_LOGICAL_ERROR1(msg1)
#define THROW_LOGICAL_ERROR2(msg1, msg2)
#define DEFAULT_NUM_EPSILON
ParaInitialStat extension for SCIP solver.
ParaInitiator extension for SCIP solver.
ParaInstance extenstion for SCIP solver.
ParaSolver extension for SCIP: Parallelized solver implementation for SCIP.