59 #define RELAX_NAME "SDP"
60 #define RELAX_DESC "SDP-relaxator"
61 #define RELAX_PRIORITY 1
66 #define DEFAULT_SDPSOLVERGAPTOL 1e-4
67 #define DEFAULT_PENALTYPARAM -1.0
68 #define DEFAULT_LAMBDASTAR -1.0
69 #define DEFAULT_MAXPENALTYPARAM -1.0
70 #define DEFAULT_SLATERCHECK 0
71 #define DEFAULT_OBJLIMIT FALSE
72 #define DEFAULT_RESOLVE TRUE
73 #define DEFAULT_TIGHTENVB TRUE
74 #define DEFAULT_SDPINFO FALSE
75 #define DEFAULT_DISPLAYSTAT TRUE
76 #define DEFAULT_SETTINGSRESETFREQ -1
77 #define DEFAULT_SETTINGSRESETOFS 0
78 #define DEFAULT_SDPSOLVERTHREADS -1
91 SCIP_Bool probingsolved;
92 SCIP_Real sdpsolvergaptol;
93 SCIP_Real sdpsolverfeastol;
94 SCIP_Real penaltyparam;
95 SCIP_Real maxpenaltyparam;
106 SCIP_Bool displaystat;
110 int settingsresetfreq;
111 int settingsresetofs;
112 int sdpsolverthreads;
114 int sdpinterfacecalls;
115 long int lastsdpnode;
123 int unstablenoslater;
126 int unsolvednoslater;
129 int nslatercheckfailed;
133 int npslatercheckfailed;
136 int ndslatercheckfailed;
137 int nslaterinfeasible;
138 int stableinfeasible;
139 int unstableinfeasible;
140 int penaltyinfeasible;
141 int boundedinfeasible;
142 int unsolvedinfeasible;
153 SCIP_CONSHDLR* conshdlr;
154 const char* conshdlrname;
156 SCIP_VAR** blockvars;
159 SCIP_Real** constval;
172 int* nconstblocknonz;
173 int constnnonzcounter;
185 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolvergaptol", ¶m) );
187 SCIPdebugMessage(
"Putting SDP Data in general SDP interface!\n");
189 assert( scip != NULL );
190 assert( sdpi != NULL );
191 assert( varmapper != NULL );
193 vars = SCIPgetVars(scip);
194 nvars = SCIPgetNVars(scip);
197 SCIP_CALL( SCIPallocBufferArray(scip, &obj, nvars) );
198 SCIP_CALL( SCIPallocBufferArray(scip, &lb, nvars) );
199 SCIP_CALL( SCIPallocBufferArray(scip, &ub, nvars) );
201 for (i = 0; i < nvars; i++)
203 obj[i] = SCIPvarGetObj(vars[i]);
204 lb[i] = SCIPvarGetLbLocal(vars[i]);
205 ub[i] = SCIPvarGetUbLocal(vars[i]);
208 nconss = SCIPgetNConss(scip);
209 conss = SCIPgetConss(scip);
216 for (i = 0; i < nconss; i++)
218 conshdlr = SCIPconsGetHdlr(conss[i]);
219 assert( conshdlr != NULL );
221 conshdlrname = SCIPconshdlrGetName(conshdlr);
223 #ifdef SCIP_EVEN_MORE_DEBUG
224 SCIP_CALL( SCIPprintCons(scip, conss[i], NULL) );
225 SCIPinfoMessage(scip, NULL,
"\n");
228 if ( strcmp(conshdlrname,
"SDP") == 0 )
233 sdpnnonz += blocknnonz;
234 sdpconstnnonz += constnnonzcounter;
239 SCIP_CALL( SCIPallocBufferArray(scip, &sdpblocksizes, nsdpblocks) );
240 SCIP_CALL( SCIPallocBufferArray(scip, &nblockvarnonz, nsdpblocks) );
241 SCIP_CALL( SCIPallocBufferArray(scip, &nconstblocknonz, nsdpblocks) );
242 SCIP_CALL( SCIPallocBufferArray(scip, &col, nsdpblocks) );
243 SCIP_CALL( SCIPallocBufferArray(scip, &row, nsdpblocks) );
244 SCIP_CALL( SCIPallocBufferArray(scip, &val, nsdpblocks) );
245 SCIP_CALL( SCIPallocBufferArray(scip, &constcol, nsdpblocks) );
246 SCIP_CALL( SCIPallocBufferArray(scip, &constrow, nsdpblocks) );
247 SCIP_CALL( SCIPallocBufferArray(scip, &constval, nsdpblocks) );
248 SCIP_CALL( SCIPallocBufferArray(scip, &nblockvars, nsdpblocks) );
249 SCIP_CALL( SCIPallocBufferArray(scip, &sdpvar, nsdpblocks) );
251 for (i = 0; i < nsdpblocks; i++)
253 SCIP_CALL( SCIPallocBufferArray(scip, &(nblockvarnonz[i]), nvars) );
254 SCIP_CALL( SCIPallocBufferArray(scip, &col[i], nvars) );
255 SCIP_CALL( SCIPallocBufferArray(scip, &row[i], nvars) );
256 SCIP_CALL( SCIPallocBufferArray(scip, &val[i], nvars) );
261 SCIP_CALL( SCIPallocBufferArray(scip, &blockvars, nvars) );
263 for (i = 0; i < nconss; i++)
265 conshdlr = SCIPconsGetHdlr(conss[i]);
266 assert( conshdlr != NULL );
268 conshdlrname = SCIPconshdlrGetName(conshdlr);
270 if ( strcmp(conshdlrname,
"SDP") == 0 )
272 assert( ind < nsdpblocks );
276 nconstblocknonz[ind] = constlength;
277 SCIP_CALL( SCIPallocBufferArray(scip, &(constcol[ind]), constlength) );
278 SCIP_CALL( SCIPallocBufferArray(scip, &(constrow[ind]), constlength) );
279 SCIP_CALL( SCIPallocBufferArray(scip, &(constval[ind]), constlength) );
282 SCIP_CALL(
SCIPconsSdpGetData(scip, conss[i], &nblockvars[ind], &blocknnonz, &sdpblocksizes[ind], &nvars, nblockvarnonz[ind], col[ind],
283 row[ind], val[ind], blockvars, &nconstblocknonz[ind], constcol[ind], constrow[ind], constval[ind]) );
286 assert( nvars == SCIPgetNVars(scip) );
287 assert( nconstblocknonz[ind] <= constlength );
289 SCIP_CALL( SCIPallocBufferArray(scip, &(sdpvar[ind]), nblockvars[ind]) );
292 for (j = 0; j < nblockvars[ind]; j++)
300 SCIPfreeBufferArray(scip, &blockvars);
303 SCIP_CALL(
SCIPsdpiLoadSDP(sdpi, nvars, obj, lb, ub, nsdpblocks, sdpblocksizes, nblockvars, sdpconstnnonz, nconstblocknonz, constrow,
304 constcol, constval, sdpnnonz, nblockvarnonz, sdpvar, row, col, val, 0,
305 NULL, NULL, 0, NULL, NULL, NULL) );
308 for (i = 0; i < nsdpblocks; i++)
310 SCIPfreeBufferArrayNull(scip, &(sdpvar[i]));
311 SCIPfreeBufferArrayNull(scip, &val[i]);
312 SCIPfreeBufferArrayNull(scip, &row[i]);
313 SCIPfreeBufferArrayNull(scip, &col[i]);
314 SCIPfreeBufferArrayNull(scip, &(nblockvarnonz[i]));
315 SCIPfreeBufferArrayNull(scip, &(constval[i]));
316 SCIPfreeBufferArrayNull(scip, &(constrow[i]));
317 SCIPfreeBufferArrayNull(scip, &(constcol[i]));
320 SCIPfreeBufferArrayNull(scip, &sdpvar);
321 SCIPfreeBufferArrayNull(scip, &nblockvars);
322 SCIPfreeBufferArrayNull(scip, &constval);
323 SCIPfreeBufferArrayNull(scip, &constrow);
324 SCIPfreeBufferArrayNull(scip, &constcol);
325 SCIPfreeBufferArrayNull(scip, &val);
326 SCIPfreeBufferArrayNull(scip, &row);
327 SCIPfreeBufferArrayNull(scip, &col);
328 SCIPfreeBufferArrayNull(scip, &nconstblocknonz);
329 SCIPfreeBufferArrayNull(scip, &nblockvarnonz);
330 SCIPfreeBufferArrayNull(scip, &sdpblocksizes);
331 SCIPfreeBufferArray(scip, &ub);
332 SCIPfreeBufferArray(scip, &lb);
333 SCIPfreeBufferArray(scip, &obj);
373 assert( scip != NULL );
374 assert( sdpi != NULL );
375 assert( varmapper != NULL );
377 nvars = SCIPgetNVars(scip);
380 SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
381 SCIP_CALL( SCIPgetBoolParam(scip,
"relaxing/SDP/tightenvb", &tightenvb) );
383 SCIPdebugMessage(
"inserting %d LPRows into the interface.\n", nrows);
387 for (i = 0; i < nrows; i++)
389 assert( rows[i] != NULL );
390 scipnnonz += SCIProwGetNNonz(rows[i]);
394 SCIP_CALL( SCIPallocBufferArray(scip, &lhs, nrows) );
395 SCIP_CALL( SCIPallocBufferArray(scip, &rhs, nrows) );
396 SCIP_CALL( SCIPallocBufferArray(scip, &rowind, scipnnonz) );
397 SCIP_CALL( SCIPallocBufferArray(scip, &colind, scipnnonz) );
398 SCIP_CALL( SCIPallocBufferArray(scip, &val, scipnnonz) );
404 for (i = 0; i < nrows; i++)
407 SCIP_Bool tightened = FALSE;
408 SCIP_Real tightenedval = 0.0;
409 SCIP_Bool swapped = FALSE;
413 rownnonz = SCIProwGetNNonz(row);
415 rowvals = SCIProwGetVals(row);
416 rowcols = SCIProwGetCols(row);
417 sciplhs = SCIProwGetLhs(row) - SCIProwGetConstant(row);
418 sciprhs = SCIProwGetRhs(row) - SCIProwGetConstant(row);
421 if ( tightenvb && rownnonz == 2 && (SCIPisZero(scip, sciplhs) || SCIPisZero(scip, sciprhs) ) )
431 assert( rowcols[0] != NULL );
432 assert( rowcols[1] != NULL );
433 var1 = SCIPcolGetVar(rowcols[0]);
434 var2 = SCIPcolGetVar(rowcols[1]);
435 assert( var1 != NULL );
436 assert( var2 != NULL );
439 if ( ! SCIPisEQ(scip, SCIPvarGetLbLocal(var1), SCIPvarGetUbLocal(var1)) && ! SCIPisEQ(scip, SCIPvarGetLbLocal(var2), SCIPvarGetUbLocal(var2)) )
442 if ( (SCIPisEQ(scip, val1, 1.0) || SCIPisEQ(scip, val2, 1.0)) && ( SCIPisNegative(scip, val1) || SCIPisNegative(scip, val2) ) )
445 if ( ! SCIPisEQ(scip, val1, 1.0) || ! SCIPisNegative(scip, val2) )
447 SCIPswapPointers((
void**) &var1, (
void**) &var2);
454 if ( SCIPvarIsBinary(var2) )
456 if ( SCIPisZero(scip, sciprhs) )
458 if ( SCIPisLT(scip, SCIPvarGetUbLocal(var1), REALABS(val2)) )
460 SCIPdebugMessage(
"Big-M in %s changed from %f to %f\n", SCIProwGetName(row), REALABS(val2), SCIPvarGetUbLocal(var1));
463 tightenedval = -SCIPvarGetUbLocal(var1);
467 if ( SCIPisZero(scip, sciplhs) )
469 if ( SCIPisGT(scip, SCIPvarGetLbLocal(var1), REALABS(val2)) )
471 SCIPdebugMessage(
"Big-M in %s changed from %f to %f\n", SCIProwGetName(row), REALABS(val2), SCIPvarGetLbLocal(var1));
474 tightenedval = -SCIPvarGetUbLocal(var1);
482 for (j = 0; j < rownnonz; j++)
485 if ( tightened && ( (swapped && (j == 0)) || ((! swapped) && (j == 1)) ) )
487 if ( SCIPisFeasGT(scip, REALABS(tightenedval), 0.0) )
489 assert( SCIPcolGetVar(rowcols[j]) != 0 );
491 rowind[nnonz] = nconss;
492 val[nnonz] = tightenedval;
496 else if ( SCIPisFeasGT(scip, REALABS(rowvals[j]), 0.0))
498 assert( SCIPcolGetVar(rowcols[j]) != 0 );
500 rowind[nnonz] = nconss;
501 val[nnonz] = rowvals[j];
505 lhs[nconss] = sciplhs;
506 rhs[nconss] = sciprhs;
518 SCIP_CALL(
SCIPsdpiAddLPRows(sdpi, nconss, lhs, rhs, nnonz, (
const int*)rowind, (
const int*)colind, val) );
521 SCIPfreeBufferArray(scip, &val);
522 SCIPfreeBufferArray(scip, &colind);
523 SCIPfreeBufferArray(scip, &rowind);
524 SCIPfreeBufferArray(scip, &rhs);
525 SCIPfreeBufferArray(scip, &lhs);
530 vars = SCIPgetVars(scip);
531 assert( vars != NULL );
534 SCIP_CALL( SCIPallocBufferArray(scip, &lb, nvars) );
535 SCIP_CALL( SCIPallocBufferArray(scip, &ub, nvars) );
536 SCIP_CALL( SCIPallocBufferArray(scip, &inds, nvars) );
537 SCIP_CALL( SCIPallocBufferArray(scip, &obj, nvars) );
538 SCIP_CALL( SCIPallocBufferArray(scip, &objinds, nvars) );
541 for (i = 0; i < nvars; i++)
543 assert( vars[i] != NULL );
544 lb[i] = SCIPvarGetLbLocal(vars[i]);
545 ub[i] = SCIPvarGetUbLocal(vars[i]);
547 obj[i] = SCIPvarGetObj(vars[i]);
556 SCIPfreeBufferArray(scip, &objinds);
557 SCIPfreeBufferArray(scip, &obj);
558 SCIPfreeBufferArray(scip, &inds);
559 SCIPfreeBufferArray(scip, &ub);
560 SCIPfreeBufferArray(scip, &lb);
569 SCIP_RELAXDATA* relaxdata,
571 SCIP_Real* lowerbound
574 char saveconsname[SCIP_MAXSTRLEN];
577 SCIP_CONS* savedsetting;
582 SCIP_Bool enforceslater;
584 SCIP_Real objforscip;
585 SCIP_Real* solforscip;
594 SCIPdebugMessage(
"calcRelax called\n");
596 assert( scip != NULL );
597 assert( relaxdata != NULL );
598 assert( result != NULL );
599 assert( lowerbound != NULL );
601 nvars = SCIPgetNVars(scip);
603 vars = SCIPgetVars (scip);
605 sdpi = relaxdata->sdpi;
606 assert( sdpi != NULL );
608 if ( relaxdata->objlimit )
615 rootnode = ! SCIPnodeGetParent(SCIPgetCurrentNode(scip));
618 if ( rootnode || (SCIPnodeGetDepth(SCIPgetCurrentNode(scip)) == relaxdata->settingsresetofs) ||
619 ( relaxdata->settingsresetfreq > 0 && ((SCIPnodeGetDepth(SCIPgetCurrentNode(scip)) - relaxdata->settingsresetofs) % relaxdata->settingsresetfreq == 0)) ||
626 SCIP_CONSHDLR* conshdlr;
630 conshdlr = SCIPfindConshdlr(scip,
"Savedsdpsettings");
631 if ( conshdlr == NULL )
633 SCIPerrorMessage(
"Savedsdpsettings constraint handler not found!\n");
634 return SCIP_PLUGINNOTFOUND;
639 conss = SCIPconshdlrGetConss(conshdlr);
640 parentconsind = SCIPconshdlrGetNActiveConss(conshdlr) - 1;
641 (void) SCIPsnprintf(saveconsname, SCIP_MAXSTRLEN,
"savedsettings_node_%d", SCIPnodeGetNumber(SCIPnodeGetParent(SCIPgetCurrentNode(scip))));
643 while ( parentconsind >= 0 && strcmp(saveconsname, SCIPconsGetName(conss[parentconsind])) )
645 if ( parentconsind >= 0 )
649 SCIPdebugMessage(
"Startsetting from parent node not found, restarting with fastest settings!\n");
656 SCIP_CALL( SCIPgetRealParam(scip,
"limits/time", &timelimit) );
657 if ( ! SCIPisInfinity(scip, timelimit) )
659 timelimit -= SCIPgetSolvingTime(scip);
660 if ( timelimit <= 0.0 )
662 *result = SCIP_DIDNOTRUN;
669 enforceslater = SCIPisInfinity(scip, -1 * SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip)));
672 SCIP_CALL(
SCIPsdpiSolve(sdpi, NULL, startsetting, enforceslater, timelimit) );
673 relaxdata->lastsdpnode = SCIPnodeGetNumber(SCIPgetCurrentNode(scip));
676 relaxdata->sdpinterfacecalls++;
680 if ( naddedsdpcalls )
682 relaxdata->sdpcalls += naddedsdpcalls;
685 relaxdata->sdpiterations += naddediters;
689 switch( usedsetting )
692 relaxdata->solvedpenalty++;
695 relaxdata->solvedfast++;
698 relaxdata->solvedmedium++;
701 relaxdata->solvedstable++;
704 relaxdata->unsolved++;
711 SCIP_CALL(
SCIPsdpiSlater(relaxdata->sdpi, &primalslater, &dualslater) );
712 switch( primalslater )
715 relaxdata->npslatercheckfailed++;
719 relaxdata->ndslatercheckfailed++;
720 relaxdata->nslatercheckfailed++;
723 relaxdata->ndnoslater++;
724 relaxdata->nnoslater++;
727 relaxdata->ndslaterholds++;
728 relaxdata->nslatercheckfailed++;
731 relaxdata->nslaterinfeasible++;
734 relaxdata->ndslatercheckfailed++;
735 relaxdata->nslatercheckfailed++;
740 relaxdata->npnoslater++;
744 relaxdata->ndslatercheckfailed++;
745 relaxdata->nnoslater++;
748 relaxdata->ndnoslater++;
749 relaxdata->nnoslater++;
752 relaxdata->ndslaterholds++;
753 relaxdata->nnoslater++;
756 relaxdata->nslaterinfeasible++;
759 relaxdata->ndslatercheckfailed++;
760 relaxdata->nnoslater++;
765 relaxdata->npslaterholds++;
769 relaxdata->ndslatercheckfailed++;
770 relaxdata->nslatercheckfailed++;
773 relaxdata->ndnoslater++;
774 relaxdata->nnoslater++;
777 relaxdata->ndslaterholds++;
778 relaxdata->nslaterholds++;
781 relaxdata->nslaterinfeasible++;
784 relaxdata->ndslatercheckfailed++;
785 relaxdata->nslatercheckfailed++;
790 relaxdata->npslatercheckfailed++;
791 relaxdata->ndslatercheckfailed++;
792 relaxdata->nslatercheckfailed++;
797 switch( slatersetting )
800 relaxdata->stablewslater++;
803 relaxdata->unstablewslater++;
806 relaxdata->penaltywslater++;
809 relaxdata->boundedwslater++;
812 relaxdata->unsolvedwslater++;
815 relaxdata->stablenoslater++;
818 relaxdata->unstablenoslater++;
821 relaxdata->penaltynoslater++;
824 relaxdata->boundednoslater++;
827 relaxdata->unsolvednoslater++;
830 relaxdata->stableinfeasible++;
833 relaxdata->unstableinfeasible++;
836 relaxdata->penaltyinfeasible++;
839 relaxdata->boundedinfeasible++;
842 relaxdata->unsolvedinfeasible++;
852 (void) SCIPsnprintf(saveconsname, SCIP_MAXSTRLEN,
"savedsettings_node_%d", SCIPnodeGetNumber(SCIPgetCurrentNode(scip)));
854 SCIP_CALL( SCIPaddCons(scip, savedsetting) );
855 SCIP_CALL( SCIPreleaseCons(scip, &savedsetting) );
859 relaxdata->feasible = FALSE;
861 if ( SCIPinProbing(scip) )
869 #ifdef SCIP_MORE_DEBUG
873 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
875 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &sollength) );
877 assert( sollength == nvars );
882 SCIPdebugMessage(
"optimal solution: objective = %f, dual feasible: %u, primal feasible: %u.\n",
887 SCIPdebugMessage(
"The solver could not determine feasibility ! ");
891 for (i = 0; i < nvars; ++i)
893 SCIPdebugMessage(
"<%s> = %f\n", SCIPvarGetName(vars[i]), solforscip[i]);
895 SCIPfreeBufferArray(scip, &solforscip);
901 SCIPdebugMessage(
"Node cut off due to infeasibility.\n");
902 relaxdata->feasible = FALSE;
903 *result = SCIP_CUTOFF;
908 SCIPdebugMessage(
"Node cut off due to objective limit.\n");
909 relaxdata->feasible = FALSE;
910 *result = SCIP_CUTOFF;
915 SCIPdebugMessage(
"Node unbounded.");
916 relaxdata->feasible = TRUE;
917 *result = SCIP_SUCCESS;
918 *lowerbound = -SCIPinfinity(scip);
927 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
929 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &slength) );
931 assert( slength == nvars );
935 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
936 for (v = 0; v < nvars; v++)
941 *lowerbound = objforscip;
942 relaxdata->objval = objforscip;
945 SCIP_CALL( SCIPsetRelaxSolValsSol(scip, scipsol) );
947 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
949 relaxdata->feasible = TRUE;
950 *result = SCIP_SUCCESS;
952 SCIPfreeBufferArray(scip, &solforscip);
953 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
962 *result = SCIP_DIDNOTRUN;
968 objlb = -SCIPinfinity(scip);
970 if ( ! SCIPisInfinity(scip, objlb) )
973 SCIPdebugMessage(
"The relaxation could not be solved, using best computed bound from penalty formulation.\n");
975 else if ( ! SCIPisInfinity(scip, -1 * SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip))) )
977 *lowerbound = SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip));
978 SCIPdebugMessage(
"The relaxation could not be solved, keeping old bound.\n");
982 *result = SCIP_SUSPENDED;
983 SCIPerrorMessage(
"The relaxation of the root node could not be solved, so there is no hope to solve this instance.\n");
987 *result = SCIP_SUCCESS;
1003 assert( scip != NULL );
1005 vars = SCIPgetVars(scip);
1008 for (i = 0; i < SCIPgetNVars(scip); i++)
1010 if ( SCIPisLT(scip, SCIPvarGetLbLocal(vars[i]), SCIPvarGetUbLocal(vars[i])) )
1022 SCIP_RELAXDATA* relaxdata;
1030 #ifdef SCIP_EVEN_MORE_DEBUG
1031 SCIP_VAR** varsfordebug = SCIPgetVars(scip);
1032 const int nvarsfordebug = SCIPgetNVars(scip);
1035 SCIPdebugMessage(
"Calling relaxExecSdp.\n");
1037 relaxdata = SCIPrelaxGetData(relax);
1038 vars = SCIPgetVars(scip);
1039 nvars = SCIPgetNVars(scip);
1042 if ( (relaxdata->lastsdpnode == SCIPnodeGetNumber(SCIPgetCurrentNode(scip)) && ( ! SCIPinProbing(scip) ) ) && relaxdata->origsolved && ! relaxdata->resolve )
1045 SCIP_Real objforscip;
1046 SCIP_Real* solforscip;
1050 SCIPdebugMessage(
"Already solved SDP-relaxation for node %ld, returning with SCIP_SUCCESS so that no other relaxator is called.\n",
1051 SCIPrelaxGetData(relax)->lastsdpnode);
1055 relaxdata->feasible = TRUE;
1056 *result = SCIP_SUCCESS;
1057 *lowerbound = -SCIPinfinity(scip);
1062 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
1064 SCIP_CALL(
SCIPsdpiGetSol(relaxdata->sdpi, &objforscip, solforscip, &slength) );
1066 assert( slength == nvars );
1070 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
1071 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, solforscip) );
1076 *lowerbound = SCIPgetSolTransObj(scip, scipsol);
1079 SCIP_CALL( SCIPgetLPColsData(scip, &cols, &ncols) );
1080 for (i = 0; i < ncols; i++)
1082 SCIP_CALL( SCIPsetRelaxSolVal(scip, SCIPcolGetVar(cols[i]), SCIPgetSolVal(scip, scipsol, SCIPcolGetVar(cols[i]))) );
1085 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
1086 *result = SCIP_SUCCESS;
1088 SCIPfreeBufferArray(scip, &solforscip);
1089 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
1091 *result = SCIP_SUCCESS;
1096 relaxdata->origsolved = FALSE;
1099 SCIP_CALL( SCIPconstructLP(scip, &cutoff) );
1103 relaxdata->feasible = FALSE;
1104 *result = SCIP_CUTOFF;
1109 SCIP_CALL( SCIPflushLP(scip) );
1112 nconss = SCIPgetNConss(scip);
1114 #ifdef SCIP_EVEN_MORE_DEBUG
1115 for (i = 0; i < nvarsfordebug; i++)
1117 SCIPdebugMessage(
"variable %s: status = %u, integral = %u, bounds = [%f, %f] \n", SCIPvarGetName(varsfordebug[i]), SCIPvarGetStatus(varsfordebug[i]),
1118 SCIPvarIsIntegral(varsfordebug[i]), SCIPvarGetLbLocal(varsfordebug[i]), SCIPvarGetUbLocal(varsfordebug[i]));
1125 relaxdata->feasible = TRUE;
1126 *result = SCIP_DIDNOTRUN;
1136 SCIP_CALL( SCIPallocBufferArray(scip, &ubs, nvars) );
1139 for (i = 0; i < nvars; i++)
1141 ubs[i] = SCIPvarGetUbLocal(vars[i]);
1142 *lowerbound += SCIPvarGetObj(vars[i]) * ubs[i];
1143 assert( SCIPisFeasEQ(scip, SCIPvarGetUbLocal(vars[i]), SCIPvarGetLbLocal(vars[i])));
1146 SCIPdebugMessage(
"EVERYTHING IS FIXED, objective value = %f\n", *lowerbound);
1148 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
1149 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, ubs) );
1152 for (i = 0; i < nvars; i++)
1154 SCIP_CALL( SCIPsetRelaxSolVal(scip, vars[i], SCIPvarGetLbLocal(vars[i])) );
1156 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
1159 SCIP_CALL( SCIPcheckSol(scip, scipsol, FALSE, TRUE, TRUE, TRUE, TRUE, &feasible) );
1161 relaxdata->feasible = feasible;
1163 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
1165 SCIPfreeBufferArray(scip, &ubs);
1167 *result = SCIP_SUCCESS;
1174 SCIP_CALL(
calcRelax(scip, relaxdata, result, lowerbound));
1185 SCIP_RELAXDATA* relaxdata;
1186 SCIP_RETCODE retcode;
1190 SCIP_Real penaltyparam;
1191 SCIP_Real maxpenaltyparam;
1194 SCIP_Real givenpenaltyparam;
1199 assert( relax != NULL );
1201 relaxdata = SCIPrelaxGetData(relax);
1202 assert( relaxdata != NULL );
1204 relaxdata->objval = 0.0;
1205 relaxdata->origsolved = FALSE;
1206 relaxdata->probingsolved = FALSE;
1207 relaxdata->sdpcalls = 0;
1208 relaxdata->sdpinterfacecalls = 0;
1209 relaxdata->sdpiterations = 0;
1210 relaxdata->solvedfast = 0;
1211 relaxdata->solvedmedium = 0;
1212 relaxdata->solvedstable = 0;
1213 relaxdata->solvedpenalty = 0;
1214 relaxdata->stablewslater = 0;
1215 relaxdata->unstablewslater = 0;
1216 relaxdata->boundedwslater = 0;
1217 relaxdata->unsolvedwslater = 0;
1218 relaxdata->stablenoslater = 0;
1219 relaxdata->unsolvednoslater = 0;
1220 relaxdata->boundednoslater = 0;
1221 relaxdata->unsolvednoslater = 0;
1222 relaxdata->nslaterholds = 0;
1223 relaxdata->nnoslater = 0;
1224 relaxdata->nslatercheckfailed = 0;
1225 relaxdata->npslaterholds = 0;
1226 relaxdata->npnoslater = 0;
1227 relaxdata->npslatercheckfailed = 0;
1228 relaxdata->ndslaterholds = 0;
1229 relaxdata->ndnoslater = 0;
1230 relaxdata->ndslatercheckfailed = 0;
1231 relaxdata->nslaterinfeasible = 0;
1232 relaxdata->stableinfeasible = 0;
1233 relaxdata->unstableinfeasible = 0;
1234 relaxdata->penaltyinfeasible = 0;
1235 relaxdata->boundedinfeasible = 0;
1236 relaxdata->unsolvedinfeasible = 0;
1237 relaxdata->unsolved = 0;
1238 relaxdata->feasible = FALSE;
1240 nvars = SCIPgetNVars(scip);
1241 vars = SCIPgetVars(scip);
1247 if ( SCIPgetNVars(scip) > 0 )
1253 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolvergaptol", &gaptol) );
1255 if ( retcode == SCIP_PARAMETERUNKNOWN )
1257 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1258 "SDP Solver <%s>: gaptol setting not available -- SCIP parameter has no effect.\n",
1263 SCIP_CALL( retcode );
1266 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolverfeastol", &feastol) );
1268 if ( retcode == SCIP_PARAMETERUNKNOWN )
1270 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1271 "SDP Solver <%s>: sdpsolverfeastol setting not available -- SCIP parameter has no effect.\n",
1276 SCIP_CALL( retcode );
1280 if ( retcode == SCIP_PARAMETERUNKNOWN )
1282 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1283 "SDP Solver <%s>: epsilon setting not available -- SCIP parameter has no effect.\n",
1288 SCIP_CALL( retcode );
1292 if ( retcode == SCIP_PARAMETERUNKNOWN )
1294 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1295 "SDP Solver <%s>: feastol setting not available -- SCIP parameter has no effect.\n",
1300 SCIP_CALL( retcode );
1304 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/penaltyparam", &penaltyparam) );
1305 if ( SCIPisGE(scip, penaltyparam, 0.0) )
1308 givenpenaltyparam = penaltyparam;
1309 if ( retcode == SCIP_PARAMETERUNKNOWN )
1311 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1312 "SDP Solver <%s>: penaltyparam setting not available -- SCIP parameter has no effect\n",
1317 SCIP_CALL( retcode );
1327 for (v = 0; v < nvars; v++)
1329 if ( SCIPisGT(scip, REALABS(SCIPvarGetObj(vars[v])), maxcoeff) )
1330 maxcoeff = REALABS(SCIPvarGetObj(vars[v]));
1337 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/maxpenaltyparam", &maxpenaltyparam) );
1338 if ( SCIPisGE(scip, maxpenaltyparam, 0.0) )
1342 if ( retcode == SCIP_PARAMETERUNKNOWN )
1344 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1345 "SDP Solver <%s>: maxpenaltyparam setting not available -- SCIP parameter has no effect.\n",
1350 SCIP_CALL( retcode );
1354 if ( SCIPisLT(scip, givenpenaltyparam, maxpenaltyparam) )
1356 SCIPdebugMessage(
"Penalty parameter %f overwritten by maxpenaltyparam %f! \n", givenpenaltyparam, maxpenaltyparam);
1362 SCIP_Real givenmaxpenaltyparam;
1368 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/npenaltyincr", &npenaltyincr) );
1370 if ( retcode == SCIP_PARAMETERUNKNOWN )
1372 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1373 "SDP Solver <%s>: npenaltyincr setting not available -- SCIP parameter has no effect.\n",
1378 SCIP_CALL( retcode );
1385 SCIP_Real lambdastar;
1387 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/lambdastar", &lambdastar) );
1388 if ( SCIPisGE(scip, lambdastar, 0.0) )
1401 conss = SCIPgetConss(scip);
1402 nconss = SCIPgetNConss(scip);
1405 for (c = 0; c < nconss; c++)
1408 if ( strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(conss[c])),
"SDP") == 0 )
1411 if ( (! SCIPisInfinity(scip, maxguess) ) && SCIPisGT(scip, guess, maxguess) )
1420 if ( retcode == SCIP_PARAMETERUNKNOWN )
1422 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1423 "SDP Solver <%s>: lambdastar setting not available -- SCIP parameter has no effect.\n",
1428 SCIP_CALL( retcode );
1431 SCIP_CALL( SCIPgetBoolParam(scip,
"relaxing/SDP/sdpinfo", &sdpinfo) );
1433 if ( retcode == SCIP_PARAMETERUNKNOWN )
1435 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1436 "SDP Solver <%s>: sdpinfo setting not available -- SCIP parameter has no effect.\n",
1441 SCIP_CALL( retcode );
1444 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/sdpsolverthreads", &nthreads) );
1449 if ( retcode == SCIP_PARAMETERUNKNOWN )
1451 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1452 "SDP Solver <%s>: nthreads setting not available -- SCIP parameter has no effect.\n",
1457 SCIP_CALL( retcode );
1461 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/slatercheck", &slatercheck) );
1463 if ( retcode == SCIP_PARAMETERUNKNOWN )
1465 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1466 "SDP Solver <%s>: slatercheck setting not available -- SCIP parameter has no effect.\n",
1471 SCIP_CALL( retcode );
1484 assert( scip != NULL );
1485 assert( relax != NULL );
1486 assert(strcmp(SCIPrelaxGetName(relax),
RELAX_NAME) == 0);
1497 SCIP_RELAXDATA* relaxdata;
1499 assert( scip != NULL );
1500 assert( relax != NULL );
1502 relaxdata = SCIPrelaxGetData(relax);
1503 assert( relaxdata != NULL );
1505 SCIPdebugMessage(
"Exiting Relaxation Handler.\n");
1507 if ( relaxdata->displaystat && SCIPgetSubscipDepth(scip) == 0 )
1509 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"\nSDP iterations:\t\t\t\t%6d\n", relaxdata->sdpiterations);
1510 if ( relaxdata->sdpcalls )
1512 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Average SDP-iterations:\t\t\t%6.2f \n", (SCIP_Real) relaxdata->sdpiterations / (SCIP_Real) relaxdata->sdpcalls );
1514 if ( relaxdata->sdpinterfacecalls )
1518 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedfast / (SCIP_Real) relaxdata->sdpinterfacecalls);
1519 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'medium settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedmedium / (SCIP_Real) relaxdata->sdpinterfacecalls);
1520 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedstable / (SCIP_Real) relaxdata->sdpinterfacecalls);
1524 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'default formulation' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedfast / (SCIP_Real) relaxdata->sdpinterfacecalls);
1526 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage penalty formulation used:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedpenalty / (SCIP_Real) relaxdata->sdpinterfacecalls);
1527 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage unsolved even with penalty:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->unsolved / (SCIP_Real) relaxdata->sdpinterfacecalls);
1529 if ( relaxdata->slatercheck )
1531 if ( relaxdata->sdpinterfacecalls )
1533 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage primal Slater condition held:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->npslaterholds / (SCIP_Real) relaxdata->sdpinterfacecalls);
1534 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage primal Slater condition did not hold:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->npnoslater / (SCIP_Real) relaxdata->sdpinterfacecalls);
1535 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage primal Slater check failed:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->npslatercheckfailed / (SCIP_Real) relaxdata->sdpinterfacecalls);
1537 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage dual Slater condition held:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->ndslaterholds / (SCIP_Real) relaxdata->sdpinterfacecalls);
1538 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage dual Slater condition did not hold:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->ndnoslater / (SCIP_Real) relaxdata->sdpinterfacecalls);
1539 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage dual Slater check failed:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->ndslatercheckfailed / (SCIP_Real) relaxdata->sdpinterfacecalls);
1540 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage dual Slater check detected infeasibility:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->nslaterinfeasible / (SCIP_Real) relaxdata->sdpinterfacecalls);
1542 if ( relaxdata->nslaterholds )
1544 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with primal and dual slater holding:\t%6.2f \n",
1545 100.0 * (SCIP_Real) relaxdata->stablewslater / (SCIP_Real) relaxdata->nslaterholds);
1546 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with primal and dual slater holding:\t%6.2f \n",
1547 100.0 * (SCIP_Real) relaxdata->unstablewslater / (SCIP_Real) relaxdata->nslaterholds);
1548 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with primal and dual slater holding:\t%6.2f \n",
1549 100.0 * (SCIP_Real) relaxdata->penaltywslater / (SCIP_Real) relaxdata->nslaterholds);
1550 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with primal and dual slater holding:\t%6.2f \n",
1551 100.0 * (SCIP_Real) relaxdata->boundedwslater / (SCIP_Real) relaxdata->nslaterholds);
1552 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with primal and dual slater holding:\t%6.2f \n",
1553 100.0 * (SCIP_Real) relaxdata->unsolvedwslater / (SCIP_Real) relaxdata->nslaterholds);
1555 if ( relaxdata->nnoslater )
1557 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with either primal or dual slater not holding:\t%6.2f \n",
1558 100.0 * (SCIP_Real) relaxdata->stablenoslater / (SCIP_Real) relaxdata->nnoslater);
1559 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with either primal or dual slater not holding:\t%6.2f \n",
1560 100.0 * (SCIP_Real) relaxdata->unstablenoslater / (SCIP_Real) relaxdata->nnoslater);
1561 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with either primal or dual slater not holding:\t%6.2f \n",
1562 100.0 * (SCIP_Real) relaxdata->penaltynoslater / (SCIP_Real) relaxdata->nnoslater);
1563 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with either primal or dual slater not holding:\t%6.2f \n",
1564 100.0 * (SCIP_Real) relaxdata->boundednoslater / (SCIP_Real) relaxdata->nnoslater);
1565 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with either primal or dual slater not holding:\t%6.2f \n",
1566 100.0 * (SCIP_Real) relaxdata->unsolvednoslater / (SCIP_Real) relaxdata->nnoslater);
1568 if ( relaxdata->nslaterinfeasible )
1570 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with slater check showing infeasibility:\t%6.2f \n",
1571 100.0 * (SCIP_Real) relaxdata->stableinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1572 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with slater check showing infeasibility:\t%6.2f \n",
1573 100.0 * (SCIP_Real) relaxdata->unstableinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1574 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with slater check showing infeasibility:\t%6.2f \n",
1575 100.0 * (SCIP_Real) relaxdata->penaltyinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1576 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with slater check showing infeasibility:\t%6.2f \n",
1577 100.0 * (SCIP_Real) relaxdata->boundedinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1578 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with slater check showing infeasibility:\t%6.2f \n",
1579 100.0 * (SCIP_Real) relaxdata->unsolvedinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1581 #ifdef SLATERSOLVED_ABSOLUTE
1582 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with primal and dual slater holding:\t%d \n", relaxdata->nslaterholds);
1583 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'fastest settings' and primal and dual slater holding:\t%d \n", relaxdata->stablewslater);
1584 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'stable settings' and primal and dual slater holding:\t%d \n", relaxdata->unstablewslater);
1585 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'penalty' and primal and dual slater holding:\t%d \n", relaxdata->penaltywslater);
1586 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'computed infeasible lower bound' and primal and dual slater holding:\t%d \n", relaxdata->boundedwslater);
1587 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'unsolved' and primal and dual slater holding:\t%d \n", relaxdata->unsolvedwslater);
1589 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with either primal or dual slater not holding:\t%d \n", relaxdata->nnoslater);
1590 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'fastest settings' and either primal or dual slater not holding:\t%d \n", relaxdata->stablenoslater);
1591 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'stable settings' and either primal or dual slater not holding:\t%d \n", relaxdata->unstablenoslater);
1592 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'penalty' and either primal or dual slater not holding:\t%d \n", relaxdata->penaltynoslater);
1593 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'computed infeasible lower bound' and either primal or dual slater not holding:\t%d \n", relaxdata->boundednoslater);
1594 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'unsolved' and either primal or dual slater not holding:\t%d \n", relaxdata->unsolvednoslater);
1596 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes:\t%d \n", relaxdata->nslaterinfeasible);
1597 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'fastest settings':\t%d \n", relaxdata->stableinfeasible);
1598 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'stable settings':\t%d \n", relaxdata->unstableinfeasible);
1599 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'penalty':\t%d \n", relaxdata->penaltyinfeasible);
1600 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'computed infeasible lower bound':\t%d \n", relaxdata->boundedinfeasible);
1601 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'unsolved':\t%d \n", relaxdata->unsolvedinfeasible);
1606 if ( relaxdata->varmapper != NULL )
1611 relaxdata->objval = 0.0;
1612 relaxdata->origsolved = FALSE;
1613 relaxdata->probingsolved = FALSE;
1614 relaxdata->feasible = FALSE;
1615 relaxdata->sdpiterations = 0;
1616 relaxdata->sdpcalls = 0;
1617 relaxdata->sdpinterfacecalls = 0;
1618 relaxdata->lastsdpnode = 0;
1628 SCIP_RELAXDATA* relaxdata;
1630 relaxdata = SCIPrelaxGetData(relax);
1631 assert(relaxdata != NULL);
1633 if ( relaxdata->sdpi != NULL )
1638 SCIPfreeMemory(scip, &relaxdata);
1640 SCIPrelaxSetData(relax, NULL);
1650 SCIP_RELAXDATA* relaxdata = NULL;
1654 assert( scip != NULL );
1657 SCIP_CALL( SCIPallocMemory(scip, &relaxdata) );
1658 SCIP_CALL(
SCIPsdpiCreate(&sdpi, SCIPgetMessagehdlr(scip), SCIPblkmem(scip), SCIPbuffer(scip)) );
1660 relaxdata->sdpi = sdpi;
1661 relaxdata->lastsdpnode = -1;
1665 assert( relax != NULL );
1668 SCIP_CALL( SCIPsetRelaxInitsol(scip, relax, relaxInitSolSdp) );
1669 SCIP_CALL( SCIPsetRelaxExit(scip, relax, relaxExitSdp) );
1670 SCIP_CALL( SCIPsetRelaxFree(scip, relax, relaxFreeSdp) );
1671 SCIP_CALL( SCIPsetRelaxCopy(scip, relax, relaxCopySdp) );
1674 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolvergaptol",
1675 "the stopping criterion for the duality gap the sdpsolver should use",
1678 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolverfeastol",
1679 "the feasibility tolerance for the SDP solver",
1682 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/penaltyparam",
1683 "the starting value of the penalty parameter Gamma used for the penalty formulation if the "
1684 "SDP solver didn't converge; set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->penaltyparam),
1687 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/maxpenaltyparam",
1688 "the maximum value of the penalty parameter Gamma used for the penalty formulation if the "
1689 "SDP solver didn't converge; set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->maxpenaltyparam),
1692 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/npenaltyincr",
1693 "maximum number of times the penalty parameter will be increased if the penalty formulation failed", &(relaxdata->npenaltyincr), TRUE,
1696 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/lambdastar",
1697 "the parameter lambda star used by SDPA to set the initial point;"
1698 "set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->lambdastar),
1701 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/slatercheck",
1702 "Should the Slater condition for the primal and dual problem be checked ahead of solving each SDP? 0: no, 1: yes and output statistics, 2: yes and print warning for "
1703 "every problem not satisfying primal and dual Slater condition", &(relaxdata->slatercheck), TRUE,
DEFAULT_SLATERCHECK, 0, 2, NULL, NULL) );
1705 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/sdpinfo",
1706 "Should the SDP solver output information to the screen?",
1709 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/objlimit",
1710 "Should an objective limit be given to the SDP-Solver?",
1713 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/resolve",
1714 "Should the relaxation be resolved after bound-tightenings were found during propagation (outside of probing)?",
1717 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/tightenvb",
1718 "Should Big-Ms in varbound-like constraints be tightened before giving them to the SDP-solver ?",
1721 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/displaystatistics",
1722 "Should statistics about SDP iterations and solver settings/success be printed after quitting SCIP-SDP ?",
1725 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/settingsresetfreq",
1726 "frequency for resetting parameters in SDP solver and trying again with fastest settings (-1: never, 0: only at depth settingsresetofs);"
1727 "currently only supported for SDPA",
1730 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/settingsresetofs",
1731 "frequency offset for resetting parameters in SDP solver and trying again with fastest settings; currently only supported for SDPA",
1734 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/sdpsolverthreads",
1735 "number of threads the SDP solver should use (-1 = number of cores); currently only supported for MOSEK",
1764 SCIP_RELAXDATA* relaxdata;
1766 assert( relax != NULL );
1767 assert( lbvars != NULL );
1768 assert( ubvars != NULL );
1769 assert( arraylength != NULL );
1770 assert( *arraylength >= 0 );
1772 relaxdata = SCIPrelaxGetData(relax);
1773 assert( relaxdata != NULL );
1787 SCIP_RELAXDATA* relaxdata;
1789 assert( relax != NULL );
1790 assert( success != NULL );
1791 assert( objval != NULL );
1793 relaxdata = SCIPrelaxGetData(relax);
1794 assert( relaxdata != NULL );
1796 *success = relaxdata->origsolved;
1797 *objval = relaxdata->objval;
1807 SCIP_Real* solarray,
1811 SCIP_RELAXDATA* relaxdata;
1813 assert( relax != NULL );
1814 assert( success != NULL );
1815 assert( solarray != NULL );
1817 relaxdata = SCIPrelaxGetData(relax);
1818 assert( relaxdata != NULL );
1820 *success = relaxdata->origsolved;
1822 if ( *sollength >= SCIPgetNVars(scip) )
1824 SCIP_CALL(
SCIPsdpiGetSol(relaxdata->sdpi, NULL, solarray, sollength) );
1828 SCIPdebugMessage(
"Called SCIPrelaxSdpGetRelaxSol with an array that wasn't big enough, needed length %d, given %d!\n", SCIPgetNVars(scip), *sollength);
1829 *sollength = SCIPgetNVars(scip);
1840 assert( relax != NULL );
1841 assert( SCIPrelaxGetData(relax) != NULL );
1843 return SCIPrelaxGetData(relax)->lastsdpnode;
1851 SCIP_RELAXDATA* relaxdata;
1853 assert( relax != NULL );
1855 relaxdata = SCIPrelaxGetData(relax);
1857 assert( relaxdata != NULL );
1858 assert( relaxdata->sdpi != NULL );
1868 SCIP_RELAXDATA* relaxdata;
1870 assert( relax != NULL );
1872 relaxdata = SCIPrelaxGetData(relax);
1874 assert( relaxdata != NULL );
1875 assert( relaxdata->sdpi != NULL );
1877 return relaxdata->probingsolved;
1885 assert( relax != NULL );
1886 assert( SCIPrelaxGetData(relax) != NULL );
1888 return ( SCIPrelaxGetData(relax)->feasible );
1896 assert( relax != NULL );
1897 assert( SCIPrelaxGetData(relax) != NULL );
1899 return SCIPrelaxGetData(relax)->sdpiterations;
1907 assert( relax != NULL );
1908 assert( SCIPrelaxGetData(relax) != NULL );
1910 return ( SCIPrelaxGetData(relax)->sdpcalls );
1918 assert( relax != NULL );
1919 assert( SCIPrelaxGetData(relax) != NULL );
1921 return ( SCIPrelaxGetData(relax)->sdpinterfacecalls );
1929 assert( relax != NULL );
1930 assert( SCIPrelaxGetData(relax) != NULL );
1932 return ( SCIPrelaxGetData(relax)->solvedfast );
1940 assert( relax != NULL );
1941 assert( SCIPrelaxGetData(relax) != NULL );
1943 return ( SCIPrelaxGetData(relax)->solvedmedium );
1951 assert( relax != NULL );
1952 assert( SCIPrelaxGetData(relax) != NULL );
1954 return ( SCIPrelaxGetData(relax)->solvedstable );
1962 assert( relax != NULL );
1963 assert( SCIPrelaxGetData(relax) != NULL );
1965 return ( SCIPrelaxGetData(relax)->solvedpenalty );
1973 assert( relax != NULL );
1974 assert( SCIPrelaxGetData(relax) != NULL );
1976 return ( SCIPrelaxGetData(relax)->unsolved );
SCIP_RETCODE SCIPsdpiFree(SCIP_SDPI **sdpi)
SCIP_Bool SCIPsdpiIsDualUnbounded(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiDelLPRows(SCIP_SDPI *sdpi, int firstrow, int lastrow)
SCIP_RETCODE SCIPsdpiGetSdpCalls(SCIP_SDPI *sdpi, int *calls)
static SCIP_RETCODE calcRelax(SCIP *scip, SCIP_RELAXDATA *relaxdata, SCIP_RESULT *result, SCIP_Real *lowerbound)
static SCIP_DECL_RELAXCOPY(relaxCopySdp)
SCIP_RETCODE SCIPsdpVarmapperAddVars(SCIP *scip, SdpVarmapper *varmapper, int nvars, SCIP_VAR **vars)
static SCIP_Bool allVarsFixed(SCIP *scip)
#define DEFAULT_SLATERCHECK
int SCIPrelaxSdpGetNSdpPenalty(SCIP_RELAX *relax)
enum SCIP_SDPSolverSetting SCIP_SDPSOLVERSETTING
static SCIP_DECL_RELAXEXIT(relaxExitSdp)
const char * SCIPsdpiGetSolverName(void)
#define DEFAULT_SDPSOLVERGAPTOL
SCIP_RETCODE SCIPsdpiGetSol(SCIP_SDPI *sdpi, SCIP_Real *objval, SCIP_Real *dualsol, int *dualsollength)
int SCIPrelaxSdpGetNSdpUnsolved(SCIP_RELAX *relax)
#define DEFAULT_PENALTYPARAM
SCIP_Bool SCIPsdpiFeasibilityKnown(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiLoadSDP(SCIP_SDPI *sdpi, int nvars, SCIP_Real *obj, SCIP_Real *lb, SCIP_Real *ub, int nsdpblocks, int *sdpblocksizes, int *sdpnblockvars, int sdpconstnnonz, int *sdpconstnblocknonz, int **sdpconstrow, int **sdpconstcol, SCIP_Real **sdpconstval, int sdpnnonz, int **sdpnblockvarnonz, int **sdpvar, int ***sdprow, int ***sdpcol, SCIP_Real ***sdpval, int nlpcons, SCIP_Real *lplhs, SCIP_Real *lprhs, int lpnnonz, int *lprow, int *lpcol, SCIP_Real *lpval)
SCIP_RETCODE SCIPsdpiComputeLambdastar(SCIP_SDPI *sdpi, SCIP_Real maxguess)
SCIP_RETCODE createConsSavedsdpsettings(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_SDPSOLVERSETTING settings)
#define DEFAULT_TIGHTENVB
static SCIP_DECL_RELAXEXEC(relaxExecSdp)
SCIP_RETCODE SCIPsdpiGetIterations(SCIP_SDPI *sdpi, int *iterations)
#define DEFAULT_SETTINGSRESETFREQ
SCIP_RETCODE SCIPsdpiSettingsUsed(SCIP_SDPI *sdpi, SCIP_SDPSOLVERSETTING *usedsetting)
SCIP_RETCODE SCIPsdpiSlaterSettings(SCIP_SDPI *sdpi, SCIP_SDPSLATERSETTING *slatersetting)
SCIP_Bool SCIPsdpiIsAcceptable(SCIP_SDPI *sdpi)
static SCIP_DECL_RELAXINITSOL(relaxInitSolSdp)
int SCIPrelaxSdpGetNSdpStable(SCIP_RELAX *relax)
int SCIPrelaxSdpGetNSdpMedium(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpVarmapperCreate(SCIP *scip, SdpVarmapper **varmapper, int size)
SCIP_Bool SCIPsdpiIsTimelimExc(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPrelaxSdpRelaxVal(SCIP_RELAX *relax, SCIP_Bool *success, SCIP_Real *objval)
SCIP_Bool SCIPsdpiIsDualInfeasible(SCIP_SDPI *sdpi)
General interface methods for SDP-preprocessing (mainly fixing variables and removing empty rows/cols...
static SCIP_DECL_RELAXFREE(relaxFreeSdp)
struct Sdpvarmapper SdpVarmapper
enum SCIP_SDPSlaterSetting SCIP_SDPSLATERSETTING
#define DEFAULT_DISPLAYSTAT
int SCIPsdpVarmapperGetSdpIndex(SdpVarmapper *varmapper, SCIP_VAR *var)
static SCIP_RETCODE putLpDataInInterface(SCIP *scip, SCIP_SDPI *sdpi, SdpVarmapper *varmapper)
int SCIPrelaxSdpGetNSdpInterfaceCalls(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiChgBounds(SCIP_SDPI *sdpi, int nvars, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
int SCIPrelaxSdpGetNSdpCalls(SCIP_RELAX *relax)
Constraint handler for SDP-constraints.
SCIP_RETCODE SCIPsdpiGetLowerObjbound(SCIP_SDPI *sdpi, SCIP_Real *objlb)
SCIP_Bool SCIPsdpiIsObjlimExc(SCIP_SDPI *sdpi)
class that maps SCIP variables to SDP indices (the SCIP variables are given SDP indices in the order ...
#define DEFAULT_MAXPENALTYPARAM
SCIP_Real SCIPsdpiGetDefaultSdpiSolverFeastol(void)
SCIP_RETCODE SCIPconsSdpGetData(SCIP *scip, SCIP_CONS *cons, int *nvars, int *nnonz, int *blocksize, int *arraylength, int *nvarnonz, int **col, int **row, SCIP_Real **val, SCIP_VAR **vars, int *constnnonz, int *constcol, int *constrow, SCIP_Real *constval)
SCIP_RETCODE SCIPsdpiAddLPRows(SCIP_SDPI *sdpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, int nnonz, const int *row, const int *col, const SCIP_Real *val)
const char * SCIPsdpiGetSolverDesc(void)
SCIP_RETCODE SCIPsdpiComputePenaltyparam(SCIP_SDPI *sdpi, SCIP_Real maxcoeff, SCIP_Real *penaltyparam)
SCIP_RETCODE SCIPsdpiSetIntpar(SCIP_SDPI *sdpi, SCIP_SDPPARAM type, int ival)
SCIP_SDPSOLVERSETTING SCIPconsSavedsdpsettingsGetSettings(SCIP *scip, SCIP_CONS *cons)
#define DEFAULT_SETTINGSRESETOFS
SCIP_Bool SCIPrelaxSdpSolvedProbing(SCIP_RELAX *relax)
SCIP_Real SCIPsdpiInfinity(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiSolve(SCIP_SDPI *sdpi, SCIP_Real *start, SCIP_SDPSOLVERSETTING startsettings, SCIP_Bool enforceslatercheck, SCIP_Real timelimit)
long int SCIPrelaxSdpGetSdpNode(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiCreate(SCIP_SDPI **sdpi, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, BMS_BUFMEM *bufmem)
int SCIPrelaxSdpGetNSdpFast(SCIP_RELAX *relax)
SCIP_Bool SCIPrelaxSdpSolvedOrig(SCIP_RELAX *relax)
int SCIPsdpiGetDefaultSdpiSolverNpenaltyIncreases(void)
static SCIP_RETCODE putSdpDataInInterface(SCIP *scip, SCIP_SDPI *sdpi, SdpVarmapper *varmapper)
SCIP_Bool SCIPsdpiWasSolved(SCIP_SDPI *sdpi)
int SCIPrelaxSdpGetNIterations(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiComputeMaxPenaltyparam(SCIP_SDPI *sdpi, SCIP_Real penaltyparam, SCIP_Real *maxpenaltyparam)
SCIP_RETCODE SCIPsdpiClear(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiChgObj(SCIP_SDPI *sdpi, int nvars, const int *ind, const SCIP_Real *obj)
SCIP_RETCODE SCIPrelaxSdpGetRelaxSol(SCIP *scip, SCIP_RELAX *relax, SCIP_Bool *success, SCIP_Real *solarray, int *sollength)
SCIP_RETCODE SCIPsdpVarmapperFree(SCIP *scip, SdpVarmapper **varmapper)
SCIP_RETCODE SCIPrelaxSdpGetPrimalBoundVars(SCIP_RELAX *relax, SCIP_Real *lbvars, SCIP_Real *ubvars, int *arraylength)
#define DEFAULT_LAMBDASTAR
SCIP_Bool SCIPsdpiIsDualFeasible(SCIP_SDPI *sdpi)
struct SCIP_SDPi SCIP_SDPI
SCIP_Bool SCIPsdpiIsPrimalFeasible(SCIP_SDPI *sdpi)
SCIP_Bool SCIPrelaxSdpIsFeasible(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiSetRealpar(SCIP_SDPI *sdpi, SCIP_SDPPARAM type, SCIP_Real dval)
enum SCIP_SDPSlater SCIP_SDPSLATER
SCIP_RETCODE SCIPconsSdpGetNNonz(SCIP *scip, SCIP_CONS *cons, int *nnonz, int *constnnonz)
SCIP_RETCODE SCIPsdpiGetNLPRows(SCIP_SDPI *sdpi, int *nlprows)
SCIP_RETCODE SCIPsdpiGetPrimalBoundVars(SCIP_SDPI *sdpi, SCIP_Real *lbvars, SCIP_Real *ubvars, int *arraylength)
SCIP_RETCODE SCIPconsSdpGuessInitialPoint(SCIP *scip, SCIP_CONS *cons, SCIP_Real *lambdastar)
SCIP_Bool SCIPsdpiSolvedOrig(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiSlater(SCIP_SDPI *sdpi, SCIP_SDPSLATER *primalslater, SCIP_SDPSLATER *dualslater)
#define DEFAULT_SDPSOLVERTHREADS
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
constraint handler for saving SDP settings