55 #define RELAX_NAME "SDP"
56 #define RELAX_DESC "SDP relaxator"
57 #define RELAX_PRIORITY 1
60 #define DEFAULT_SDPSOLVEREPSILON 1e-5
61 #define DEFAULT_SDPSOLVERFEASTOL 1e-4
63 #define DEFAULT_THREADS 1
65 #define DEFAULT_OBJLIMIT FALSE
78 SCIP_Real sdpsolverepsilon;
79 SCIP_Real sdpsolverfeastol;
84 SCIP_Bool slatercheck;
103 SCIP_VAR ** blockvars;
115 SCIP_Real** constval;
117 int constnnonzcounter;
121 SCIP_CONSHDLR* conshdlr;
125 int* nconstblocknonz;
128 const char* hdlrName;
131 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolverepsilon", ¶m) );
133 SCIPdebugMessage(
"Putting SDP Data in general interface! \n");
135 assert( scip != NULL );
136 assert( sdpi != NULL );
138 vars = SCIPgetVars(scip);
139 nvars = SCIPgetNVars(scip);
142 SCIP_CALL( SCIPallocBufferArray(scip, &obj, nvars) );
143 SCIP_CALL( SCIPallocBufferArray(scip, &lb, nvars) );
144 SCIP_CALL( SCIPallocBufferArray(scip, &ub, nvars) );
146 for (i = 0; i < nvars; i++)
148 obj[i] = SCIPvarGetObj(vars[i]);
149 lb[i] = SCIPvarGetLbLocal(vars[i]);
150 ub[i] = SCIPvarGetUbLocal(vars[i]);
153 nconss = SCIPgetNConss(scip);
154 conss = SCIPgetConss(scip);
161 for (i = 0; i < nconss; i++)
163 conshdlr = SCIPconsGetHdlr(conss[i]);
164 assert( conshdlr != NULL );
166 hdlrName = SCIPconshdlrGetName(conshdlr);
168 #ifdef SCIP_EVEN_MORE_DEBUG
169 SCIP_CALL( SCIPprintCons(scip, conss[i], NULL) );
170 SCIPinfoMessage(scip, NULL,
"\n");
173 if ( strcmp(hdlrName,
"SDP") == 0 )
178 sdpnnonz += blocknnonz;
179 sdpconstnnonz += constnnonzcounter;
184 SCIP_CALL( SCIPallocBufferArray(scip, &sdpblocksizes, nsdpblocks) );
185 SCIP_CALL( SCIPallocBufferArray(scip, &nblockvarnonz, nsdpblocks) );
186 SCIP_CALL( SCIPallocBufferArray(scip, &nconstblocknonz, nsdpblocks) );
187 SCIP_CALL( SCIPallocBufferArray(scip, &col, nsdpblocks) );
188 SCIP_CALL( SCIPallocBufferArray(scip, &row, nsdpblocks) );
189 SCIP_CALL( SCIPallocBufferArray(scip, &val, nsdpblocks) );
190 SCIP_CALL( SCIPallocBufferArray(scip, &constcol, nsdpblocks) );
191 SCIP_CALL( SCIPallocBufferArray(scip, &constrow, nsdpblocks) );
192 SCIP_CALL( SCIPallocBufferArray(scip, &constval, nsdpblocks) );
193 SCIP_CALL( SCIPallocBufferArray(scip, &nblockvars, nsdpblocks) );
194 SCIP_CALL( SCIPallocBufferArray(scip, &sdpvar, nsdpblocks) );
196 for (i = 0; i < nsdpblocks; i++)
198 SCIP_CALL( SCIPallocBufferArray(scip, &(nblockvarnonz[i]), nvars) );
199 SCIP_CALL( SCIPallocBufferArray(scip, &col[i], nvars) );
200 SCIP_CALL( SCIPallocBufferArray(scip, &row[i], nvars) );
201 SCIP_CALL( SCIPallocBufferArray(scip, &val[i], nvars) );
206 SCIP_CALL( SCIPallocBufferArray(scip, &blockvars, nvars) );
208 for (i = 0; i < nconss; i++)
210 conshdlr = SCIPconsGetHdlr(conss[i]);
211 assert( conshdlr != NULL );
213 hdlrName = SCIPconshdlrGetName(conshdlr);
215 if ( strcmp(hdlrName,
"SDP") == 0 )
217 assert( ind < nsdpblocks );
221 nconstblocknonz[ind] = constlength;
222 SCIP_CALL( SCIPallocBufferArray(scip, &(constcol[ind]), constlength) );
223 SCIP_CALL( SCIPallocBufferArray(scip, &(constrow[ind]), constlength) );
224 SCIP_CALL( SCIPallocBufferArray(scip, &(constval[ind]), constlength) );
227 SCIP_CALL(
SCIPconsSdpGetData(scip, conss[i], &nblockvars[ind], &blocknnonz, &sdpblocksizes[ind], &nvars, nblockvarnonz[ind], col[ind],
228 row[ind], val[ind], blockvars, &nconstblocknonz[ind], constcol[ind], constrow[ind], constval[ind]) );
231 assert( nvars == SCIPgetNVars(scip) );
232 assert( nconstblocknonz[ind] <= constlength );
234 SCIP_CALL( SCIPallocBufferArray(scip, &(sdpvar[ind]), nblockvars[ind]) );
237 for (j = 0; j < nblockvars[ind]; j++)
245 SCIPfreeBufferArray(scip, &blockvars);
248 sdpblocksizes, nblockvars, sdpconstnnonz, nconstblocknonz, constrow,
249 constcol, constval, sdpnnonz, nblockvarnonz, sdpvar,
251 NULL, NULL, 0, NULL, NULL, NULL));
254 for (i = 0; i < nsdpblocks; i++)
256 SCIPfreeBufferArrayNull(scip, &(sdpvar[i]));
257 SCIPfreeBufferArrayNull(scip, &val[i]);
258 SCIPfreeBufferArrayNull(scip, &row[i]);
259 SCIPfreeBufferArrayNull(scip, &col[i]);
260 SCIPfreeBufferArrayNull(scip, &(nblockvarnonz[i]));
261 SCIPfreeBufferArrayNull(scip, &(constval[i]));
262 SCIPfreeBufferArrayNull(scip, &(constrow[i]));
263 SCIPfreeBufferArrayNull(scip, &(constcol[i]));
266 SCIPfreeBufferArrayNull(scip, &sdpvar);
267 SCIPfreeBufferArrayNull(scip, &nblockvars);
268 SCIPfreeBufferArrayNull(scip, &constval);
269 SCIPfreeBufferArrayNull(scip, &constrow);
270 SCIPfreeBufferArrayNull(scip, &constcol);
271 SCIPfreeBufferArrayNull(scip, &val);
272 SCIPfreeBufferArrayNull(scip, &row);
273 SCIPfreeBufferArrayNull(scip, &col);
274 SCIPfreeBufferArrayNull(scip, &nconstblocknonz);
275 SCIPfreeBufferArrayNull(scip, &nblockvarnonz);
276 SCIPfreeBufferArrayNull(scip, &sdpblocksizes);
277 SCIPfreeBufferArray(scip, &ub);
278 SCIPfreeBufferArray(scip, &lb);
279 SCIPfreeBufferArray(scip, &obj);
316 assert( scip != NULL );
317 assert( sdpi != NULL );
318 assert( varmapper != NULL );
320 nvars = SCIPgetNVars(scip);
323 SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
325 SCIPdebugMessage(
"inserting %d LPRows into the interface \n", nrows);
329 for (i = 0; i < nrows; i++)
331 assert( rows[i] != NULL );
332 scipnnonz += SCIProwGetNNonz(rows[i]);
336 SCIP_CALL( SCIPallocBufferArray(scip, &lhs, nrows) );
337 SCIP_CALL( SCIPallocBufferArray(scip, &rhs, nrows) );
338 SCIP_CALL( SCIPallocBufferArray(scip, &rowind, scipnnonz) );
339 SCIP_CALL( SCIPallocBufferArray(scip, &colind, scipnnonz) );
340 SCIP_CALL( SCIPallocBufferArray(scip, &val, scipnnonz) );
346 for (i = 0; i < nrows; i++)
352 rownnonz = SCIProwGetNNonz(row);
354 rowvals = SCIProwGetVals(row);
355 rowcols = SCIProwGetCols(row);
356 sciplhs = SCIProwGetLhs(row) - SCIProwGetConstant(row);
357 sciprhs = SCIProwGetRhs(row) - SCIProwGetConstant(row);
359 for (j = 0; j < rownnonz; j++)
361 assert( SCIPcolGetVar(rowcols[j]) != 0 );
363 rowind[nnonz] = nconss;
364 val[nnonz] = rowvals[j];
367 lhs[nconss] = sciplhs;
368 rhs[nconss] = sciprhs;
380 SCIP_CALL(
SCIPsdpiAddLPRows(sdpi, nconss, lhs, rhs, nnonz, (
const int*)rowind, (
const int*)colind, val) );
383 SCIPfreeBufferArray(scip, &val);
384 SCIPfreeBufferArray(scip, &colind);
385 SCIPfreeBufferArray(scip, &rowind);
386 SCIPfreeBufferArray(scip, &rhs);
387 SCIPfreeBufferArray(scip, &lhs);
392 vars = SCIPgetVars(scip);
393 assert( vars != NULL );
396 SCIP_CALL( SCIPallocBufferArray(scip, &lb, nvars) );
397 SCIP_CALL( SCIPallocBufferArray(scip, &ub, nvars) );
398 SCIP_CALL( SCIPallocBufferArray(scip, &inds, nvars) );
401 for (i = 0; i < nvars; i++)
403 assert( vars[i] != NULL );
404 lb[i] = SCIPvarGetLbLocal(vars[i]);
405 ub[i] = SCIPvarGetUbLocal(vars[i]);
413 SCIPfreeBufferArray(scip, &inds);
414 SCIPfreeBufferArray(scip, &ub);
415 SCIPfreeBufferArray(scip, &lb);
425 SCIP_RELAXDATA* relaxdata,
427 SCIP_Real* lowerbound
437 #ifdef SCIP_MORE_DEBUG
438 SCIP_Real objforscip;
439 SCIP_Real* solforscip;
444 SCIPdebugMessage(
"calc_relax called\n");
446 assert( scip != NULL );
447 assert( result != NULL );
448 assert( lowerbound != NULL );
450 nvars = SCIPgetNVars(scip);
452 vars = SCIPgetVars (scip);
454 sdpi = relaxdata->sdpi;
455 assert( sdpi != NULL );
456 varmapper = relaxdata->varmapper;
457 assert( varmapper != NULL );
459 if ( relaxdata->objlimit )
467 rootnode = (SCIPnodeGetNumber(SCIPgetCurrentNode(scip)) == 1);
470 SCIP_CALL(
SCIPsdpiSolve(sdpi, NULL, &(relaxdata->sdpiterations), rootnode) );
471 relaxdata->lastsdpnode = SCIPnodeGetNumber(SCIPgetCurrentNode(scip));
474 relaxdata->origsolved = TRUE;
478 SCIP_NODE* node = SCIPnodeGetParent(SCIPgetCurrentNode(scip));
480 relaxdata->origsolved = FALSE;
485 *result = SCIP_SUSPENDED;
486 SCIPerrorMessage(
"The relaxation of the root node could not be solved, so there is no hope to solve this instance. \n");
490 *lowerbound = SCIPnodeGetLowerbound(node);
491 *result = SCIP_SUCCESS;
492 SCIP_CALL( SCIPupdateLocalLowerbound(scip, *lowerbound) );
493 SCIPdebugMessage(
"The relaxation couldn't be solved, so the relaxation result from the parent node was copied. \n");
497 #ifdef SCIP_MORE_DEBUG
499 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
501 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &sollength) );
503 assert( sollength == nvars );
506 SCIPdebugMessage(
"optimal solution: objective = %f, ", objforscip);
514 SCIPdebugMessage(
"The solver could not determine feasibility ! ");
516 for (i = 0; i < nvars; ++i)
518 printf(
"%s = %f, ", SCIPvarGetName(vars[i]), solforscip[i]);
520 SCIPdebugMessage(
"\n");
522 SCIPfreeBufferArray(scip, &solforscip);
529 SCIPdebugMessage(
"Node cut off due to infeasibility.\n");
530 *result = SCIP_CUTOFF;
535 SCIPdebugMessage(
"Node cut off due to objective limit.\n");
536 *result = SCIP_CUTOFF;
541 SCIPdebugMessage(
"Node unbounded.");
542 *result = SCIP_SUCCESS;
543 *lowerbound = -SCIPinfinity(scip);
548 #ifndef SCIP_MORE_DEBUG
549 SCIP_Real objforscip;
550 SCIP_Real* solforscip;
561 SCIP_CALL( SCIPallocBufferArray(scip, &solforscip, nvars) );
563 SCIP_CALL(
SCIPsdpiGetSol(sdpi, &objforscip, solforscip, &slength) );
565 assert( slength == nvars );
570 for (v = 0; v < nvars; v++)
580 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
581 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, solforscip) );
583 *lowerbound = objforscip;
584 relaxdata->objval = objforscip;
588 SCIP_CALL( SCIPcheckSol(scip, scipsol, TRUE, FALSE, FALSE, FALSE, &allfeas) );
591 SCIP_CALL( SCIPtrySol(scip, scipsol, TRUE, FALSE, FALSE, FALSE, &stored) );
593 SCIPdebugMessage(
"feasible solution for MISDP found, cut node off, solution is stored \n");
595 SCIPdebugMessage(
"feasible solution for MISDP found, cut node off, solution is worse than earlier one \n");
597 SCIPfreeBufferArray(scip, &solforscip);
598 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
600 *result = SCIP_CUTOFF;
603 SCIPdebugMessage(
"WARNING!!! Found a solution that is feasible for the SDP-solver and integrality, but infeasible for "
604 "SCIP, this will probably not properly get enforced ! \n");
608 SCIP_CALL( SCIPgetLPColsData(scip, &cols, &ncols) );
609 for (i = 0; i < ncols; i++)
610 SCIP_CALL( SCIPsetRelaxSolVal(scip, SCIPcolGetVar(cols[i]), SCIPgetSolVal(scip, scipsol, SCIPcolGetVar(cols[i]))) );
612 SCIP_CALL( SCIPmarkRelaxSolValid(scip) );
613 *result = SCIP_SUCCESS;
618 int oldncuts = SCIPgetNCuts(scip);
620 if ( SCIPgetNCuts(scip) > oldncuts )
621 *result = SCIP_SEPARATED;
623 for (i = 0; i < nvars; ++i)
625 SCIP_VAR* var = vars[i];
626 if ( SCIPvarIsIntegral(var) && ! SCIPisFeasIntegral(scip, solforscip[i]) && ! SCIPisEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
629 SCIP_CALL( SCIPaddExternBranchCand(scip, var, 10000.0, solforscip[i]) );
633 SCIPfreeBufferArray(scip, &solforscip);
634 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
654 assert( scip != NULL );
656 vars = SCIPgetVars(scip);
659 for (i = 0; i < SCIPgetNVars(scip); i++)
661 if ( SCIPisLT(scip, SCIPvarGetLbLocal(vars[i]), SCIPvarGetUbLocal(vars[i])) )
673 SCIP_RELAXDATA* relaxdata;
682 #ifdef SCIP_EVEN_MORE_DEBUG
683 SCIP_VAR** varsfordebug = SCIPgetVars(scip);
684 const int nvarsfordebug = SCIPgetNVars(scip);
688 SCIP_CALL( SCIPconstructLP(scip, &cutoff) );
692 *result = SCIP_CUTOFF;
697 SCIP_CALL( SCIPflushLP(scip) );
700 nconss = SCIPgetNConss(scip);
702 #ifdef SCIP_EVEN_MORE_DEBUG
703 for (i = 0; i < nvarsfordebug; i++)
705 SCIPdebugMessage(
"variable %s: status = %u, integral = %u, bounds = [%f, %f] \n", SCIPvarGetName(varsfordebug[i]), SCIPvarGetStatus(varsfordebug[i]),
706 SCIPvarIsIntegral(varsfordebug[i]), SCIPvarGetLbLocal(varsfordebug[i]), SCIPvarGetUbLocal(varsfordebug[i]));
713 *result = SCIP_DIDNOTRUN;
723 vars = SCIPgetVars(scip);
724 nvars = SCIPgetNVars(scip);
726 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &ubs, nvars) );
729 for (i = 0; i < nvars; i++)
731 ubs[i] = SCIPvarGetUbLocal(vars[i]);
732 *lowerbound += SCIPvarGetObj(vars[i]) * ubs[i];
733 assert( SCIPisEQ(scip, SCIPvarGetUbLocal(vars[i]), SCIPvarGetLbLocal(vars[i])));
735 if ( SCIPgetObjsense(scip) == -1 )
738 SCIPdebugMessage(
"EVERYTHING IS FIXED, objective value = %f\n", *lowerbound);
740 SCIP_CALL( SCIPcreateSol(scip, &scipsol, NULL) );
741 SCIP_CALL( SCIPsetSolVals(scip, scipsol, nvars, vars, ubs) );
744 SCIP_CALL( SCIPcheckSol(scip, scipsol, FALSE, TRUE, TRUE, TRUE, &feasible) );
749 SCIP_CALL( SCIPtrySolFree(scip, &scipsol, FALSE, FALSE, FALSE, FALSE, &stored) );
753 SCIP_CALL( SCIPfreeSol(scip, &scipsol) );
756 if (feasible && stored == 1)
758 *result = SCIP_CUTOFF;
759 SCIPdebugMessage(
"New solution was stored, node is cut off !\n");
763 *result = SCIP_CUTOFF;
764 SCIPdebugMessage(
"Fixed solution either infeasible or not good enough for storage, node cut off !\n");
767 SCIPfreeBlockMemoryArray(scip, &ubs, nvars);
772 relaxdata = SCIPrelaxGetData(relax);
777 SCIP_CALL(
calc_relax(scip, relaxdata, result, lowerbound));
778 relaxdata->sdpcalls++;
793 SCIP_RELAXDATA* relaxdata;
794 SCIP_RETCODE retcode;
803 SCIP_Bool slatercheck;
805 assert( relax != NULL );
807 relaxdata = SCIPrelaxGetData(relax);
809 assert( relaxdata != NULL );
811 relaxdata->objval = 0.0;
812 relaxdata->origsolved = FALSE;
813 relaxdata->sdpcalls = 0;
814 relaxdata->sdpiterations = 0;
816 nvars = SCIPgetNVars(scip);
817 vars = SCIPgetVars(scip);
823 if ( SCIPgetNVars(scip) > 0 )
829 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolverepsilon", &epsilon) );
831 if ( retcode == SCIP_PARAMETERUNKNOWN )
833 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
834 "SDP Solver <%s>: epsilon setting not available -- SCIP parameter has no effect\n",
839 SCIP_CALL( retcode );
842 SCIP_CALL( SCIPgetRealParam(scip,
"relaxing/SDP/sdpsolverfeastol", &feastol) );
844 if ( retcode == SCIP_PARAMETERUNKNOWN )
846 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
847 "SDP Solver <%s>: feastol setting not available -- SCIP parameter has no effect\n",
852 SCIP_CALL( retcode );
856 SCIP_CALL( SCIPgetIntParam(scip,
"relaxing/SDP/threads", &threads) );
858 if ( retcode == SCIP_PARAMETERUNKNOWN )
860 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
861 "SDP Solver <%s>: threads setting not available -- SCIP parameter has no effect\n",
866 SCIP_CALL( retcode );
870 SCIP_CALL( SCIPgetBoolParam(scip,
"relaxing/SDP/sdpinfo", &sdpinfo) );
872 if ( retcode == SCIP_PARAMETERUNKNOWN )
874 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
875 "SDP Solver <%s>: sdpinfo setting not available -- SCIP parameter has no effect\n",
880 SCIP_CALL( retcode );
883 SCIP_CALL( SCIPgetBoolParam(scip,
"relaxing/SDP/slatercheck", &slatercheck) );
885 if ( retcode == SCIP_PARAMETERUNKNOWN )
887 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL,
888 "SDP Solver <%s>: slatercheck setting not available -- SCIP parameter has no effect\n",
893 SCIP_CALL( retcode );
903 assert( scip != NULL );
904 assert( relax != NULL );
905 assert(strcmp(SCIPrelaxGetName(relax),
RELAX_NAME) == 0);
916 SCIP_RELAXDATA* relaxdata;
918 assert( scip != NULL );
919 assert( relax != NULL );
921 SCIPdebugMessage(
"Exiting Relaxation Handler \n");
923 relaxdata = SCIPrelaxGetData(relax);
924 assert( relaxdata != NULL );
926 if ( relaxdata->varmapper != NULL )
931 relaxdata->objval = 0.0;
932 relaxdata->origsolved = FALSE;
933 relaxdata->sdpiterations = 0;
934 relaxdata->sdpcalls = 0;
935 relaxdata->lastsdpnode = 0;
945 SCIP_RELAXDATA* relaxdata;
947 relaxdata = SCIPrelaxGetData(relax);
948 assert(relaxdata != NULL);
950 if ( relaxdata->sdpi != NULL )
955 SCIPfreeMemory(scip, &relaxdata);
957 SCIPrelaxSetData(relax, NULL);
968 SCIP_RELAXDATA* relaxdata = NULL;
972 assert( scip != NULL );
975 SCIP_CALL( SCIPallocMemory(scip, &relaxdata) );
978 relaxdata->sdpi = sdpi;
979 relaxdata->lastsdpnode = -1;
983 relaxExecSdp, relaxdata) );
984 assert( relax != NULL );
987 SCIP_CALL( SCIPsetRelaxInitsol(scip, relax, relaxInitSolSdp) );
988 SCIP_CALL( SCIPsetRelaxExit(scip, relax, relaxExitSdp) );
989 SCIP_CALL( SCIPsetRelaxFree(scip, relax, relaxFreeSdp) );
990 SCIP_CALL( SCIPsetRelaxCopy(scip, relax, relaxCopySdp) );
993 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolverepsilon",
"the stopping criterion for the duality gap the sdpsolver should use",
995 SCIP_CALL( SCIPaddRealParam(scip,
"relaxing/SDP/sdpsolverfeastol",
"the feasibility tolerance the SDP solver should use for the SDP constraints",
998 SCIP_CALL( SCIPaddIntParam(scip,
"relaxing/SDP/threads",
"number of threads used for SDP solving",
999 &(relaxdata->threads), TRUE, DEFAULT_THREADS, 1, INT_MAX, NULL, NULL) );
1001 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/slatercheck",
"should the Slater condition for the dual problem be check ahead of solving each SDP?",
1002 &(relaxdata->slatercheck), TRUE, FALSE, NULL, NULL) );
1003 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/sdpinfo",
"should the SDP solver output information to the screen?",
1004 &(relaxdata->sdpinfo), TRUE, FALSE, NULL, NULL) );
1005 SCIP_CALL( SCIPaddBoolParam(scip,
"relaxing/SDP/objlimit",
"should an objective limit be given to the SDP-Solver?",
1033 SCIP_RELAXDATA* relaxdata;
1035 assert( relax != NULL );
1036 assert( lbvars != NULL );
1037 assert( ubvars != NULL );
1038 assert( arraylength != NULL );
1039 assert( *arraylength >= 0 );
1041 relaxdata = SCIPrelaxGetData(relax);
1042 assert( relaxdata != NULL );
1056 SCIP_RELAXDATA* relaxdata;
1058 assert( relax != NULL );
1059 assert( success != NULL );
1060 assert( objval != NULL );
1062 relaxdata = SCIPrelaxGetData(relax);
1063 assert( relaxdata != NULL );
1065 *success = relaxdata->origsolved;
1066 *objval = relaxdata->objval;
1076 SCIP_Real* solarray,
1080 SCIP_RELAXDATA* relaxdata;
1082 assert( relax != NULL );
1083 assert( success != NULL );
1084 assert( solarray != NULL );
1086 relaxdata = SCIPrelaxGetData(relax);
1087 assert( relaxdata != NULL );
1089 *success = relaxdata->origsolved;
1091 if ( *sollength >= SCIPgetNVars(scip) )
1092 SCIP_CALL(
SCIPsdpiGetSol(relaxdata->sdpi, NULL, solarray, sollength) );
1095 SCIPdebugMessage(
"Called SCIPrelaxSdpGetRelaxSol with an array that wasn't big enough, needed length %d, given %d!\n", SCIPgetNVars(scip), *sollength);
1096 *sollength = SCIPgetNVars(scip);
1107 assert( relax != NULL );
1108 assert( SCIPrelaxGetData(relax) != NULL );
1110 return SCIPrelaxGetData(relax)->lastsdpnode;
1118 SCIP_RELAXDATA* relaxdata;
1120 assert( relax != NULL );
1122 relaxdata = SCIPrelaxGetData(relax);
1124 assert( relaxdata != NULL );
1125 assert( relaxdata->sdpi != NULL );
1135 assert( relax != NULL );
1136 assert( SCIPrelaxGetData(relax) != NULL );
1138 return SCIPrelaxGetData(relax)->sdpiterations;
1146 assert( relax != NULL );
1147 assert( SCIPrelaxGetData(relax) != NULL );
1149 return ( SCIPrelaxGetData(relax)->sdpcalls );
SCIP_RETCODE SCIPsdpiFree(SCIP_SDPI **sdpi)
SCIP_Bool SCIPsdpiIsDualUnbounded(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiDelLPRows(SCIP_SDPI *sdpi, int firstrow, int lastrow)
static SCIP_DECL_RELAXCOPY(relaxCopySdp)
SCIP_RETCODE SCIPsdpVarmapperAddVars(SCIP *scip, SdpVarmapper *varmapper, int nvars, SCIP_VAR **vars)
static SCIP_Bool allVarsFixed(SCIP *scip)
static SCIP_DECL_RELAXEXIT(relaxExitSdp)
#define DEFAULT_SDPSOLVERFEASTOL
const char * SCIPsdpiGetSolverName(void)
SCIP_RETCODE SCIPsdpiGetSol(SCIP_SDPI *sdpi, SCIP_Real *objval, SCIP_Real *dualsol, int *dualsollength)
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)
static SCIP_DECL_RELAXEXEC(relaxExecSdp)
SCIP_VAR * SCIPsdpVarmapperGetSCIPvar(SdpVarmapper *varmapper, int ind)
SCIP_Bool SCIPsdpiIsAcceptable(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpVarmapperCreate(SCIP *scip, SdpVarmapper **varmapper, int size)
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
int SCIPsdpVarmapperGetSdpIndex(SdpVarmapper *varmapper, SCIP_VAR *var)
static SCIP_RETCODE putLpDataInInterface(SCIP *scip, SCIP_SDPI *sdpi, SdpVarmapper *varmapper)
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_Bool SCIPsdpiIsObjlimExc(SCIP_SDPI *sdpi)
class that maps SCIP variables to SDP indices (the SCIP variables are given SDP indices in the order ...
SCIP_RETCODE SCIPsdpiCreate(SCIP_SDPI **sdpi, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem)
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 SCIPsdpiSetIntpar(SCIP_SDPI *sdpi, SCIP_SDPPARAM type, int ival)
SCIP_Real SCIPsdpiInfinity(SCIP_SDPI *sdpi)
long int SCIPrelaxSdpGetSdpNode(SCIP_RELAX *relax)
SCIP_Bool SCIPrelaxSdpSolvedOrig(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiSolve(SCIP_SDPI *sdpi, SCIP_Real *start, int *totalsdpiterations, SCIP_Bool enforceslatercheck)
static SCIP_RETCODE calc_relax(SCIP *scip, SCIP_RELAXDATA *relaxdata, SCIP_RESULT *result, SCIP_Real *lowerbound)
static SCIP_RETCODE putSdpDataInInterface(SCIP *scip, SCIP_SDPI *sdpi, SdpVarmapper *varmapper)
SCIP_Bool SCIPsdpiWasSolved(SCIP_SDPI *sdpi)
int SCIPrelaxSdpGetNIterations(SCIP_RELAX *relax)
SCIP_RETCODE SCIPsdpiClear(SCIP_SDPI *sdpi)
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)
SCIP_Bool SCIPsdpiIsDualFeasible(SCIP_SDPI *sdpi)
struct SCIP_SDPi SCIP_SDPI
SCIP_Bool SCIPsdpiIsPrimalFeasible(SCIP_SDPI *sdpi)
SCIP_RETCODE SCIPsdpiSetRealpar(SCIP_SDPI *sdpi, SCIP_SDPPARAM type, SCIP_Real dval)
SCIP_RETCODE SCIPconsSdpGetNNonz(SCIP *scip, SCIP_CONS *cons, int *nnonz, int *constnnonz)
static SCIP_DECL_RELAXINIT(relaxInitSolSdp)
SCIP_RETCODE SCIPsdpiGetNLPRows(SCIP_SDPI *sdpi, int *nlprows)
SCIP_RETCODE SCIPsdpiGetPrimalBoundVars(SCIP_SDPI *sdpi, SCIP_Real *lbvars, SCIP_Real *ubvars, int *arraylength)
SCIP_Bool SCIPsdpiSolvedOrig(SCIP_SDPI *sdpi)
#define DEFAULT_SDPSOLVEREPSILON
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)