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)) )
625 SCIP_CONSHDLR* conshdlr;
629 conshdlr = SCIPfindConshdlr(scip,
"Savedsdpsettings");
630 if ( conshdlr == NULL )
632 SCIPerrorMessage(
"Savedsdpsettings constraint handler not found!\n");
633 return SCIP_PLUGINNOTFOUND;
638 conss = SCIPconshdlrGetConss(conshdlr);
639 parentconsind = SCIPconshdlrGetNActiveConss(conshdlr) - 1;
640 (void) SCIPsnprintf(saveconsname, SCIP_MAXSTRLEN,
"savedsettings_node_%d", SCIPnodeGetNumber(SCIPnodeGetParent(SCIPgetCurrentNode(scip))));
642 while ( parentconsind >= 0 && strcmp(saveconsname, SCIPconsGetName(conss[parentconsind])) )
644 if ( parentconsind >= 0 )
648 SCIPdebugMessage(
"Startsetting from parent node not found, restarting with fastest settings!\n");
655 SCIP_CALL( SCIPgetRealParam(scip,
"limits/time", &timelimit) );
656 if ( ! SCIPisInfinity(scip, timelimit) )
658 timelimit -= SCIPgetSolvingTime(scip);
659 if ( timelimit <= 0.0 )
661 *result = SCIP_DIDNOTRUN;
668 enforceslater = SCIPisInfinity(scip, -1 * SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip)));
671 SCIP_CALL(
SCIPsdpiSolve(sdpi, NULL, startsetting, enforceslater, timelimit) );
672 relaxdata->lastsdpnode = SCIPnodeGetNumber(SCIPgetCurrentNode(scip));
675 relaxdata->sdpinterfacecalls++;
679 if ( naddedsdpcalls )
681 relaxdata->sdpcalls += naddedsdpcalls;
684 relaxdata->sdpiterations += naddediters;
688 switch( usedsetting )
691 relaxdata->solvedpenalty++;
694 relaxdata->solvedfast++;
697 relaxdata->solvedmedium++;
700 relaxdata->solvedstable++;
703 relaxdata->unsolved++;
710 SCIP_CALL(
SCIPsdpiSlater(relaxdata->sdpi, &primalslater, &dualslater) );
711 switch( primalslater )
714 relaxdata->npslatercheckfailed++;
718 relaxdata->ndslatercheckfailed++;
719 relaxdata->nslatercheckfailed++;
722 relaxdata->ndnoslater++;
723 relaxdata->nnoslater++;
726 relaxdata->ndslaterholds++;
727 relaxdata->nslatercheckfailed++;
730 relaxdata->nslaterinfeasible++;
733 relaxdata->ndslatercheckfailed++;
734 relaxdata->nslatercheckfailed++;
739 relaxdata->npnoslater++;
743 relaxdata->ndslatercheckfailed++;
744 relaxdata->nnoslater++;
747 relaxdata->ndnoslater++;
748 relaxdata->nnoslater++;
751 relaxdata->ndslaterholds++;
752 relaxdata->nnoslater++;
755 relaxdata->nslaterinfeasible++;
758 relaxdata->ndslatercheckfailed++;
759 relaxdata->nnoslater++;
764 relaxdata->npslaterholds++;
768 relaxdata->ndslatercheckfailed++;
769 relaxdata->nslatercheckfailed++;
772 relaxdata->ndnoslater++;
773 relaxdata->nnoslater++;
776 relaxdata->ndslaterholds++;
777 relaxdata->nslaterholds++;
780 relaxdata->nslaterinfeasible++;
783 relaxdata->ndslatercheckfailed++;
784 relaxdata->nslatercheckfailed++;
789 relaxdata->npslatercheckfailed++;
790 relaxdata->ndslatercheckfailed++;
791 relaxdata->nslatercheckfailed++;
796 switch( slatersetting )
799 relaxdata->stablewslater++;
802 relaxdata->unstablewslater++;
805 relaxdata->penaltywslater++;
808 relaxdata->boundedwslater++;
811 relaxdata->unsolvedwslater++;
814 relaxdata->stablenoslater++;
817 relaxdata->unstablenoslater++;
820 relaxdata->penaltynoslater++;
823 relaxdata->boundednoslater++;
826 relaxdata->unsolvednoslater++;
829 relaxdata->stableinfeasible++;
832 relaxdata->unstableinfeasible++;
835 relaxdata->penaltyinfeasible++;
838 relaxdata->boundedinfeasible++;
841 relaxdata->unsolvedinfeasible++;
849 (void) SCIPsnprintf(saveconsname, SCIP_MAXSTRLEN,
"savedsettings_node_%d", SCIPnodeGetNumber(SCIPgetCurrentNode(scip)));
851 SCIP_CALL( SCIPaddCons(scip, savedsetting) );
852 SCIP_CALL( SCIPreleaseCons(scip, &savedsetting) );
855 relaxdata->feasible = FALSE;
857 if ( SCIPinProbing(scip) )
865 #ifdef SCIP_MORE_DEBUG
869 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
871 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &sollength) );
873 assert( sollength == nvars );
878 SCIPdebugMessage(
"optimal solution: objective = %f, dual feasible: %u, primal feasible: %u.\n",
883 SCIPdebugMessage(
"The solver could not determine feasibility ! ");
887 for (i = 0; i < nvars; ++i)
889 SCIPdebugMessage(
"<%s> = %f\n", SCIPvarGetName(vars[i]), solforscip[i]);
891 SCIPfreeBufferArray(scip, &solforscip);
897 SCIPdebugMessage(
"Node cut off due to infeasibility.\n");
898 relaxdata->feasible = FALSE;
899 *result = SCIP_CUTOFF;
904 SCIPdebugMessage(
"Node cut off due to objective limit.\n");
905 relaxdata->feasible = FALSE;
906 *result = SCIP_CUTOFF;
911 SCIPdebugMessage(
"Node unbounded.");
912 relaxdata->feasible = TRUE;
913 *result = SCIP_SUCCESS;
914 *lowerbound = -SCIPinfinity(scip);
923 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
925 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &slength) );
927 assert( slength == nvars );
931 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
932 for (v = 0; v < nvars; v++)
937 *lowerbound = objforscip;
938 relaxdata->objval = objforscip;
941 SCIP_CALL( SCIPsetRelaxSolValsSol(scip, scipsol) );
943 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
945 relaxdata->feasible = TRUE;
946 *result = SCIP_SUCCESS;
948 SCIPfreeBufferArray(scip, &solforscip);
949 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
958 *result = SCIP_DIDNOTRUN;
964 objlb = -SCIPinfinity(scip);
966 if ( ! SCIPisInfinity(scip, objlb) )
969 SCIPdebugMessage(
"The relaxation could not be solved, using best computed bound from penalty formulation.\n");
971 else if ( ! SCIPisInfinity(scip, -1 * SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip))) )
973 *lowerbound = SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip));
974 SCIPdebugMessage(
"The relaxation could not be solved, keeping old bound.\n");
978 *result = SCIP_SUSPENDED;
979 SCIPerrorMessage(
"The relaxation of the root node could not be solved, so there is no hope to solve this instance.\n");
983 *result = SCIP_SUCCESS;
999 assert( scip != NULL );
1001 vars = SCIPgetVars(scip);
1004 for (i = 0; i < SCIPgetNVars(scip); i++)
1006 if ( SCIPisLT(scip, SCIPvarGetLbLocal(vars[i]), SCIPvarGetUbLocal(vars[i])) )
1018 SCIP_RELAXDATA* relaxdata;
1026 #ifdef SCIP_EVEN_MORE_DEBUG
1027 SCIP_VAR** varsfordebug = SCIPgetVars(scip);
1028 const int nvarsfordebug = SCIPgetNVars(scip);
1031 SCIPdebugMessage(
"Calling relaxExecSdp.\n");
1033 relaxdata = SCIPrelaxGetData(relax);
1034 vars = SCIPgetVars(scip);
1035 nvars = SCIPgetNVars(scip);
1038 if ( (relaxdata->lastsdpnode == SCIPnodeGetNumber(SCIPgetCurrentNode(scip)) && ( ! SCIPinProbing(scip) ) ) && relaxdata->origsolved && ! relaxdata->resolve )
1041 SCIP_Real objforscip;
1042 SCIP_Real* solforscip;
1046 SCIPdebugMessage(
"Already solved SDP-relaxation for node %ld, returning with SCIP_SUCCESS so that no other relaxator is called.\n",
1047 SCIPrelaxGetData(relax)->lastsdpnode);
1051 relaxdata->feasible = TRUE;
1052 *result = SCIP_SUCCESS;
1053 *lowerbound = -SCIPinfinity(scip);
1058 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
1060 SCIP_CALL(
SCIPsdpiGetSol(relaxdata->sdpi, &objforscip, solforscip, &slength) );
1062 assert( slength == nvars );
1066 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
1067 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, solforscip) );
1072 *lowerbound = SCIPgetSolTransObj(scip, scipsol);
1075 SCIP_CALL( SCIPgetLPColsData(scip, &cols, &ncols) );
1076 for (i = 0; i < ncols; i++)
1078 SCIP_CALL( SCIPsetRelaxSolVal(scip, SCIPcolGetVar(cols[i]), SCIPgetSolVal(scip, scipsol, SCIPcolGetVar(cols[i]))) );
1081 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
1082 *result = SCIP_SUCCESS;
1084 SCIPfreeBufferArray(scip, &solforscip);
1085 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
1087 *result = SCIP_SUCCESS;
1092 relaxdata->origsolved = FALSE;
1095 SCIP_CALL( SCIPconstructLP(scip, &cutoff) );
1099 relaxdata->feasible = FALSE;
1100 *result = SCIP_CUTOFF;
1105 SCIP_CALL( SCIPflushLP(scip) );
1108 nconss = SCIPgetNConss(scip);
1110 #ifdef SCIP_EVEN_MORE_DEBUG
1111 for (i = 0; i < nvarsfordebug; i++)
1113 SCIPdebugMessage(
"variable %s: status = %u, integral = %u, bounds = [%f, %f] \n", SCIPvarGetName(varsfordebug[i]), SCIPvarGetStatus(varsfordebug[i]),
1114 SCIPvarIsIntegral(varsfordebug[i]), SCIPvarGetLbLocal(varsfordebug[i]), SCIPvarGetUbLocal(varsfordebug[i]));
1121 relaxdata->feasible = TRUE;
1122 *result = SCIP_DIDNOTRUN;
1132 SCIP_CALL( SCIPallocBufferArray(scip, &ubs, nvars) );
1135 for (i = 0; i < nvars; i++)
1137 ubs[i] = SCIPvarGetUbLocal(vars[i]);
1138 *lowerbound += SCIPvarGetObj(vars[i]) * ubs[i];
1139 assert( SCIPisFeasEQ(scip, SCIPvarGetUbLocal(vars[i]), SCIPvarGetLbLocal(vars[i])));
1142 SCIPdebugMessage(
"EVERYTHING IS FIXED, objective value = %f\n", *lowerbound);
1144 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
1145 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, ubs) );
1148 for (i = 0; i < nvars; i++)
1150 SCIP_CALL( SCIPsetRelaxSolVal(scip, vars[i], SCIPvarGetLbLocal(vars[i])) );
1152 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
1155 SCIP_CALL( SCIPcheckSol(scip, scipsol, FALSE, TRUE, TRUE, TRUE, TRUE, &feasible) );
1157 relaxdata->feasible = feasible;
1159 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
1161 SCIPfreeBufferArray(scip, &ubs);
1163 *result = SCIP_SUCCESS;
1170 SCIP_CALL(
calcRelax(scip, relaxdata, result, lowerbound));
1181 SCIP_RELAXDATA* relaxdata;
1182 SCIP_RETCODE retcode;
1186 SCIP_Real penaltyparam;
1187 SCIP_Real maxpenaltyparam;
1190 SCIP_Real givenpenaltyparam;
1195 assert( relax != NULL );
1197 relaxdata = SCIPrelaxGetData(relax);
1198 assert( relaxdata != NULL );
1200 relaxdata->objval = 0.0;
1201 relaxdata->origsolved = FALSE;
1202 relaxdata->probingsolved = FALSE;
1203 relaxdata->sdpcalls = 0;
1204 relaxdata->sdpinterfacecalls = 0;
1205 relaxdata->sdpiterations = 0;
1206 relaxdata->solvedfast = 0;
1207 relaxdata->solvedmedium = 0;
1208 relaxdata->solvedstable = 0;
1209 relaxdata->solvedpenalty = 0;
1210 relaxdata->stablewslater = 0;
1211 relaxdata->unstablewslater = 0;
1212 relaxdata->boundedwslater = 0;
1213 relaxdata->unsolvedwslater = 0;
1214 relaxdata->stablenoslater = 0;
1215 relaxdata->unsolvednoslater = 0;
1216 relaxdata->boundednoslater = 0;
1217 relaxdata->unsolvednoslater = 0;
1218 relaxdata->nslaterholds = 0;
1219 relaxdata->nnoslater = 0;
1220 relaxdata->nslatercheckfailed = 0;
1221 relaxdata->npslaterholds = 0;
1222 relaxdata->npnoslater = 0;
1223 relaxdata->npslatercheckfailed = 0;
1224 relaxdata->ndslaterholds = 0;
1225 relaxdata->ndnoslater = 0;
1226 relaxdata->ndslatercheckfailed = 0;
1227 relaxdata->nslaterinfeasible = 0;
1228 relaxdata->stableinfeasible = 0;
1229 relaxdata->unstableinfeasible = 0;
1230 relaxdata->penaltyinfeasible = 0;
1231 relaxdata->boundedinfeasible = 0;
1232 relaxdata->unsolvedinfeasible = 0;
1233 relaxdata->unsolved = 0;
1234 relaxdata->feasible = FALSE;
1236 nvars = SCIPgetNVars(scip);
1237 vars = SCIPgetVars(scip);
1243 if ( SCIPgetNVars(scip) > 0 )
1249 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolvergaptol", &gaptol) );
1251 if ( retcode == SCIP_PARAMETERUNKNOWN )
1253 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1254 "SDP Solver <%s>: gaptol setting not available -- SCIP parameter has no effect.\n",
1259 SCIP_CALL( retcode );
1262 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolverfeastol", &feastol) );
1264 if ( retcode == SCIP_PARAMETERUNKNOWN )
1266 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1267 "SDP Solver <%s>: sdpsolverfeastol setting not available -- SCIP parameter has no effect.\n",
1272 SCIP_CALL( retcode );
1276 if ( retcode == SCIP_PARAMETERUNKNOWN )
1278 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1279 "SDP Solver <%s>: epsilon setting not available -- SCIP parameter has no effect.\n",
1284 SCIP_CALL( retcode );
1288 if ( retcode == SCIP_PARAMETERUNKNOWN )
1290 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1291 "SDP Solver <%s>: feastol setting not available -- SCIP parameter has no effect.\n",
1296 SCIP_CALL( retcode );
1300 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/penaltyparam", &penaltyparam) );
1301 if ( SCIPisGE(scip, penaltyparam, 0.0) )
1304 givenpenaltyparam = penaltyparam;
1305 if ( retcode == SCIP_PARAMETERUNKNOWN )
1307 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1308 "SDP Solver <%s>: penaltyparam setting not available -- SCIP parameter has no effect\n",
1313 SCIP_CALL( retcode );
1323 for (v = 0; v < nvars; v++)
1325 if ( SCIPisGT(scip, REALABS(SCIPvarGetObj(vars[v])), maxcoeff) )
1326 maxcoeff = REALABS(SCIPvarGetObj(vars[v]));
1333 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/maxpenaltyparam", &maxpenaltyparam) );
1334 if ( SCIPisGE(scip, maxpenaltyparam, 0.0) )
1338 if ( retcode == SCIP_PARAMETERUNKNOWN )
1340 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1341 "SDP Solver <%s>: maxpenaltyparam setting not available -- SCIP parameter has no effect.\n",
1346 SCIP_CALL( retcode );
1350 if ( SCIPisLT(scip, givenpenaltyparam, maxpenaltyparam) )
1352 SCIPdebugMessage(
"Penalty parameter %f overwritten by maxpenaltyparam %f! \n", givenpenaltyparam, maxpenaltyparam);
1358 SCIP_Real givenmaxpenaltyparam;
1364 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/npenaltyincr", &npenaltyincr) );
1366 if ( retcode == SCIP_PARAMETERUNKNOWN )
1368 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1369 "SDP Solver <%s>: npenaltyincr setting not available -- SCIP parameter has no effect.\n",
1374 SCIP_CALL( retcode );
1381 SCIP_Real lambdastar;
1383 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/lambdastar", &lambdastar) );
1384 if ( SCIPisGE(scip, lambdastar, 0.0) )
1397 conss = SCIPgetConss(scip);
1398 nconss = SCIPgetNConss(scip);
1401 for (c = 0; c < nconss; c++)
1404 if ( strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(conss[c])),
"SDP") == 0 )
1407 if ( (! SCIPisInfinity(scip, maxguess) ) && SCIPisGT(scip, guess, maxguess) )
1416 if ( retcode == SCIP_PARAMETERUNKNOWN )
1418 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1419 "SDP Solver <%s>: lambdastar setting not available -- SCIP parameter has no effect.\n",
1424 SCIP_CALL( retcode );
1427 SCIP_CALL( SCIPgetBoolParam(scip,
"relaxing/SDP/sdpinfo", &sdpinfo) );
1429 if ( retcode == SCIP_PARAMETERUNKNOWN )
1431 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1432 "SDP Solver <%s>: sdpinfo setting not available -- SCIP parameter has no effect.\n",
1437 SCIP_CALL( retcode );
1440 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/sdpsolverthreads", &nthreads) );
1445 if ( retcode == SCIP_PARAMETERUNKNOWN )
1447 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1448 "SDP Solver <%s>: nthreads setting not available -- SCIP parameter has no effect.\n",
1453 SCIP_CALL( retcode );
1457 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/slatercheck", &slatercheck) );
1459 if ( retcode == SCIP_PARAMETERUNKNOWN )
1461 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
1462 "SDP Solver <%s>: slatercheck setting not available -- SCIP parameter has no effect.\n",
1467 SCIP_CALL( retcode );
1480 assert( scip != NULL );
1481 assert( relax != NULL );
1482 assert(strcmp(SCIPrelaxGetName(relax),
RELAX_NAME) == 0);
1493 SCIP_RELAXDATA* relaxdata;
1495 assert( scip != NULL );
1496 assert( relax != NULL );
1498 relaxdata = SCIPrelaxGetData(relax);
1499 assert( relaxdata != NULL );
1501 SCIPdebugMessage(
"Exiting Relaxation Handler.\n");
1503 if ( relaxdata->displaystat && SCIPgetSubscipDepth(scip) == 0 )
1505 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"\nSDP iterations:\t\t\t\t%6d\n", relaxdata->sdpiterations);
1506 if ( relaxdata->sdpcalls )
1508 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Average SDP-iterations:\t\t\t%6.2f \n", (SCIP_Real) relaxdata->sdpiterations / (SCIP_Real) relaxdata->sdpcalls );
1510 if ( relaxdata->sdpinterfacecalls )
1514 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedfast / (SCIP_Real) relaxdata->sdpinterfacecalls);
1515 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'medium settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedmedium / (SCIP_Real) relaxdata->sdpinterfacecalls);
1516 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedstable / (SCIP_Real) relaxdata->sdpinterfacecalls);
1520 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'default formulation' solved:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedfast / (SCIP_Real) relaxdata->sdpinterfacecalls);
1522 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage penalty formulation used:\t%6.2f \n", 100.0 * (SCIP_Real) relaxdata->solvedpenalty / (SCIP_Real) relaxdata->sdpinterfacecalls);
1523 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);
1525 if ( relaxdata->slatercheck )
1527 if ( relaxdata->sdpinterfacecalls )
1529 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);
1530 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);
1531 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);
1533 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);
1534 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);
1535 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);
1536 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);
1538 if ( relaxdata->nslaterholds )
1540 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with primal and dual slater holding:\t%6.2f \n",
1541 100.0 * (SCIP_Real) relaxdata->stablewslater / (SCIP_Real) relaxdata->nslaterholds);
1542 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with primal and dual slater holding:\t%6.2f \n",
1543 100.0 * (SCIP_Real) relaxdata->unstablewslater / (SCIP_Real) relaxdata->nslaterholds);
1544 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with primal and dual slater holding:\t%6.2f \n",
1545 100.0 * (SCIP_Real) relaxdata->penaltywslater / (SCIP_Real) relaxdata->nslaterholds);
1546 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with primal and dual slater holding:\t%6.2f \n",
1547 100.0 * (SCIP_Real) relaxdata->boundedwslater / (SCIP_Real) relaxdata->nslaterholds);
1548 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with primal and dual slater holding:\t%6.2f \n",
1549 100.0 * (SCIP_Real) relaxdata->unsolvedwslater / (SCIP_Real) relaxdata->nslaterholds);
1551 if ( relaxdata->nnoslater )
1553 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with either primal or dual slater not holding:\t%6.2f \n",
1554 100.0 * (SCIP_Real) relaxdata->stablenoslater / (SCIP_Real) relaxdata->nnoslater);
1555 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with either primal or dual slater not holding:\t%6.2f \n",
1556 100.0 * (SCIP_Real) relaxdata->unstablenoslater / (SCIP_Real) relaxdata->nnoslater);
1557 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with either primal or dual slater not holding:\t%6.2f \n",
1558 100.0 * (SCIP_Real) relaxdata->penaltynoslater / (SCIP_Real) relaxdata->nnoslater);
1559 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with either primal or dual slater not holding:\t%6.2f \n",
1560 100.0 * (SCIP_Real) relaxdata->boundednoslater / (SCIP_Real) relaxdata->nnoslater);
1561 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with either primal or dual slater not holding:\t%6.2f \n",
1562 100.0 * (SCIP_Real) relaxdata->unsolvednoslater / (SCIP_Real) relaxdata->nnoslater);
1564 if ( relaxdata->nslaterinfeasible )
1566 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'fastest settings' with slater check showing infeasibility:\t%6.2f \n",
1567 100.0 * (SCIP_Real) relaxdata->stableinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1568 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'stable settings' with slater check showing infeasibility:\t%6.2f \n",
1569 100.0 * (SCIP_Real) relaxdata->unstableinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1570 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'penalty' with slater check showing infeasibility:\t%6.2f \n",
1571 100.0 * (SCIP_Real) relaxdata->penaltyinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1572 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'computed infeasible lower bound' with slater check showing infeasibility:\t%6.2f \n",
1573 100.0 * (SCIP_Real) relaxdata->boundedinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1574 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Percentage 'unsolved' with slater check showing infeasibility:\t%6.2f \n",
1575 100.0 * (SCIP_Real) relaxdata->unsolvedinfeasible / (SCIP_Real) relaxdata->nslaterinfeasible);
1577 #ifdef SLATERSOLVED_ABSOLUTE
1578 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with primal and dual slater holding:\t%d \n", relaxdata->nslaterholds);
1579 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'fastest settings' and primal and dual slater holding:\t%d \n", relaxdata->stablewslater);
1580 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'stable settings' and primal and dual slater holding:\t%d \n", relaxdata->unstablewslater);
1581 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'penalty' and primal and dual slater holding:\t%d \n", relaxdata->penaltywslater);
1582 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);
1583 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'unsolved' and primal and dual slater holding:\t%d \n", relaxdata->unsolvedwslater);
1585 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with either primal or dual slater not holding:\t%d \n", relaxdata->nnoslater);
1586 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);
1587 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);
1588 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'penalty' and either primal or dual slater not holding:\t%d \n", relaxdata->penaltynoslater);
1589 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);
1590 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of nodes with 'unsolved' and either primal or dual slater not holding:\t%d \n", relaxdata->unsolvednoslater);
1592 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes:\t%d \n", relaxdata->nslaterinfeasible);
1593 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'fastest settings':\t%d \n", relaxdata->stableinfeasible);
1594 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'stable settings':\t%d \n", relaxdata->unstableinfeasible);
1595 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'penalty':\t%d \n", relaxdata->penaltyinfeasible);
1596 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'computed infeasible lower bound':\t%d \n", relaxdata->boundedinfeasible);
1597 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL,
"Number of infeasible nodes with 'unsolved':\t%d \n", relaxdata->unsolvedinfeasible);
1602 if ( relaxdata->varmapper != NULL )
1607 relaxdata->objval = 0.0;
1608 relaxdata->origsolved = FALSE;
1609 relaxdata->probingsolved = FALSE;
1610 relaxdata->feasible = FALSE;
1611 relaxdata->sdpiterations = 0;
1612 relaxdata->sdpcalls = 0;
1613 relaxdata->sdpinterfacecalls = 0;
1614 relaxdata->lastsdpnode = 0;
1624 SCIP_RELAXDATA* relaxdata;
1626 relaxdata = SCIPrelaxGetData(relax);
1627 assert(relaxdata != NULL);
1629 if ( relaxdata->sdpi != NULL )
1634 SCIPfreeMemory(scip, &relaxdata);
1636 SCIPrelaxSetData(relax, NULL);
1646 SCIP_RELAXDATA* relaxdata = NULL;
1650 assert( scip != NULL );
1653 SCIP_CALL( SCIPallocMemory(scip, &relaxdata) );
1654 SCIP_CALL(
SCIPsdpiCreate(&sdpi, SCIPgetMessagehdlr(scip), SCIPblkmem(scip), SCIPbuffer(scip)) );
1656 relaxdata->sdpi = sdpi;
1657 relaxdata->lastsdpnode = -1;
1661 assert( relax != NULL );
1664 SCIP_CALL( SCIPsetRelaxInitsol(scip, relax, relaxInitSolSdp) );
1665 SCIP_CALL( SCIPsetRelaxExit(scip, relax, relaxExitSdp) );
1666 SCIP_CALL( SCIPsetRelaxFree(scip, relax, relaxFreeSdp) );
1667 SCIP_CALL( SCIPsetRelaxCopy(scip, relax, relaxCopySdp) );
1670 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolvergaptol",
1671 "the stopping criterion for the duality gap the sdpsolver should use",
1674 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolverfeastol",
1675 "the feasibility tolerance for the SDP solver",
1678 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/penaltyparam",
1679 "the starting value of the penalty parameter Gamma used for the penalty formulation if the "
1680 "SDP solver didn't converge; set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->penaltyparam),
1683 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/maxpenaltyparam",
1684 "the maximum value of the penalty parameter Gamma used for the penalty formulation if the "
1685 "SDP solver didn't converge; set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->maxpenaltyparam),
1688 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/npenaltyincr",
1689 "maximum number of times the penalty parameter will be increased if the penalty formulation failed", &(relaxdata->npenaltyincr), TRUE,
1692 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/lambdastar",
1693 "the parameter lambda star used by SDPA to set the initial point;"
1694 "set this to a negative value to compute the parameter depending on the given problem", &(relaxdata->lambdastar),
1697 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/slatercheck",
1698 "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 "
1699 "every problem not satisfying primal and dual Slater condition", &(relaxdata->slatercheck), TRUE,
DEFAULT_SLATERCHECK, 0, 2, NULL, NULL) );
1701 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/sdpinfo",
1702 "Should the SDP solver output information to the screen?",
1705 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/objlimit",
1706 "Should an objective limit be given to the SDP-Solver?",
1709 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/resolve",
1710 "Should the relaxation be resolved after bound-tightenings were found during propagation (outside of probing)?",
1713 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/tightenvb",
1714 "Should Big-Ms in varbound-like constraints be tightened before giving them to the SDP-solver ?",
1717 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/displaystatistics",
1718 "Should statistics about SDP iterations and solver settings/success be printed after quitting SCIP-SDP ?",
1721 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/settingsresetfreq",
1722 "frequency for resetting parameters in SDP solver and trying again with fastest settings (-1: never, 0: only at depth settingsresetofs);"
1723 "currently only supported for SDPA",
1726 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/settingsresetofs",
1727 "frequency offset for resetting parameters in SDP solver and trying again with fastest settings; currently only supported for SDPA",
1730 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/sdpsolverthreads",
1731 "number of threads the SDP solver should use (-1 = number of cores); currently only supported for MOSEK",
1760 SCIP_RELAXDATA* relaxdata;
1762 assert( relax != NULL );
1763 assert( lbvars != NULL );
1764 assert( ubvars != NULL );
1765 assert( arraylength != NULL );
1766 assert( *arraylength >= 0 );
1768 relaxdata = SCIPrelaxGetData(relax);
1769 assert( relaxdata != NULL );
1783 SCIP_RELAXDATA* relaxdata;
1785 assert( relax != NULL );
1786 assert( success != NULL );
1787 assert( objval != NULL );
1789 relaxdata = SCIPrelaxGetData(relax);
1790 assert( relaxdata != NULL );
1792 *success = relaxdata->origsolved;
1793 *objval = relaxdata->objval;
1803 SCIP_Real* solarray,
1807 SCIP_RELAXDATA* relaxdata;
1809 assert( relax != NULL );
1810 assert( success != NULL );
1811 assert( solarray != NULL );
1813 relaxdata = SCIPrelaxGetData(relax);
1814 assert( relaxdata != NULL );
1816 *success = relaxdata->origsolved;
1818 if ( *sollength >= SCIPgetNVars(scip) )
1820 SCIP_CALL(
SCIPsdpiGetSol(relaxdata->sdpi, NULL, solarray, sollength) );
1824 SCIPdebugMessage(
"Called SCIPrelaxSdpGetRelaxSol with an array that wasn't big enough, needed length %d, given %d!\n", SCIPgetNVars(scip), *sollength);
1825 *sollength = SCIPgetNVars(scip);
1836 assert( relax != NULL );
1837 assert( SCIPrelaxGetData(relax) != NULL );
1839 return SCIPrelaxGetData(relax)->lastsdpnode;
1847 SCIP_RELAXDATA* relaxdata;
1849 assert( relax != NULL );
1851 relaxdata = SCIPrelaxGetData(relax);
1853 assert( relaxdata != NULL );
1854 assert( relaxdata->sdpi != NULL );
1864 SCIP_RELAXDATA* relaxdata;
1866 assert( relax != NULL );
1868 relaxdata = SCIPrelaxGetData(relax);
1870 assert( relaxdata != NULL );
1871 assert( relaxdata->sdpi != NULL );
1873 return relaxdata->probingsolved;
1881 assert( relax != NULL );
1882 assert( SCIPrelaxGetData(relax) != NULL );
1884 return ( SCIPrelaxGetData(relax)->feasible );
1892 assert( relax != NULL );
1893 assert( SCIPrelaxGetData(relax) != NULL );
1895 return SCIPrelaxGetData(relax)->sdpiterations;
1903 assert( relax != NULL );
1904 assert( SCIPrelaxGetData(relax) != NULL );
1906 return ( SCIPrelaxGetData(relax)->sdpcalls );
1914 assert( relax != NULL );
1915 assert( SCIPrelaxGetData(relax) != NULL );
1917 return ( SCIPrelaxGetData(relax)->sdpinterfacecalls );
1925 assert( relax != NULL );
1926 assert( SCIPrelaxGetData(relax) != NULL );
1928 return ( SCIPrelaxGetData(relax)->solvedfast );
1936 assert( relax != NULL );
1937 assert( SCIPrelaxGetData(relax) != NULL );
1939 return ( SCIPrelaxGetData(relax)->solvedmedium );
1947 assert( relax != NULL );
1948 assert( SCIPrelaxGetData(relax) != NULL );
1950 return ( SCIPrelaxGetData(relax)->solvedstable );
1958 assert( relax != NULL );
1959 assert( SCIPrelaxGetData(relax) != NULL );
1961 return ( SCIPrelaxGetData(relax)->solvedpenalty );
1969 assert( relax != NULL );
1970 assert( SCIPrelaxGetData(relax) != NULL );
1972 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