|
Go to the documentation of this file.
24 #define MSKCONST const
28 #include "scip/bitencode.h"
32 #if defined(_WIN32) || defined(_WIN64)
33 #define snprintf _snprintf
36 #define scipmskobjsen MSKobjsensee
37 #define SENSE2MOSEK(objsen) (((objsen)==SCIP_OBJSEN_MINIMIZE)?(MSK_OBJECTIVE_SENSE_MINIMIZE):(MSK_OBJECTIVE_SENSE_MAXIMIZE))
39 #define MOSEK_CALL(x) do \
41 MSKrescodee _restat_; \
43 if( (_restat_) != MSK_RES_OK && (_restat_ ) != MSK_RES_TRM_MAX_NUM_SETBACKS ) \
45 SCIPerrorMessage("LP Error: MOSEK returned %d\n", (int)_restat_); \
46 return SCIP_LPERROR; \
52 #define ABORT_FALSE(x) { int _restat_; \
53 if( (_restat_ = (x)) != 0 ) \
55 SCIPerrorMessage("LP Error: MOSEK returned %d\n", (int)_restat_); \
62 #define IS_POSINF(x) ((x) >= SCIP_DEFAULT_INFINITY)
63 #define IS_NEGINF(x) ((x) <= -SCIP_DEFAULT_INFINITY)
65 static MSKenv_t MosekEnv = NULL;
68 static int optimizecount = 0;
69 static int nextlpid = 1;
70 static int numstrongbranchmaxiterup = 0;
71 static int numstrongbranchmaxiterdo = 0;
72 static int numprimalmaxiter = 0;
73 static int numdualmaxiter = 0;
74 static int numstrongbranchobjup = 0;
75 static int numstrongbranchobjdo = 0;
76 static int numprimalobj = 0;
77 static int numdualobj = 0;
79 #define DEBUG_PARAM_SETTING 0
80 #define DEBUG_PRINT_STAT 0
81 #define DEBUG_CHECK_DATA 0
82 #define DEBUG_EASY_REPRODUCE 0
83 #define DEBUG_DO_INTPNT_FEAS_CHECK 0
84 #define DEBUG_CHECK_STATE_TOL 1e-5
86 #define ASSERT_ON_NUMERICAL_TROUBLES 0
87 #define ASSERT_ON_WARNING 0
88 #define FORCE_MOSEK_LOG 0
89 #define FORCE_MOSEK_SUMMARY 0
90 #define FORCE_NO_MAXITER 0
91 #define FORCE_SILENCE 1
92 #define SETBACK_LIMIT 250
93 #define SCIP_CONTROLS_PRICING 1
94 #define SCIP_CONTROLS_TOLERANCES 1
95 #define STRONGBRANCH_PRICING MSK_SIM_SELECTION_SE
96 #define SUPRESS_NAME_ERROR 1
98 #define WRITE_PRIMAL 0
99 #define WRITE_INTPNT 0
100 #define WRITE_ABOVE 0
101 #define DEGEN_LEVEL MSK_SIM_DEGEN_FREE
102 #define ALWAYS_SOLVE_PRIMAL 1
104 #if MSK_VERSION_MAJOR >= 7
111 MSKrescodee MSK_getsolutionstatus(
113 MSKsoltypee whichsol,
120 MOSEK_CALL( MSK_getprosta(task, whichsol, prosta) );
124 MOSEK_CALL( MSK_getsolsta(task, whichsol, solsta) );
136 MSKrescodee termcode;
148 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
150 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
182 void MSKAPI printstr(
187 #if SUPRESS_NAME_ERROR && !FORCE_SILENCE
189 snprintf(errstr,32, "MOSEK Error %d",MSK_RES_ERR_DUP_NAME);
190 if (0 == strncmp(errstr,str,strlen(errstr)))
197 #if DEBUG_CHECK_DATA > 0
201 const char* functionname
217 MOSEK_CALL( MSK_solutiondef(lpi->task, MSK_SOL_BAS, &gotbasicsol) );
219 MOSEK_CALL( MSK_getnumvar(lpi->task,&numvar) );
220 MOSEK_CALL( MSK_getnumcon(lpi->task,&numcon) );
223 SCIP_ALLOC( BMSallocMemoryArray( &tbkc, numcon) );
224 SCIP_ALLOC( BMSallocMemoryArray( &tskc, numcon) );
225 SCIP_ALLOC( BMSallocMemoryArray( &tblc, numcon) );
226 SCIP_ALLOC( BMSallocMemoryArray( &tbuc, numcon) );
228 SCIP_ALLOC( BMSallocMemoryArray( &tbkx, numvar) );
229 SCIP_ALLOC( BMSallocMemoryArray( &tskx, numvar) );
230 SCIP_ALLOC( BMSallocMemoryArray( &tblx, numvar) );
231 SCIP_ALLOC( BMSallocMemoryArray( &tbux, numvar) );
240 for( i = 0; i < numvar; i++ )
242 MOSEK_CALL( MSK_getbound(lpi->task,MSK_ACC_VAR,i,&tbkx[i],&tblx[i],&tbux[i]) );
245 for( i = 0; i < numcon; i++ )
247 MOSEK_CALL( MSK_getbound(lpi->task,MSK_ACC_CON,i,&tbkc[i],&tblc[i],&tbuc[i]) );
250 for( i = 0; i < numcon; ++i )
254 if( ( tskc[i] == MSK_SK_FIX && tbkc[i] != MSK_BK_FX ) ||
255 ( tskc[i] == MSK_SK_LOW && !(tbkc[i] == MSK_BK_FX || tbkc[i] == MSK_BK_LO || tbkc[i] == MSK_BK_RA ) ) ||
256 ( tskc[i] == MSK_SK_UPR && !(tbkc[i] == MSK_BK_FX || tbkc[i] == MSK_BK_UP || tbkc[i] == MSK_BK_RA ) ) )
258 SCIPerrorMessage( "STATUS KEY ERROR i %d bkc %d skc %d %s\n", i, tbkc[i], tskc[i], functionname);
262 if( tbkc[i] == MSK_BK_LO || tbkc[i] == MSK_BK_FX || tbkc[i] == MSK_BK_RA )
270 if( tbkc[i] == MSK_BK_UP || tbkc[i] == MSK_BK_FX || tbkc[i] == MSK_BK_RA )
279 for( i = 0; i < numvar; ++i )
281 if( tbkx[i] == MSK_BK_LO || tbkx[i] == MSK_BK_FX || tbkx[i] == MSK_BK_RA )
289 if( tbkx[i] == MSK_BK_UP || tbkx[i] == MSK_BK_FX || tbkx[i] == MSK_BK_RA )
299 BMSfreeMemoryArray(&tbkc);
300 BMSfreeMemoryArray(&tskc);
301 BMSfreeMemoryArray(&tblc);
302 BMSfreeMemoryArray(&tbuc);
303 BMSfreeMemoryArray(&tbkx);
304 BMSfreeMemoryArray(&tskx);
305 BMSfreeMemoryArray(&tblx);
306 BMSfreeMemoryArray(&tbux);
318 void generateMskBounds(
332 assert(msklb != NULL);
333 assert(mskub != NULL);
335 for( i = 0; i < n; i++ )
341 msklb[i] = -MSK_INFINITY;
344 mskub[i] = MSK_INFINITY;
358 mskub[i] = MSK_INFINITY;
361 else if (lb[i] == ub[i])
363 assert(lb[i]-ub[i]==0);
364 assert(ub[i]-lb[i]==0);
369 assert(lb[i] < ub[i]);
387 assert(beg != NULL || nnonz == 0);
398 for(i = 0; i < n-1; i++)
400 (*aptre)[i] = beg[i+1];
401 assert((*aptre)[i] >= beg[i]);
404 (*aptre)[n-1] = nnonz;
405 assert((*aptre)[n-1] >= beg[n-1]);
409 for( i = 0; i < n; i++ )
426 assert(first <= last);
428 SCIP_ALLOC( BMSallocMemoryArray( sub, (last-first+1)) );
430 for( i = first; i <= last; i++ )
450 assert(dstat != NULL);
453 for( i = 0; i < n; i++ )
463 SCIP_ALLOC( BMSallocMemoryArray( sub, (*count)) );
469 for( i = 0; i < n; i++ )
488 for( i = 0; i < len; i++ )
506 if (s < 0) *bk = MSK_BK_UP;
510 if (s < 0) *bk = MSK_BK_LO;
540 if (lpi->skxsize < ncols)
543 newsize = MAX(2*lpi->skxsize, ncols);
545 SCIP_ALLOC( BMSreallocMemoryArray( &(lpi->skx), newsize) );
546 lpi->skxsize = newsize;
549 if (lpi->skcsize < nrows)
552 newsize = MAX(2*lpi->skcsize, nrows);
554 SCIP_ALLOC( BMSreallocMemoryArray( &(lpi->skc), newsize) );
555 lpi->skcsize = newsize;
570 SCIP_CALL( ensureStateMem(lpi,ncols,nrows) );
596 static char mskname[100];
606 sprintf(mskname, "MOSEK %.2f", ( SCIP_Real)MSK_VERSION_MAJOR);
615 return "Linear Programming Solver developed by MOSEK Optimization Software (www.mosek.com)";
623 return ( void*) lpi->task;
649 #if MSK_VERSION_MAJOR < 7
654 MOSEK_CALL( MSK_linkfunctoenvstream(MosekEnv, MSK_STREAM_LOG, NULL, printstr) );
662 MOSEK_CALL( MSK_makeemptytask(MosekEnv, &((*lpi)->task)) );
664 MOSEK_CALL( MSK_linkfunctotaskstream((*lpi)->task, MSK_STREAM_LOG, NULL, printstr) );
668 MOSEK_CALL( MSK_putintparam((*lpi)->task, MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_FREE_SIMPLEX) );
670 MOSEK_CALL( MSK_putintparam((*lpi)->task, MSK_IPAR_SIM_SWITCH_OPTIMIZER, MSK_ON) );
672 MOSEK_CALL( MSK_putintparam((*lpi)->task, MSK_IPAR_SIM_HOTSTART, MSK_SIM_HOTSTART_STATUS_KEYS) );
673 MOSEK_CALL( MSK_puttaskname((*lpi)->task, ( char*) name) );
675 (*lpi)->termcode = MSK_RES_OK;
676 (*lpi)->itercount = 0;
678 (*lpi)->lpid = nextlpid++;
683 (*lpi)->messagehdlr = messagehdlr;
694 assert(*lpi != NULL);
701 BMSfreeMemoryArrayNull(&(*lpi)->skx);
702 BMSfreeMemoryArrayNull(&(*lpi)->skc);
749 assert(MosekEnv != NULL);
751 assert(lpi->task != NULL);
762 #if DEBUG_CHECK_DATA > 0
763 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiLoadColLP") );
768 SCIP_ALLOC( BMSallocMemoryArray( &bkc, nrows) );
769 SCIP_ALLOC( BMSallocMemoryArray( &blc, nrows) );
770 SCIP_ALLOC( BMSallocMemoryArray( &buc, nrows) );
772 generateMskBounds(nrows, lhs, rhs, bkc, blc, buc);
777 SCIP_ALLOC( BMSallocMemoryArray( &bkx, ncols) );
778 SCIP_ALLOC( BMSallocMemoryArray( &blx, ncols) );
779 SCIP_ALLOC( BMSallocMemoryArray( &bux, ncols) );
781 generateMskBounds(ncols, lb, ub, bkx, blx, bux);
783 SCIP_CALL( getEndptrs(ncols, beg, nnonz, &aptre) );
786 MOSEK_CALL( MSK_inputdata(lpi->task, nrows, ncols, nrows, ncols, obj, 0.0, beg, aptre, ind, val,
787 bkc, blc, buc, bkx, blx, bux) );
794 BMSfreeMemoryArray(&aptre);
795 BMSfreeMemoryArray(&bux);
796 BMSfreeMemoryArray(&blx);
797 BMSfreeMemoryArray(&bkx);
802 BMSfreeMemoryArray(&buc);
803 BMSfreeMemoryArray(&blc);
804 BMSfreeMemoryArray(&bkc);
807 #if DEBUG_CHECK_DATA > 0
808 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiLoadColLP") );
828 #if MSK_VERSION_MAJOR < 7
837 assert(MosekEnv != NULL);
839 assert(lpi->task != NULL);
843 #if DEBUG_CHECK_DATA > 0
844 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiAddCols") );
850 SCIP_ALLOC( BMSallocMemoryArray(&bkx, ncols) );
851 SCIP_ALLOC( BMSallocMemoryArray(&blx, ncols) );
852 SCIP_ALLOC( BMSallocMemoryArray(&bux, ncols) );
853 generateMskBounds(ncols, lb, ub, bkx, blx, bux);
855 MOSEK_CALL( MSK_getnumvar(lpi->task, &oldcols) );
857 #if MSK_VERSION_MAJOR < 7
858 SCIP_CALL( getEndptrs(ncols, beg, nnonz, &aptre) );
865 MOSEK_CALL( MSK_appendvars(lpi->task, ncols, obj, aptrb, aptre, ind, val, bkx, blx, bux) );
867 BMSfreeMemoryArray(&aptre);
870 MOSEK_CALL( MSK_appendvars(lpi->task, ncols) );
871 MOSEK_CALL( MSK_putcslice(lpi->task, oldcols, oldcols+ncols, obj) );
872 MOSEK_CALL( MSK_putvarboundslice(lpi->task, oldcols, oldcols+ncols, bkx, blx, bux) );
876 SCIP_CALL( getEndptrs(ncols, beg, nnonz, &aptre) );
877 MOSEK_CALL( MSK_putacolslice(lpi->task, oldcols, oldcols+ncols, beg, aptre, ind, val) );
878 BMSfreeMemoryArray(&aptre);
882 BMSfreeMemoryArray(&bux);
883 BMSfreeMemoryArray(&blx);
884 BMSfreeMemoryArray(&bkx);
886 #if DEBUG_CHECK_DATA > 0
887 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiAddCols") );
902 assert(MosekEnv != NULL);
904 assert(lpi->task != NULL);
908 #if DEBUG_CHECK_DATA > 0
909 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelCols") );
912 SCIP_CALL( getIndicesRange(firstcol, lastcol, &sub) );
915 #if MSK_VERSION_MAJOR < 7
916 MOSEK_CALL( MSK_remove(lpi->task,MSK_ACC_VAR, lastcol-firstcol+1, sub) );
918 MOSEK_CALL( MSK_removevars(lpi->task, lastcol-firstcol+1, sub) );
921 BMSfreeMemoryArray(&sub);
923 #if DEBUG_CHECK_DATA > 0
924 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelCols") );
944 assert(MosekEnv != NULL);
946 assert(lpi->task != NULL);
950 #if DEBUG_CHECK_DATA > 0
951 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelColset") );
954 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
957 SCIP_CALL( getIndicesFromDense(dstat, ncols, &count, &sub) );
960 for( i = 0; i < ncols; i++)
976 #if MSK_VERSION_MAJOR < 7
977 MOSEK_CALL( MSK_remove(lpi->task, MSK_ACC_VAR, count, sub) );
979 MOSEK_CALL( MSK_removevars(lpi->task, count, sub) );
981 BMSfreeMemoryArray(&sub);
984 #if DEBUG_CHECK_DATA > 0
985 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelColset") );
1004 #if MSK_VERSION_MAJOR < 7
1013 assert(MosekEnv != NULL);
1014 assert(lpi != NULL);
1015 assert(lpi->task != NULL);
1019 #if DEBUG_CHECK_DATA > 0
1020 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiAddRows") );
1026 SCIP_ALLOC( BMSallocMemoryArray(&bkc, nrows) );
1027 SCIP_ALLOC( BMSallocMemoryArray(&blc, nrows) );
1028 SCIP_ALLOC( BMSallocMemoryArray(&buc, nrows) );
1030 generateMskBounds(nrows, lhs, rhs, bkc, blc, buc);
1032 MOSEK_CALL( MSK_getnumcon(lpi->task, &oldrows) );
1034 #if MSK_VERSION_MAJOR < 7
1035 SCIP_CALL( getEndptrs(nrows, beg, nnonz, &aptre) );
1042 MOSEK_CALL( MSK_appendcons(lpi->task, nrows, aptrb, aptre, ind, val, bkc, blc, buc) );
1044 BMSfreeMemoryArray(&aptre);
1047 MOSEK_CALL( MSK_appendcons(lpi->task, nrows) );
1048 MOSEK_CALL( MSK_putconboundslice(lpi->task, oldrows, oldrows+nrows, bkc, blc, buc) );
1052 SCIP_CALL( getEndptrs(nrows, beg, nnonz, &aptre) );
1053 MOSEK_CALL( MSK_putarowslice(lpi->task, oldrows, oldrows+nrows, beg, aptre, ind, val) );
1054 BMSfreeMemoryArray(&aptre);
1058 BMSfreeMemoryArray(&buc);
1059 BMSfreeMemoryArray(&blc);
1060 BMSfreeMemoryArray(&bkc);
1062 #if DEBUG_CHECK_DATA > 0
1063 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiAddRows") );
1078 assert(MosekEnv != NULL);
1079 assert(lpi != NULL);
1080 assert(lpi->task != NULL);
1084 #if DEBUG_CHECK_DATA > 0
1085 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelRows") );
1088 SCIP_CALL( getIndicesRange(firstrow, lastrow, &sub) );
1092 #if MSK_VERSION_MAJOR < 7
1093 MOSEK_CALL( MSK_remove(lpi->task, MSK_ACC_CON, lastrow-firstrow+1, sub) );
1095 MOSEK_CALL( MSK_removecons(lpi->task, lastrow-firstrow+1, sub) );
1098 BMSfreeMemoryArray(&sub);
1100 #if DEBUG_CHECK_DATA > 0
1101 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelRows") );
1121 assert(MosekEnv != NULL);
1122 assert(lpi != NULL);
1123 assert(lpi->task != NULL);
1127 #if DEBUG_CHECK_DATA > 0
1128 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelRowset") );
1131 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
1134 SCIP_CALL( getIndicesFromDense(dstat, nrows, &count, &sub) );
1137 for( i = 0; i < nrows; i++ )
1153 #if MSK_VERSION_MAJOR < 7
1154 MOSEK_CALL( MSK_remove(lpi->task, MSK_ACC_CON, count, sub) );
1156 MOSEK_CALL( MSK_removecons(lpi->task, count, sub) );
1158 BMSfreeMemoryArray(&sub);
1161 #if DEBUG_CHECK_DATA > 0
1162 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiDelRowset end") );
1176 assert(MosekEnv != NULL);
1177 assert(lpi != NULL);
1178 assert(lpi->task != NULL);
1182 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
1183 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
1204 assert(MosekEnv != NULL);
1205 assert(lpi != NULL);
1206 assert(lpi->task != NULL);
1210 #if DEBUG_CHECK_DATA > 0
1211 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgBounds") );
1217 SCIP_ALLOC( BMSallocMemoryArray(&bkx, ncols) );
1218 SCIP_ALLOC( BMSallocMemoryArray(&blx, ncols) );
1219 SCIP_ALLOC( BMSallocMemoryArray(&bux, ncols) );
1221 generateMskBounds(ncols, lb, ub, bkx, blx, bux);
1222 MOSEK_CALL( MSK_putboundlist(lpi->task, MSK_ACC_VAR, ncols, ind, bkx, blx, bux) );
1224 BMSfreeMemoryArray(&bux);
1225 BMSfreeMemoryArray(&blx);
1226 BMSfreeMemoryArray(&bkx);
1228 #if DEBUG_CHECK_DATA > 0
1229 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgBounds") );
1248 assert(MosekEnv != NULL);
1249 assert(lpi != NULL);
1250 assert(lpi->task != NULL);
1254 #if DEBUG_CHECK_DATA > 0
1255 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgSides") );
1261 SCIP_ALLOC( BMSallocMemoryArray(&bkc, nrows) );
1262 SCIP_ALLOC( BMSallocMemoryArray(&blc, nrows) );
1263 SCIP_ALLOC( BMSallocMemoryArray(&buc, nrows) );
1265 generateMskBounds(nrows, lhs, rhs, bkc, blc, buc);
1266 MOSEK_CALL( MSK_putboundlist(lpi->task, MSK_ACC_CON, nrows, ind, bkc, blc, buc) );
1268 BMSfreeMemoryArray(&buc);
1269 BMSfreeMemoryArray(&blc);
1270 BMSfreeMemoryArray(&bkc);
1272 #if DEBUG_CHECK_DATA > 0
1273 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgSides") );
1287 assert(MosekEnv != NULL);
1288 assert(lpi != NULL);
1289 assert(lpi->task != NULL);
1293 #if DEBUG_CHECK_DATA > 0
1294 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgCoef") );
1297 MOSEK_CALL( MSK_putaij(lpi->task, row, col, newval) );
1299 #if DEBUG_CHECK_DATA > 0
1300 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgCoef") );
1312 assert(MosekEnv != NULL);
1313 assert(lpi != NULL);
1314 assert(lpi->task != NULL);
1331 assert(MosekEnv != NULL);
1332 assert(lpi != NULL);
1333 assert(lpi->task != NULL);
1337 #if DEBUG_CHECK_DATA > 0
1338 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgObj") );
1341 MOSEK_CALL( MSK_putclist(lpi->task, ncols, ind, obj) );
1343 #if DEBUG_CHECK_DATA > 0
1344 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiChgObj") );
1364 assert(MosekEnv != NULL);
1365 assert(lpi != NULL);
1366 assert(lpi->task != NULL);
1370 #if DEBUG_CHECK_DATA > 0
1371 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiScaleRow") );
1374 assert(scaleval != 0);
1376 #if MSK_VERSION_MAJOR < 7
1377 MOSEK_CALL( MSK_getavecnumnz(lpi->task, MSK_ACC_CON, row, &nnonz) );
1379 MOSEK_CALL( MSK_getarownumnz(lpi->task, row, &nnonz) );
1384 SCIP_ALLOC( BMSallocMemoryArray(&sub, nnonz) );
1385 SCIP_ALLOC( BMSallocMemoryArray(&val, nnonz) );
1387 #if MSK_VERSION_MAJOR < 7
1388 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_CON, row, &nnonz, sub, val) );
1389 scale_vec(nnonz, val, scaleval);
1390 MOSEK_CALL( MSK_putavec(lpi->task, MSK_ACC_CON, row, nnonz, sub, val) );
1392 MOSEK_CALL( MSK_getarow(lpi->task, row, &nnonz, sub, val) );
1393 scale_vec(nnonz, val, scaleval);
1394 MOSEK_CALL( MSK_putarow(lpi->task, row, nnonz, sub, val) );
1397 BMSfreeMemoryArray(&val);
1398 BMSfreeMemoryArray(&sub);
1401 MOSEK_CALL( MSK_getbound(lpi->task, MSK_ACC_CON, row, &bkc, &blc, &buc) );
1402 scale_bound(&bkc, &blc, &buc, scaleval);
1403 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_CON, row, bkc, blc, buc) );
1405 #if DEBUG_CHECK_DATA > 0
1406 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiScaleRow") );
1427 assert(MosekEnv != NULL);
1428 assert(lpi != NULL);
1429 assert(lpi->task != NULL);
1433 #if DEBUG_CHECK_DATA > 0
1434 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiScaleCol") );
1437 assert(scaleval != 0);
1438 #if MSK_VERSION_MAJOR < 7
1439 MOSEK_CALL( MSK_getavecnumnz(lpi->task, MSK_ACC_VAR, col, &nnonz) );
1441 MOSEK_CALL( MSK_getacolnumnz(lpi->task, col, &nnonz) );
1446 SCIP_ALLOC( BMSallocMemoryArray(&sub, nnonz) );
1447 SCIP_ALLOC( BMSallocMemoryArray(&val, nnonz) );
1449 #if MSK_VERSION_MAJOR < 7
1450 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_VAR, col, &nnonz, sub, val) );
1451 scale_vec(nnonz, val, scaleval);
1452 MOSEK_CALL( MSK_putavec(lpi->task, MSK_ACC_VAR, col, nnonz, sub, val) );
1454 MOSEK_CALL( MSK_getacol(lpi->task, col, &nnonz, sub, val) );
1455 scale_vec(nnonz, val, scaleval);
1456 MOSEK_CALL( MSK_putacol(lpi->task, col, nnonz, sub, val) );
1459 BMSfreeMemoryArray(&val);
1460 BMSfreeMemoryArray(&sub);
1463 MOSEK_CALL( MSK_getbound(lpi->task, MSK_ACC_VAR, col, &bkx, &blx, &bux) );
1464 scale_bound(&bkx, &blx, &bux, 1.0/scaleval);
1465 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_VAR, col, bkx, blx, bux) );
1467 MOSEK_CALL( MSK_getcslice(lpi->task, col, col+1, &c) );
1468 MOSEK_CALL( MSK_putcj(lpi->task, col, c*scaleval) );
1470 #if DEBUG_CHECK_DATA > 0
1471 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiScaleCol") );
1489 assert(MosekEnv != NULL);
1490 assert(lpi != NULL);
1491 assert(lpi->task != NULL);
1495 MOSEK_CALL( MSK_getnumcon(lpi->task, nrows) );
1506 assert(MosekEnv != NULL);
1507 assert(lpi != NULL);
1508 assert(lpi->task != NULL);
1512 MOSEK_CALL( MSK_getnumvar(lpi->task, ncols) );
1523 assert(MosekEnv != NULL);
1524 assert(lpi != NULL);
1525 assert(lpi->task != NULL);
1529 MOSEK_CALL( MSK_getnumanz(lpi->task, nnonz) );
1548 assert(MosekEnv != NULL);
1549 assert(lpi != NULL);
1550 assert(lpi->task != NULL);
1551 assert(first <= last);
1555 #if DEBUG_CHECK_DATA > 0
1556 SCIP_CALL( scip_checkdata(lpi, "getASlice") );
1563 assert(beg != NULL);
1564 assert(ind != NULL);
1565 assert(val != NULL);
1567 SCIP_ALLOC( BMSallocMemoryArray(&aptre, last - first + 1) );
1569 MOSEK_CALL( MSK_getaslicenumnz(lpi->task, iscon, first, last+1,nnonz) );
1571 MOSEK_CALL( MSK_getaslice(lpi->task, iscon, first, last+1, *nnonz, &surplus, beg, aptre, ind, val) );
1573 assert(surplus == 0);
1575 BMSfreeMemoryArray(&aptre);
1578 #if DEBUG_CHECK_DATA > 0
1579 SCIP_CALL( scip_checkdata(lpi, "getASlice") );
1601 assert(MosekEnv != NULL);
1602 assert(lpi != NULL);
1603 assert(lpi->task != NULL);
1608 SCIP_CALL( getASlice(lpi, MSK_ACC_VAR, firstcol, lastcol, nnonz, beg, ind, val) );
1629 assert(MosekEnv != NULL);
1630 assert(lpi != NULL);
1631 assert(lpi->task != NULL);
1635 #if DEBUG_CHECK_DATA > 0
1636 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetRows") );
1641 SCIP_CALL( getASlice(lpi, MSK_ACC_CON, firstrow, lastrow, nnonz, beg, ind, val) );
1643 #if DEBUG_CHECK_DATA > 0
1644 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetRows") );
1657 int namestoragesize,
1672 int namestoragesize,
1698 assert(MosekEnv != NULL);
1699 assert(lpi != NULL);
1700 assert(lpi->task != NULL);
1704 MOSEK_CALL( MSK_getcslice(lpi->task, firstcol, lastcol+1, vals) );
1718 assert(MosekEnv != NULL);
1719 assert(lpi != NULL);
1720 assert(lpi->task != NULL);
1724 #if DEBUG_CHECK_DATA > 0
1725 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetBounds") );
1728 MOSEK_CALL( MSK_getboundslice(lpi->task, MSK_ACC_VAR, firstcol, lastcol+1, NULL, lbs, ubs) );
1742 assert(MosekEnv != NULL);
1743 assert(lpi != NULL);
1744 assert(lpi->task != NULL);
1748 #if DEBUG_CHECK_DATA > 0
1749 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetSides") );
1752 MOSEK_CALL( MSK_getboundslice(lpi->task, MSK_ACC_CON, firstrow, lastrow+1, NULL, lhss, rhss) );
1754 #if DEBUG_CHECK_DATA > 0
1755 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetSides") );
1769 assert(MosekEnv != NULL);
1770 assert(lpi != NULL);
1771 assert(lpi->task != NULL);
1775 #if DEBUG_CHECK_DATA > 0
1776 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetCoef") );
1779 MOSEK_CALL( MSK_getaij(lpi->task, row, col, val) );
1781 #if DEBUG_CHECK_DATA > 0
1782 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiGetCoef") );
1801 assert(lpi != NULL);
1802 assert(lpi->task != NULL);
1804 MOSEK_CALL( MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, prosta, solsta) );
1811 MSKrescodee filterTRMrescode(
1813 MSKrescodee* termcode,
1817 if ( res == MSK_RES_TRM_MAX_ITERATIONS || res == MSK_RES_TRM_MAX_TIME
1818 || res == MSK_RES_TRM_OBJECTIVE_RANGE || res == MSK_RES_TRM_STALL
1820 || res == MSK_RES_TRM_MAX_NUM_SETBACKS
1821 || res == MSK_RES_TRM_NUMERICAL_PROBLEM
1826 if (res == MSK_RES_TRM_MAX_NUM_SETBACKS || res == MSK_RES_TRM_NUMERICAL_PROBLEM)
1830 #if ASSERT_ON_WARNING
1839 *termcode = MSK_RES_OK;
1849 int itercount_primal;
1858 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, &presolve) );
1859 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, &maxiter) );
1861 #if DEBUG_EASY_REPRODUCE
1862 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_AUTO_SORT_A_BEFORE_OPT, MSK_ON) );
1863 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_OFF) );
1865 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
1868 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_AUTO_UPDATE_SOL_INFO, MSK_OFF) );
1874 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_ON) );
1875 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG_SIM_FREQ, 1) );
1879 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_OFF) );
1883 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_OFF) );
1887 MOSEK_CALL( MSK_solutiondef(lpi->task, MSK_SOL_BAS, &gotbasicsol) );
1891 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, MSK_PRESOLVE_MODE_OFF) );
1895 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, MSK_PRESOLVE_MODE_ON) );
1898 #if ALWAYS_SOLVE_PRIMAL > 0
1899 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_SOLVE_FORM, MSK_SOLVE_PRIMAL) );
1902 #if DEBUG_CHECK_DATA > 0
1903 SCIP_CALL( scip_checkdata(lpi, "SolveWSimplex") );
1906 assert(MosekEnv != NULL);
1907 assert(lpi != NULL);
1908 assert(lpi->task != NULL);
1910 if( gotbasicsol && maxiter < 20000 )
1913 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION, 0) );
1918 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, 2000000000) );
1922 #if DEBUG_CHECK_DATA > 0
1923 SCIP_CALL( scip_checkdata(lpi, "Begin optimize with simplex") );
1926 #if FORCE_MOSEK_SUMMARY > 1
1929 MOSEK_CALL( MSK_solutionsummary(lpi->task,MSK_STREAM_LOG) );
1934 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, 100) );
1935 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG_SIM_FREQ, 100) );
1936 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG_SIM, 100) );
1939 MOSEK_CALL( filterTRMrescode(lpi->messagehdlr, &lpi->termcode, MSK_optimize(lpi->task)) );
1941 if( lpi->termcode == MSK_RES_TRM_MAX_NUM_SETBACKS )
1943 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_SCALING, MSK_SCALING_AGGRESSIVE) );
1945 MOSEK_CALL( filterTRMrescode(lpi->messagehdlr, &lpi->termcode, MSK_optimize(lpi->task)) );
1948 #if FORCE_MOSEK_SUMMARY
1951 MOSEK_CALL( MSK_solutionsummary(lpi->task,MSK_STREAM_LOG) );
1955 #if DEBUG_CHECK_DATA > 0
1956 SCIP_CALL( scip_checkdata(lpi, "End optimize with simplex") );
1959 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, presolve) );
1960 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, maxiter) );
1962 MOSEK_CALL( MSK_getintinf(lpi->task, MSK_IINF_SIM_PRIMAL_ITER, &itercount_primal) );
1963 MOSEK_CALL( MSK_getintinf(lpi->task, MSK_IINF_SIM_DUAL_ITER, &itercount_dual) );
1965 lpi->itercount = itercount_primal + itercount_dual;
1967 MOSEK_CALL( MSK_getprimalobj(lpi->task, MSK_SOL_BAS, &pobj) );
1968 MOSEK_CALL( MSK_getdualobj(lpi->task, MSK_SOL_BAS, &dobj) );
1969 MOSEK_CALL( MSK_getsolutionstatus(lpi->task, MSK_SOL_BAS, &prosta, &solsta) );
1971 #if DEBUG_PRINT_STAT
1972 SCIPdebugMessage( "maxiter = %d, termcode = %d, prosta = %d, solsta = %d, objval = %g : %g, iter = %d+%d\n",
1973 maxiter, lpi->termcode, prosta, solsta, pobj, dobj, itercount_primal, itercount_dual);
1977 "objval = %g : %g, iter = %d+%d\n",
1978 maxiter,lpi->termcode,prosta,solsta,
1979 pobj,dobj,itercount_primal,itercount_dual);
1984 case MSK_SOL_STA_OPTIMAL:
1985 case MSK_SOL_STA_PRIM_AND_DUAL_FEAS:
1986 case MSK_SOL_STA_PRIM_FEAS:
1987 case MSK_SOL_STA_DUAL_FEAS:
1988 case MSK_SOL_STA_PRIM_INFEAS_CER:
1989 case MSK_SOL_STA_DUAL_INFEAS_CER:
1990 case MSK_SOL_STA_UNKNOWN:
1992 case MSK_SOL_STA_NEAR_OPTIMAL:
1993 case MSK_SOL_STA_NEAR_PRIM_FEAS:
1994 case MSK_SOL_STA_NEAR_DUAL_FEAS:
1995 case MSK_SOL_STA_NEAR_PRIM_AND_DUAL_FEAS:
1996 case MSK_SOL_STA_NEAR_PRIM_INFEAS_CER:
1997 case MSK_SOL_STA_NEAR_DUAL_INFEAS_CER:
2000 if (lpi->termcode == MSK_RES_OK)
2001 lpi->termcode = MSK_RES_TRM_NUMERICAL_PROBLEM;
2003 #if ASSERT_ON_WARNING
2007 case MSK_SOL_STA_INTEGER_OPTIMAL:
2008 case MSK_SOL_STA_NEAR_INTEGER_OPTIMAL:
2010 #if SHOW_ERRORS && !FORCE_SILENCE
2011 SCIPerrorMessage( "Simplex[%d] returned solsta = %d\n", optimizecount, solsta);
2014 #if ASSERT_ON_WARNING
2023 case MSK_PRO_STA_PRIM_AND_DUAL_FEAS:
2024 case MSK_PRO_STA_PRIM_FEAS:
2025 case MSK_PRO_STA_DUAL_FEAS:
2026 case MSK_PRO_STA_PRIM_AND_DUAL_INFEAS:
2027 case MSK_PRO_STA_PRIM_INFEAS:
2028 case MSK_PRO_STA_DUAL_INFEAS:
2029 case MSK_PRO_STA_UNKNOWN:
2031 case MSK_PRO_STA_NEAR_PRIM_AND_DUAL_FEAS:
2032 case MSK_PRO_STA_NEAR_PRIM_FEAS:
2033 case MSK_PRO_STA_NEAR_DUAL_FEAS:
2034 case MSK_PRO_STA_ILL_POSED:
2035 case MSK_PRO_STA_PRIM_INFEAS_OR_UNBOUNDED:
2038 if (lpi->termcode == MSK_RES_OK)
2039 lpi->termcode = MSK_RES_TRM_NUMERICAL_PROBLEM;
2041 #if ASSERT_ON_WARNING
2046 #if SHOW_ERRORS && !FORCE_SILENCE
2047 SCIPerrorMessage( "Simplex[%d] returned prosta = %d\n", optimizecount, prosta);
2050 #if ASSERT_ON_WARNING
2057 if( solsta == MSK_SOL_STA_OPTIMAL && fabs(dobj)+fabs(dobj) > 1.0e-6 && fabs(pobj-dobj)>0.0001*(fabs(pobj)+fabs(dobj)))
2059 SCIPerrorMessage( "Simplex[%d] returned optimal solution with different objvals %g != %g reldiff %.2g%%\n",
2060 optimizecount, pobj, dobj, 100*fabs(pobj-dobj)/ MAX(fabs(pobj),fabs(dobj)));
2063 if (lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE)
2065 if(solsta != MSK_SOL_STA_DUAL_FEAS && solsta != MSK_SOL_STA_OPTIMAL && solsta != MSK_SOL_STA_PRIM_AND_DUAL_FEAS)
2067 SCIPerrorMessage( "[%d] Terminated on objective range without dual feasible solsta.\n", optimizecount);
2076 MOSEK_CALL( MSK_getobjsense(lpi->task, &objsen) );
2078 if (objsen == MSK_OBJECTIVE_SENSE_MINIMIZE)
2080 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, &bound) );
2082 if (1.0e-6*(fabs(bound)+fabs(dobj)) < bound-dobj)
2085 optimizecount, dobj, bound);
2092 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, &bound) );
2094 if (1.0e-6*(fabs(bound)+fabs(dobj)) < dobj-bound)
2097 optimizecount, dobj, bound);
2105 if (maxiter >= 2000000000)
2107 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, maxiter) );
2109 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2111 SCIPmessagePrintWarning(lpi->messagehdlr, "Simplex[%d] failed to terminate in 10000 iterations, switching to interior point\n",
2118 #if DEBUG_DO_INTPNT_FEAS_CHECK
2119 if (solsta == MSK_SOL_STA_PRIM_INFEAS_CER || solsta == MSK_SOL_STA_DUAL_INFEAS_CER)
2125 MOSEK_CALL(MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, &prosta, &solsta));
2127 if (solsta == MSK_SOL_STA_PRIM_INFEAS_CER || solsta == MSK_SOL_STA_DUAL_INFEAS_CER)
2133 SCIPdebugPrintf( "wrong [%d] prosta = %d, solsta = %d\n",optimizecount,prosta,solsta);
2139 #if DEBUG_PRINT_STAT > 0
2140 SCIPdebugMessage( "Max iter stat : Count %d branchup = %d branchlo = %d primal %d dual %d\n",
2141 optimizecount, numstrongbranchmaxiterup, numstrongbranchmaxiterdo, numprimalmaxiter, numdualmaxiter);
2142 SCIPdebugMessage( "Objcut iter stat : Count %d branchup = %d branchlo = %d primal %d dual %d\n",
2143 optimizecount, numstrongbranchobjup, numstrongbranchobjdo, numprimalobj, numdualobj);
2146 #if DEBUG_CHECK_DATA > 0
2147 SCIP_CALL( scip_checkdata(lpi, "SolveWSimplex") );
2160 SCIPdebugMessage( "Calling SCIPlpiSolvePrimal[%d] (%d) ",optimizecount,lpi->lpid);
2162 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
2164 #if DEBUG_CHECK_DATA > 0
2165 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiSolvePrimal") );
2168 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_PRIMAL_SIMPLEX) );
2170 #if WRITE_PRIMAL > 0
2174 snprintf(fname,40, "primal_%d.lp",optimizecount);
2177 MSK_writedata(lpi->task,fname);
2183 if ( lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE )
2187 MOSEK_CALL( MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, NULL, &solsta) );
2190 if( solsta != MSK_SOL_STA_PRIM_FEAS )
2196 if (lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE)
2199 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2202 #if DEBUG_CHECK_DATA > 0
2203 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiSolvePrimal") );
2216 SCIPdebugMessage( "Calling SCIPlpiSolveDual[%d] (%d)\n",optimizecount,lpi->lpid);
2219 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_INTEGER, MSK_ON) );
2220 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
2221 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_DUAL_SIMPLEX) );
2227 snprintf(fname,40, "dual_%d.lp",optimizecount);
2229 MSK_writedata(lpi->task,fname);
2234 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_ON) );
2235 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG_SIM_FREQ, 1) );
2240 if ( lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE )
2244 MOSEK_CALL( MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, NULL, &solsta) );
2246 if( solsta != MSK_SOL_STA_DUAL_FEAS )
2252 if (lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE)
2255 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2267 assert(MosekEnv != NULL);
2268 assert(lpi != NULL);
2269 assert(lpi->task != NULL);
2276 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_ON) );
2280 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_OFF) );
2284 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, MSK_OFF) );
2289 SCIPdebugMessage( "Calling SCIPlpiSolveBarrier[%d] (%d) ",optimizecount,lpi->lpid);
2291 #if DEBUG_CHECK_DATA > 0
2292 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiSolveBarrier") );
2295 MOSEK_CALL( MSK_putintparam(lpi->task,MSK_IPAR_INTPNT_BASIS, crossover ? MSK_BI_ALWAYS : MSK_BI_NEVER) );
2296 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_INTPNT) );
2299 #if WRITE_INTPNT > 0
2303 snprintf(fname,40, "intpnt_%d.lp",optimizecount);
2306 MSK_writedata(lpi->task,fname);
2310 MOSEK_CALL( filterTRMrescode(lpi->messagehdlr, &lpi->termcode, MSK_optimize(lpi->task)) );
2312 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2315 MOSEK_CALL( MSK_getintinf(lpi->task, MSK_IINF_INTPNT_ITER, &lpi->itercount) );
2322 MOSEK_CALL( MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, &prosta, &solsta) );
2324 lpi->termcode, prosta, solsta, lpi->itercount);
2328 #if DEBUG_CHECK_DATA > 0
2329 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiSolveBarrier") );
2369 MSKobjsensee objsen;
2385 #if DEBUG_CHECK_DATA > 0
2386 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiStrongbranch") );
2389 assert(MosekEnv != NULL);
2390 assert(lpi != NULL);
2391 assert(lpi->task != NULL);
2393 if (lpi->termcode != MSK_RES_OK)
2398 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
2399 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
2401 SCIP_CALL( getbase(lpi, ncols, nrows) );
2403 MOSEK_CALL( MSK_getobjsense(lpi->task, &objsen) );
2404 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, &olditerlim) );
2405 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, &oldselection) );
2406 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_HOTSTART, &oldhotstart) );
2408 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, itlim) );
2411 if (objsen == MSK_OBJECTIVE_SENSE_MINIMIZE)
2413 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, &bound) );
2417 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, &bound) );
2420 MOSEK_CALL( MSK_getbound(lpi->task, MSK_ACC_VAR, col, &bkx, &blx, &bux) );
2424 newub = EPSCEIL(psol-1.0, 1e-06);
2426 if (newub < blx - 0.5)
2437 else if ( EPSEQ(blx,newub,1.0e-6))
2445 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_VAR, col, newbk, blx, newub) );
2449 *iter += lpi->itercount;
2482 MOSEK_CALL( MSK_getdualobj(lpi->task, MSK_SOL_BAS, down) );
2486 if (lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE)
2487 ++numstrongbranchobjup;
2489 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2490 ++numstrongbranchmaxiterup;
2494 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_VAR, col, bkx, blx, bux) );
2498 if (newlb > bux + 0.5)
2509 else if ( EPSEQ(bux,newlb,1.0e-6))
2517 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_VAR, col, newbk, newlb, bux) );
2520 *iter += lpi->itercount;
2551 MOSEK_CALL( MSK_getdualobj(lpi->task, MSK_SOL_BAS, up) );
2555 if (lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE)
2556 ++numstrongbranchobjdo;
2558 if (lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS)
2559 ++numstrongbranchmaxiterdo;
2562 MOSEK_CALL( MSK_putbound(lpi->task, MSK_ACC_VAR, col, bkx, blx, bux) );
2563 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, olditerlim) );
2564 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, oldselection) );
2565 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART, oldhotstart) );
2569 lpi->termcode = MSK_RES_OK;
2572 #if DEBUG_CHECK_DATA > 0
2573 SCIP_CALL( scip_checkdata(lpi, "SCIPlpiStrongbranch") );
2597 SCIP_CALL( SCIPlpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2620 assert( iter != NULL );
2621 assert( cols != NULL );
2622 assert( psols != NULL );
2623 assert( down != NULL );
2624 assert( up != NULL );
2625 assert( downvalid != NULL );
2626 assert( upvalid != NULL );
2627 assert( down != NULL );
2632 for (j = 0; j < ncols; ++j)
2635 SCIP_CALL( SCIPlpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter) );
2656 SCIP_CALL( SCIPlpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2679 assert( iter != NULL );
2680 assert( cols != NULL );
2681 assert( psols != NULL );
2682 assert( down != NULL );
2683 assert( up != NULL );
2684 assert( downvalid != NULL );
2685 assert( upvalid != NULL );
2686 assert( down != NULL );
2691 for (j = 0; j < ncols; ++j)
2694 SCIP_CALL( SCIPlpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter) );
2713 assert(MosekEnv != NULL);
2714 assert(lpi != NULL);
2715 assert(lpi->task != NULL);
2721 return (solsta == MSK_SOL_STA_OPTIMAL);
2735 assert(MosekEnv != NULL);
2736 assert(lpi != NULL);
2737 assert(lpi->task != NULL);
2744 MOSEK_CALL( MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, NULL, &solsta) );
2748 case MSK_SOL_STA_OPTIMAL:
2749 case MSK_SOL_STA_PRIM_AND_DUAL_FEAS:
2753 case MSK_SOL_STA_PRIM_FEAS:
2756 case MSK_SOL_STA_DUAL_FEAS:
2759 case MSK_SOL_STA_UNKNOWN:
2760 case MSK_SOL_STA_NEAR_OPTIMAL:
2761 case MSK_SOL_STA_NEAR_PRIM_FEAS:
2762 case MSK_SOL_STA_NEAR_DUAL_FEAS:
2763 case MSK_SOL_STA_NEAR_PRIM_AND_DUAL_FEAS:
2764 case MSK_SOL_STA_PRIM_INFEAS_CER:
2765 case MSK_SOL_STA_DUAL_INFEAS_CER:
2766 case MSK_SOL_STA_NEAR_PRIM_INFEAS_CER:
2767 case MSK_SOL_STA_NEAR_DUAL_INFEAS_CER:
2768 case MSK_SOL_STA_INTEGER_OPTIMAL:
2769 case MSK_SOL_STA_NEAR_INTEGER_OPTIMAL:
2775 if( primalfeasible != NULL )
2776 *primalfeasible = pfeas;
2778 if( dualfeasible != NULL )
2779 *dualfeasible = dfeas;
2794 assert(MosekEnv != NULL);
2795 assert(lpi != NULL);
2796 assert(lpi->task != NULL);
2802 return ( solsta == MSK_SOL_STA_DUAL_INFEAS_CER
2803 || prosta == MSK_PRO_STA_DUAL_INFEAS
2804 || prosta == MSK_PRO_STA_PRIM_AND_DUAL_INFEAS);
2816 assert(MosekEnv != NULL);
2817 assert(lpi != NULL);
2818 assert(lpi->task != NULL);
2824 return (solsta == MSK_SOL_STA_DUAL_INFEAS_CER);
2850 assert(MosekEnv != NULL);
2851 assert(lpi != NULL);
2852 assert(lpi->task != NULL);
2858 return (prosta == MSK_PRO_STA_PRIM_FEAS || prosta == MSK_PRO_STA_PRIM_AND_DUAL_FEAS);
2871 assert(MosekEnv != NULL);
2872 assert(lpi != NULL);
2873 assert(lpi->task != NULL);
2879 return ( solsta == MSK_SOL_STA_PRIM_INFEAS_CER
2880 || prosta == MSK_PRO_STA_PRIM_INFEAS
2881 || prosta == MSK_PRO_STA_PRIM_AND_DUAL_INFEAS);
2893 assert(MosekEnv != NULL);
2894 assert(lpi != NULL);
2895 assert(lpi->task != NULL);
2901 return (solsta == MSK_SOL_STA_PRIM_INFEAS_CER);
2927 assert(MosekEnv != NULL);
2928 assert(lpi != NULL);
2929 assert(lpi->task != NULL);
2935 return (prosta == MSK_PRO_STA_DUAL_FEAS || prosta == MSK_PRO_STA_PRIM_AND_DUAL_FEAS);
2946 assert(MosekEnv != NULL);
2947 assert(lpi != NULL);
2948 assert(lpi->task != NULL);
2954 return (solsta == MSK_SOL_STA_OPTIMAL);
2962 assert(MosekEnv != NULL);
2963 assert(lpi != NULL);
2964 assert(lpi->task != NULL);
2966 return ( lpi->termcode == MSK_RES_OK
2967 || lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS
2968 || lpi->termcode == MSK_RES_TRM_MAX_TIME
2969 || lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE);
2977 assert(MosekEnv != NULL);
2978 assert(lpi != NULL);
2979 assert(lpi->task != NULL);
2981 return lpi->termcode == MSK_RES_TRM_OBJECTIVE_RANGE;
2989 assert(MosekEnv != NULL);
2990 assert(lpi != NULL);
2991 assert(lpi->task != NULL);
2993 return lpi->termcode == MSK_RES_TRM_MAX_ITERATIONS;
3001 assert(MosekEnv != NULL);
3002 assert(lpi != NULL);
3003 assert(lpi->task != NULL);
3005 return lpi->termcode == MSK_RES_TRM_MAX_TIME;
3016 assert(MosekEnv != NULL);
3017 assert(lpi != NULL);
3018 assert(lpi->task != NULL);
3022 retcode = getSolutionStatus(lpi, NULL, &solsta);
3035 assert(MosekEnv != NULL);
3036 assert(lpi != NULL);
3037 assert(lpi->task != NULL);
3052 assert(MosekEnv != NULL);
3053 assert(lpi != NULL);
3054 assert(lpi->task != NULL);
3058 MOSEK_CALL( MSK_getprimalobj(lpi->task, MSK_SOL_BAS, objval) );
3079 assert(MosekEnv != NULL);
3080 assert(lpi != NULL);
3081 assert(lpi->task != NULL);
3090 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3091 SCIP_ALLOC( BMSallocMemoryArray( &sux, ncols) );
3099 for( i = 0; i < ncols; i++ )
3101 assert(sux != NULL);
3102 redcost[i] -= sux[i];
3106 BMSfreeMemoryArray(&sux);
3117 assert(MosekEnv != NULL);
3118 assert(lpi != NULL);
3119 assert(lpi->task != NULL);
3135 assert(MosekEnv != NULL);
3136 assert(lpi != NULL);
3137 assert(lpi->task != NULL);
3141 MOSEK_CALL( MSK_getsolution(lpi->task, MSK_SOL_BAS, NULL, NULL, NULL, NULL, NULL, NULL, NULL, dualfarkas,
3155 assert(MosekEnv != NULL);
3156 assert(lpi != NULL);
3157 assert(lpi->task != NULL);
3159 *iterations = lpi->itercount;
3175 assert(lpi != NULL);
3176 assert(quality != NULL);
3191 if (res == MSK_RES_ERR_BASIS_SINGULAR)
3195 MOSEK_CALL( MSK_initbasissolve(lpi->task, basis) );
3222 for( i = 0; i < n; i++ )
3280 for( i = 0; i < n; i++ )
3321 void convertstat_scip2mosek(
3328 for( i = 0; i < n; i++ )
3333 resstat[i] = MSK_SK_LOW;
3336 resstat[i] = MSK_SK_BAS;
3339 resstat[i] = MSK_SK_UPR;
3342 resstat[i] = MSK_SK_SUPBAS;
3352 void convertstat_scip2mosek_slack(
3361 for( i = 0; i < n; i++ )
3366 resstat[i] = MSK_SK_UPR;
3369 resstat[i] = MSK_SK_BAS;
3372 resstat[i] = MSK_SK_LOW;
3375 resstat[i] = MSK_SK_SUPBAS;
3395 assert(MosekEnv != NULL);
3396 assert(lpi != NULL);
3397 assert(lpi->task != NULL);
3399 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3400 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3402 SCIP_CALL( getbase(lpi, ncols, nrows) );
3406 SCIP_CALL( convertstat_mosek2scip(lpi, MSK_ACC_VAR, lpi->skx, ncols, cstat) );
3411 SCIP_CALL( convertstat_mosek2scip_slack(lpi, MSK_ACC_CON, lpi->skc, nrows, rstat) );
3429 assert(MosekEnv != NULL);
3430 assert(lpi != NULL);
3431 assert(lpi->task != NULL);
3433 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3434 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3436 SCIP_CALL( ensureStateMem(lpi, ncols, nrows) );
3438 convertstat_scip2mosek(cstat, ncols, lpi->skx);
3439 convertstat_scip2mosek_slack(rstat, nrows, lpi->skc);
3456 assert(MosekEnv != NULL);
3457 assert(lpi != NULL);
3458 assert(lpi->task != NULL);
3462 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3465 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_OFF) );
3468 SCIP_CALL( handle_singular(lpi,bind,MSK_initbasissolve(lpi->task, bind)) );
3471 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
3474 for (i = 0; i < nrows; i++ )
3476 if (bind[i] < nrows)
3477 bind[i] = -1 - bind[i];
3479 bind[i] = bind[i] - nrows;
3510 assert(MosekEnv != NULL);
3511 assert(lpi != NULL);
3512 assert(lpi->task != NULL);
3514 MOSEK_CALL( MSK_getnumcon(lpi->task,&nrows) );
3515 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3517 for (i=0; i<nrows; i++)
3524 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_OFF) );
3525 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 0, &numnz, sub, coef) );
3527 BMSfreeMemoryArray(&sub);
3528 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
3555 assert(MosekEnv != NULL);
3556 assert(lpi != NULL);
3557 assert(lpi->task != NULL);
3559 MOSEK_CALL( MSK_getnumcon(lpi->task,&nrows) );
3560 #if MSK_VERSION_MAJOR < 7
3561 MOSEK_CALL( MSK_getavecnumnz(lpi->task,MSK_ACC_VAR,c,&numnz) );
3563 MOSEK_CALL( MSK_getacolnumnz(lpi->task,c,&numnz) );
3565 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3566 SCIP_ALLOC( BMSallocMemoryArray( &val, numnz+1) );
3568 for (i=0; i<nrows; i++)
3571 #if MSK_VERSION_MAJOR < 7
3572 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_VAR, c, &numnz, sub, val) );
3574 MOSEK_CALL( MSK_getacol(lpi->task, c, &numnz, sub, val) );
3577 for (i=0; i<numnz; i++)
3578 coef[sub[i]] = val[i];
3580 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_OFF) );
3581 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 0, &numnz, sub, coef) );
3583 BMSfreeMemoryArray(&sub);
3584 BMSfreeMemoryArray(&val);
3585 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
3610 assert(MosekEnv != NULL);
3611 assert(lpi != NULL);
3612 assert(lpi->task != NULL);
3616 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3617 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3619 for (i=0; i<nrows; i++)
3626 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_ON) );
3627 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 1, &numnz, sub, coef) );
3629 BMSfreeMemoryArray(&sub);
3661 assert(MosekEnv != NULL);
3662 assert(lpi != NULL);
3663 assert(lpi->task != NULL);
3669 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3670 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3672 SCIP_ALLOC( BMSallocMemoryArray(&csub, nrows) );
3673 SCIP_ALLOC( BMSallocMemoryArray(&cval, nrows) );
3675 for( i = 0; i < ncols; i++ )
3678 if( binvrow == NULL )
3682 SCIP_ALLOC( BMSallocMemoryArray( &binv, nrows) );
3689 for( i = 0; i < ncols; i++)
3693 #if MSK_VERSION_MAJOR < 7
3694 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_VAR, i, &numnz, csub, cval) );
3696 MOSEK_CALL( MSK_getacol(lpi->task, i, &numnz, csub, cval) );
3699 for( k = 0; k < numnz; ++k )
3700 val[i] += binv[csub[k]] * cval[k];
3704 BMSfreeMemoryArray(&cval);
3705 BMSfreeMemoryArray(&csub);
3709 BMSfreeMemoryArray(&binv);
3728 assert(lpistate != NULL);
3729 assert(blkmem != NULL);
3733 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
3734 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->skx, colpacketNum(ncols)) );
3735 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->skc, rowpacketNum(nrows)) );
3739 lpistate[0]->solsta = MSK_SOL_STA_UNKNOWN;
3740 lpistate[0]->num = -1;
3741 lpistate[0]->ncols = ncols;
3742 lpistate[0]->nrows = nrows;
3755 assert(blkmem != NULL);
3756 assert(lpistate != NULL);
3757 assert(*lpistate != NULL);
3759 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->skx, colpacketNum((*lpistate)->ncols));
3760 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->skc, rowpacketNum((*lpistate)->nrows));
3761 BMSfreeBlockMemory(blkmem, lpistate);
3771 MSKaccmodee accmode,
3778 for( i = 0; i < n; i++ )
3790 SCIPdebugMessage( "STATE[%d]: %c[%d] = bas, sl%c = %g, su%c = %g\n", optimizecount, xc, i, xc, sl, xc, su);
3803 SCIPdebugMessage( "STATE[%d]: %c[%d] = unknown status <%d>\n", optimizecount, xc, i, sk[i]);
3819 SCIP_CALL( checkState1(lpi, ncols, lpi->skx, MSK_ACC_VAR, 'x') );
3820 SCIP_CALL( checkState1(lpi, nrows, lpi->skc, MSK_ACC_CON, 'c') );
3833 int *skxi = ( int *) lpi->skx;
3834 int *skci = ( int *) lpi->skc;
3836 assert( sizeof( int) == sizeof(MSKstakeye));
3838 SCIP_CALL( convertstat_mosek2scip(lpi, MSK_ACC_VAR, lpi->skx, lpistate->ncols, skxi) );
3839 SCIP_CALL( convertstat_mosek2scip_slack(lpi, MSK_ACC_CON, lpi->skc, lpistate->nrows, skci) );
3841 SCIPencodeDualBit(skxi, lpistate->skx, lpistate->ncols);
3842 SCIPencodeDualBit(skci, lpistate->skc, lpistate->nrows);
3849 void lpistateUnpack(
3855 assert( sizeof( int) == sizeof(MSKstakeye));
3857 SCIPdecodeDualBit(lpistate->skx, ( int*) skx, lpistate->ncols);
3858 SCIPdecodeDualBit(lpistate->skc, ( int*) skc, lpistate->nrows);
3860 convertstat_scip2mosek(( int*) skx, lpistate->ncols, skx);
3861 convertstat_scip2mosek_slack(( int*) skc, lpistate->nrows, skc);
3877 assert(MosekEnv != NULL);
3878 assert(lpi != NULL);
3879 assert(lpi->task != NULL);
3880 assert(lpistate != NULL);
3884 MOSEK_CALL( MSK_solutiondef(lpi->task, MSK_SOL_BAS, &gotbasicsol) );
3889 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3890 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3893 SCIP_CALL( lpistateCreate(lpistate, blkmem, ncols, nrows) );
3895 lpistate[0]->num = optimizecount;
3897 MOSEK_CALL(MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, NULL, &lpistate[0]->solsta));
3899 SCIP_CALL( getbase(lpi, ncols, nrows) );
3902 SCIP_CALL( checkState(lpi, ncols, nrows) );
3905 SCIP_CALL( lpistatePack(lpi, lpistate[0]) );
3929 assert(MosekEnv != NULL);
3930 assert(lpi != NULL);
3931 assert(lpi->task != NULL);
3933 if (lpistate == NULL)
3939 if (lpistate->nrows == 0 || lpistate->ncols == 0)
3942 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3943 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3944 assert(lpistate->nrows <= nrows);
3945 assert(lpistate->ncols <= ncols);
3947 SCIP_CALL( ensureStateMem(lpi, ncols, nrows) );
3948 SCIP_CALL( getbase(lpi, ncols, nrows) );
3950 lpistateUnpack(lpistate, lpi->skx, lpi->skc);
3953 for (i = lpistate->ncols; i < ncols; ++i)
3957 MOSEK_CALL( MSK_getboundslice(lpi->task, MSK_ACC_VAR, i, i, NULL, &lb, &ub) );
3962 lpi->skx[i] = MSK_SK_SUPBAS;
3964 lpi->skx[i] = MSK_SK_UPR;
3967 lpi->skx[i] = MSK_SK_LOW;
3969 for (i = lpistate->nrows; i < nrows; ++i)
3970 lpi->skc[i] = MSK_SK_BAS;
3975 SCIPdebugMessage( "Store from state into task iter : %d with solsta : %d\n", lpistate->num, lpistate->solsta);
3985 assert(lpi != NULL);
4000 assert(MosekEnv != NULL);
4001 assert(lpi != NULL);
4002 assert(lpi->task != NULL);
4006 if( *lpistate != NULL )
4008 lpistateFree(lpistate, blkmem);
4020 assert(MosekEnv != NULL);
4021 assert(lpi != NULL);
4022 assert(lpi->task != NULL);
4026 return ( lpistate != NULL && lpistate->num >= 0);
4035 assert(MosekEnv != NULL);
4036 assert(lpi != NULL);
4037 assert(lpi->task != NULL);
4041 MOSEK_CALL( MSK_readsolution(lpi->task, MSK_SOL_BAS, fname) );
4054 assert(MosekEnv != NULL);
4055 assert(lpi != NULL);
4056 assert(lpi->task != NULL);
4059 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_HEAD, MSK_ON) );
4060 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_VARIABLES, MSK_ON) );
4061 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_CONSTRAINTS, MSK_ON) );
4063 MOSEK_CALL( MSK_writesolution(lpi->task, MSK_SOL_BAS, fname) );
4087 assert(lpinorms != NULL);
4103 assert(lpinorms == NULL);
4116 assert(lpinorms == NULL);
4129 static const char* paramname[] = {
4130 "SCIP_LPPAR_FROMSCRATCH",
4131 "SCIP_LPPAR_FASTMIP",
4132 "SCIP_LPPAR_SCALING",
4133 "SCIP_LPPAR_PRESOLVING",
4134 "SCIP_LPPAR_PRICING",
4135 "SCIP_LPPAR_LPINFO",
4136 "SCIP_LPPAR_FEASTOL",
4137 "SCIP_LPPAR_DUALFEASTOL",
4138 "SCIP_LPPAR_BARRIERCONVTOL",
4139 "SCIP_LPPAR_LOBJLIM",
4140 "SCIP_LPPAR_UOBJLIM",
4141 "SCIP_LPPAR_LPITLIM",
4142 "SCIP_LPPAR_LPTILIM",
4143 "SCIP_LPPAR_MARKOWITZ",
4144 "SCIP_LPPAR_ROWREPSWITCH",
4146 "SCIP_LPPAR_THREADS"
4151 const char* paramty2str(
4173 return paramname[type];
4185 assert(MosekEnv != NULL);
4186 assert(lpi != NULL);
4187 assert(lpi->task != NULL);
4192 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_HOTSTART, ival) );
4193 *ival = (*ival == MSK_SIM_HOTSTART_NONE);
4198 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_SCALING, ival) );
4199 *ival = (*ival != MSK_SCALING_NONE);
4202 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, ival) );
4203 *ival = (*ival != MSK_PRESOLVE_MODE_OFF);
4206 *ival = lpi->pricing;
4209 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_LOG, ival) );
4210 *ival = (*ival == MSK_ON);
4213 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, ival) );
4231 #if SCIP_CONTROLS_PRICING
4233 static int pricing[7] = {
4234 MSK_SIM_SELECTION_SE,
4235 MSK_SIM_SELECTION_SE,
4236 MSK_SIM_SELECTION_FULL,
4237 MSK_SIM_SELECTION_PARTIAL,
4238 MSK_SIM_SELECTION_SE,
4239 MSK_SIM_SELECTION_ASE,
4240 MSK_SIM_SELECTION_DEVEX,
4244 SCIPdebugMessage( "Calling SCIPlpiSetIntpar (%d) Parameter=<%s> Value=<%d>\n", lpi->lpid, paramty2str(type), ival);
4254 SCIPdebugMessage( "Calling SCIPlpiSetIntpar (%d) %s = %d\n",lpi->lpid,paramty2str(type),ival);
4256 assert(MosekEnv != NULL);
4257 assert(lpi != NULL);
4258 assert(lpi->task != NULL);
4263 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART,
4264 ival ? MSK_SIM_HOTSTART_NONE : MSK_SIM_HOTSTART_STATUS_KEYS ) );
4269 scaling = (ival ? MSK_SCALING_FREE : MSK_SCALING_NONE);
4270 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_SCALING, scaling) );
4271 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_INTPNT_SCALING, scaling) );
4274 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_PRESOLVE_USE,
4275 ival ? MSK_PRESOLVE_MODE_FREE : MSK_PRESOLVE_MODE_OFF) );
4315 #if SCIP_CONTROLS_PRICING
4316 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_SELECTION, pricing[ival]) );
4318 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, pricing[ival]) );
4323 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_RESTRICT_SELECTION, 0) );
4325 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION, 0) );
4328 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_SELECTION, MSK_SIM_SELECTION_FREE) );
4330 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, MSK_SIM_SELECTION_FREE) );
4338 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, ival ? MSK_ON : MSK_OFF) );
4342 #if DEBUG_PARAM_SETTING
4349 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, ival) );
4367 assert(MosekEnv != NULL);
4368 assert(lpi != NULL);
4369 assert(lpi->task != NULL);
4373 #if SCIP_CONTROLS_TOLERANCES
4375 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_BASIS_TOL_X, dval) );
4378 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_BASIS_TOL_S, dval) );
4381 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_INTPNT_TOL_REL_GAP, dval) );
4385 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, dval) );
4388 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, dval) );
4391 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_OPTIMIZER_MAX_TIME, dval) );
4408 SCIPdebugMessage( "setting real parameter %s to %g\n", paramty2str(type), dval);
4410 assert(MosekEnv != NULL);
4411 assert(lpi != NULL);
4412 assert(lpi->task != NULL);
4418 #if SCIP_CONTROLS_TOLERANCES
4423 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_BASIS_TOL_X, dval) );
4430 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_BASIS_TOL_S, dval) );
4433 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_INTPNT_TOL_REL_GAP, dval) );
4437 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, dval) );
4440 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, dval) );
4443 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_OPTIMIZER_MAX_TIME, dval) );
4464 assert(MosekEnv != NULL);
4465 assert(lpi != NULL);
4466 assert(lpi->task != NULL);
4468 return MSK_INFINITY;
4477 assert(MosekEnv != NULL);
4478 assert(lpi != NULL);
4479 assert(lpi->task != NULL);
4498 SCIPdebugMessage( "Calling SCIPlpiReadLP (%d), filename <%s>\n",lpi->lpid, fname);
4500 assert(MosekEnv != NULL);
4501 assert(lpi != NULL);
4502 assert(lpi->task != NULL);
4504 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, &olddataformat) );
4505 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, MSK_DATA_FORMAT_LP) );
4506 MOSEK_CALL( MSK_readdata(lpi->task, fname) );
4507 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, olddataformat) );
4520 SCIPdebugMessage( "Calling SCIPlpiReadLP (%d), filename <%s>\n",lpi->lpid, fname);
4522 assert(MosekEnv != NULL);
4523 assert(lpi != NULL);
4524 assert(lpi->task != NULL);
4526 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, &olddataformat) );
4527 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, MSK_DATA_FORMAT_LP) );
4528 MOSEK_CALL( MSK_writedata(lpi->task, fname) );
4529 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, olddataformat) );
SCIP_RETCODE SCIPlpiGetRows(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs, int *nnonz, int *beg, int *ind, SCIP_Real *val)
SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname)
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
#define ASSERT_ON_NUMERICAL_TROUBLES
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsIterlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int row, SCIP_Real *coef)
SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname)
unsigned int SCIP_DUALPACKET
SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef)
SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas)
const char * SCIPlpiGetSolverName(void)
enum SCIP_ObjSen SCIP_OBJSEN
SCIP_RETCODE SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
interface methods for specific LP solvers
SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, int *ind, SCIP_Real *obj)
SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations)
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
SCIP_Bool SCIPlpiExistsDualRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
SCIP_RETCODE SCIPlpiAddCols(SCIP_LPI *lpi, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_RETCODE SCIPlpiStrongbranchInt(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_RETCODE SCIPlpiFreeNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
enum SCIP_LPParam SCIP_LPPARAM
SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
SCIP_RETCODE SCIPlpiSolvePrimal(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiClear(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
enum SCIP_Pricing SCIP_PRICING
SCIP_RETCODE SCIPlpiDelRowset(SCIP_LPI *lpi, int *dstat)
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray)
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
SCIP_DUALPACKET COLPACKET
SCIP_Bool SCIPlpiIsDualInfeasible(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsDualFeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
SCIP_DUALPACKET COLPACKET
SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind)
SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
SCIP_RETCODE SCIPlpiLoadColLP(SCIP_LPI *lpi, SCIP_OBJSEN objsen, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow)
SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
SCIP_RETCODE SCIPlpiGetNCols(SCIP_LPI *lpi, int *ncols)
SCIP_RETCODE SCIPlpiGetNRows(SCIP_LPI *lpi, int *nrows)
SCIP_DUALPACKET ROWPACKET
SCIP_RETCODE SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef)
SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval)
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
struct SCIP_LPiState SCIP_LPISTATE
#define DEBUG_CHECK_STATE_TOL
SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int row, const SCIP_Real *binvrow, SCIP_Real *val)
SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval)
void * SCIPlpiGetSolverPointer(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval)
SCIP_RETCODE SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
SCIP_RETCODE SCIPlpiAddRows(SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_RETCODE SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiWasSolved(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsStable(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
SCIP_Bool SCIPlpiHasPrimalRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiClearState(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
SCIP_RETCODE SCIPlpiStrongbranchFrac(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success)
SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
SCIP_RETCODE SCIPlpiDelColset(SCIP_LPI *lpi, int *dstat)
SCIP_RETCODE SCIPlpiStrongbranchesInt(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_Bool SCIPlpiIsDualUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen)
SCIP_Bool SCIPlpiIsInfinity(SCIP_LPI *lpi, SCIP_Real val)
SCIP_RETCODE SCIPlpiGetCols(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lb, SCIP_Real *ub, int *nnonz, int *beg, int *ind, SCIP_Real *val)
SCIP_RETCODE SCIPlpiGetNNonz(SCIP_LPI *lpi, int *nnonz)
SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
SCIP_RETCODE SCIPlpiStrongbranchesFrac(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen)
SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiHasDualRay(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi)
#define STRONGBRANCH_PRICING
SCIP_RETCODE SCIPlpiGetSolFeasibility(SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible)
SCIP_DUALPACKET ROWPACKET
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
#define SENSE2MOSEK(objsen)
SCIP_Bool SCIPlpiExistsPrimalRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover)
SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
#define SCIP_CALL_ABORT(x)
SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE *lpistate)
SCIP_Bool SCIPlpiIsTimelimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol)
const char * SCIPlpiGetSolverDesc(void)
int SCIPlpiGetInternalStatus(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS *lpinorms)
|