|
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;
3503 assert(MosekEnv != NULL);
3504 assert(lpi != NULL);
3505 assert(lpi->task != NULL);
3507 MOSEK_CALL( MSK_getnumcon(lpi->task,&nrows) );
3508 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3510 for (i=0; i<nrows; i++)
3517 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_OFF) );
3518 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 0, &numnz, sub, coef) );
3520 BMSfreeMemoryArray(&sub);
3521 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
3541 assert(MosekEnv != NULL);
3542 assert(lpi != NULL);
3543 assert(lpi->task != NULL);
3545 MOSEK_CALL( MSK_getnumcon(lpi->task,&nrows) );
3546 #if MSK_VERSION_MAJOR < 7
3547 MOSEK_CALL( MSK_getavecnumnz(lpi->task,MSK_ACC_VAR,c,&numnz) );
3549 MOSEK_CALL( MSK_getacolnumnz(lpi->task,c,&numnz) );
3551 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3552 SCIP_ALLOC( BMSallocMemoryArray( &val, numnz+1) );
3554 for (i=0; i<nrows; i++)
3557 #if MSK_VERSION_MAJOR < 7
3558 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_VAR, c, &numnz, sub, val) );
3560 MOSEK_CALL( MSK_getacol(lpi->task, c, &numnz, sub, val) );
3563 for (i=0; i<numnz; i++)
3564 coef[sub[i]] = val[i];
3566 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_OFF) );
3567 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 0, &numnz, sub, coef) );
3569 BMSfreeMemoryArray(&sub);
3570 BMSfreeMemoryArray(&val);
3571 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART_LU, MSK_ON) );
3589 assert(MosekEnv != NULL);
3590 assert(lpi != NULL);
3591 assert(lpi->task != NULL);
3595 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3596 SCIP_ALLOC( BMSallocMemoryArray( &sub, nrows) );
3598 for (i=0; i<nrows; i++)
3605 MOSEK_CALL( MSK_putnaintparam(lpi->task, MSK_IPAR_BASIS_SOLVE_USE_PLUS_ONE_, MSK_ON) );
3606 MOSEK_CALL( MSK_solvewithbasis(lpi->task, 1, &numnz, sub, coef) );
3608 BMSfreeMemoryArray(&sub);
3633 assert(MosekEnv != NULL);
3634 assert(lpi != NULL);
3635 assert(lpi->task != NULL);
3641 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3642 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3644 SCIP_ALLOC( BMSallocMemoryArray(&csub, nrows) );
3645 SCIP_ALLOC( BMSallocMemoryArray(&cval, nrows) );
3647 for( i = 0; i < ncols; i++ )
3650 if( binvrow == NULL )
3654 SCIP_ALLOC( BMSallocMemoryArray( &binv, nrows) );
3661 for( i = 0; i < ncols; i++)
3665 #if MSK_VERSION_MAJOR < 7
3666 MOSEK_CALL( MSK_getavec(lpi->task, MSK_ACC_VAR, i, &numnz, csub, cval) );
3668 MOSEK_CALL( MSK_getacol(lpi->task, i, &numnz, csub, cval) );
3671 for( k = 0; k < numnz; ++k )
3672 val[i] += binv[csub[k]] * cval[k];
3676 BMSfreeMemoryArray(&cval);
3677 BMSfreeMemoryArray(&csub);
3681 BMSfreeMemoryArray(&binv);
3700 assert(lpistate != NULL);
3701 assert(blkmem != NULL);
3705 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
3706 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->skx, colpacketNum(ncols)) );
3707 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->skc, rowpacketNum(nrows)) );
3711 lpistate[0]->solsta = MSK_SOL_STA_UNKNOWN;
3712 lpistate[0]->num = -1;
3713 lpistate[0]->ncols = ncols;
3714 lpistate[0]->nrows = nrows;
3727 assert(blkmem != NULL);
3728 assert(lpistate != NULL);
3729 assert(*lpistate != NULL);
3731 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->skx, colpacketNum((*lpistate)->ncols));
3732 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->skc, rowpacketNum((*lpistate)->nrows));
3733 BMSfreeBlockMemory(blkmem, lpistate);
3743 MSKaccmodee accmode,
3750 for( i = 0; i < n; i++ )
3762 SCIPdebugMessage( "STATE[%d]: %c[%d] = bas, sl%c = %g, su%c = %g\n", optimizecount, xc, i, xc, sl, xc, su);
3775 SCIPdebugMessage( "STATE[%d]: %c[%d] = unknown status <%d>\n", optimizecount, xc, i, sk[i]);
3791 SCIP_CALL( checkState1(lpi, ncols, lpi->skx, MSK_ACC_VAR, 'x') );
3792 SCIP_CALL( checkState1(lpi, nrows, lpi->skc, MSK_ACC_CON, 'c') );
3805 int *skxi = ( int *) lpi->skx;
3806 int *skci = ( int *) lpi->skc;
3808 assert( sizeof( int) == sizeof(MSKstakeye));
3810 SCIP_CALL( convertstat_mosek2scip(lpi, MSK_ACC_VAR, lpi->skx, lpistate->ncols, skxi) );
3811 SCIP_CALL( convertstat_mosek2scip_slack(lpi, MSK_ACC_CON, lpi->skc, lpistate->nrows, skci) );
3813 SCIPencodeDualBit(skxi, lpistate->skx, lpistate->ncols);
3814 SCIPencodeDualBit(skci, lpistate->skc, lpistate->nrows);
3821 void lpistateUnpack(
3827 assert( sizeof( int) == sizeof(MSKstakeye));
3829 SCIPdecodeDualBit(lpistate->skx, ( int*) skx, lpistate->ncols);
3830 SCIPdecodeDualBit(lpistate->skc, ( int*) skc, lpistate->nrows);
3832 convertstat_scip2mosek(( int*) skx, lpistate->ncols, skx);
3833 convertstat_scip2mosek_slack(( int*) skc, lpistate->nrows, skc);
3849 assert(MosekEnv != NULL);
3850 assert(lpi != NULL);
3851 assert(lpi->task != NULL);
3852 assert(lpistate != NULL);
3856 MOSEK_CALL( MSK_solutiondef(lpi->task, MSK_SOL_BAS, &gotbasicsol) );
3861 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3862 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3865 SCIP_CALL( lpistateCreate(lpistate, blkmem, ncols, nrows) );
3867 lpistate[0]->num = optimizecount;
3869 MOSEK_CALL(MSK_getsolutionstatus ( lpi->task, MSK_SOL_BAS, NULL, &lpistate[0]->solsta));
3871 SCIP_CALL( getbase(lpi, ncols, nrows) );
3874 SCIP_CALL( checkState(lpi, ncols, nrows) );
3877 SCIP_CALL( lpistatePack(lpi, lpistate[0]) );
3901 assert(MosekEnv != NULL);
3902 assert(lpi != NULL);
3903 assert(lpi->task != NULL);
3905 if (lpistate == NULL)
3911 if (lpistate->nrows == 0 || lpistate->ncols == 0)
3914 MOSEK_CALL( MSK_getnumcon(lpi->task, &nrows) );
3915 MOSEK_CALL( MSK_getnumvar(lpi->task, &ncols) );
3916 assert(lpistate->nrows <= nrows);
3917 assert(lpistate->ncols <= ncols);
3919 SCIP_CALL( ensureStateMem(lpi, ncols, nrows) );
3920 SCIP_CALL( getbase(lpi, ncols, nrows) );
3922 lpistateUnpack(lpistate, lpi->skx, lpi->skc);
3925 for (i = lpistate->ncols; i < ncols; ++i)
3929 MOSEK_CALL( MSK_getboundslice(lpi->task, MSK_ACC_VAR, i, i, NULL, &lb, &ub) );
3934 lpi->skx[i] = MSK_SK_SUPBAS;
3936 lpi->skx[i] = MSK_SK_UPR;
3939 lpi->skx[i] = MSK_SK_LOW;
3941 for (i = lpistate->nrows; i < nrows; ++i)
3942 lpi->skc[i] = MSK_SK_BAS;
3947 SCIPdebugMessage( "Store from state into task iter : %d with solsta : %d\n", lpistate->num, lpistate->solsta);
3957 assert(lpi != NULL);
3972 assert(MosekEnv != NULL);
3973 assert(lpi != NULL);
3974 assert(lpi->task != NULL);
3978 if( *lpistate != NULL )
3980 lpistateFree(lpistate, blkmem);
3992 assert(MosekEnv != NULL);
3993 assert(lpi != NULL);
3994 assert(lpi->task != NULL);
3998 return ( lpistate != NULL && lpistate->num >= 0);
4007 assert(MosekEnv != NULL);
4008 assert(lpi != NULL);
4009 assert(lpi->task != NULL);
4013 MOSEK_CALL( MSK_readsolution(lpi->task, MSK_SOL_BAS, fname) );
4026 assert(MosekEnv != NULL);
4027 assert(lpi != NULL);
4028 assert(lpi->task != NULL);
4031 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_HEAD, MSK_ON) );
4032 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_VARIABLES, MSK_ON) );
4033 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_SOL_CONSTRAINTS, MSK_ON) );
4035 MOSEK_CALL( MSK_writesolution(lpi->task, MSK_SOL_BAS, fname) );
4059 assert(lpinorms != NULL);
4075 assert(lpinorms == NULL);
4088 assert(lpinorms == NULL);
4101 static const char* paramname[] = {
4102 "SCIP_LPPAR_FROMSCRATCH",
4103 "SCIP_LPPAR_FASTMIP",
4104 "SCIP_LPPAR_SCALING",
4105 "SCIP_LPPAR_PRESOLVING",
4106 "SCIP_LPPAR_PRICING",
4107 "SCIP_LPPAR_LPINFO",
4108 "SCIP_LPPAR_FEASTOL",
4109 "SCIP_LPPAR_DUALFEASTOL",
4110 "SCIP_LPPAR_BARRIERCONVTOL",
4111 "SCIP_LPPAR_LOBJLIM",
4112 "SCIP_LPPAR_UOBJLIM",
4113 "SCIP_LPPAR_LPITLIM",
4114 "SCIP_LPPAR_LPTILIM",
4115 "SCIP_LPPAR_MARKOWITZ",
4116 "SCIP_LPPAR_ROWREPSWITCH",
4118 "SCIP_LPPAR_THREADS"
4123 const char* paramty2str(
4145 return paramname[type];
4157 assert(MosekEnv != NULL);
4158 assert(lpi != NULL);
4159 assert(lpi->task != NULL);
4164 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_HOTSTART, ival) );
4165 *ival = (*ival == MSK_SIM_HOTSTART_NONE);
4170 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_SCALING, ival) );
4171 *ival = (*ival != MSK_SCALING_NONE);
4174 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_PRESOLVE_USE, ival) );
4175 *ival = (*ival != MSK_PRESOLVE_MODE_OFF);
4178 *ival = lpi->pricing;
4181 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_LOG, ival) );
4182 *ival = (*ival == MSK_ON);
4185 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, ival) );
4203 #if SCIP_CONTROLS_PRICING
4205 static int pricing[7] = {
4206 MSK_SIM_SELECTION_SE,
4207 MSK_SIM_SELECTION_SE,
4208 MSK_SIM_SELECTION_FULL,
4209 MSK_SIM_SELECTION_PARTIAL,
4210 MSK_SIM_SELECTION_SE,
4211 MSK_SIM_SELECTION_ASE,
4212 MSK_SIM_SELECTION_DEVEX,
4216 SCIPdebugMessage( "Calling SCIPlpiSetIntpar (%d) Parameter=<%s> Value=<%d>\n", lpi->lpid, paramty2str(type), ival);
4226 SCIPdebugMessage( "Calling SCIPlpiSetIntpar (%d) %s = %d\n",lpi->lpid,paramty2str(type),ival);
4228 assert(MosekEnv != NULL);
4229 assert(lpi != NULL);
4230 assert(lpi->task != NULL);
4235 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_HOTSTART,
4236 ival ? MSK_SIM_HOTSTART_NONE : MSK_SIM_HOTSTART_STATUS_KEYS ) );
4241 scaling = (ival ? MSK_SCALING_FREE : MSK_SCALING_NONE);
4242 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_SCALING, scaling) );
4243 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_INTPNT_SCALING, scaling) );
4246 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_PRESOLVE_USE,
4247 ival ? MSK_PRESOLVE_MODE_FREE : MSK_PRESOLVE_MODE_OFF) );
4287 #if SCIP_CONTROLS_PRICING
4288 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_SELECTION, pricing[ival]) );
4290 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, pricing[ival]) );
4295 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_RESTRICT_SELECTION, 0) );
4297 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION, 0) );
4300 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_PRIMAL_SELECTION, MSK_SIM_SELECTION_FREE) );
4302 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_DUAL_SELECTION, MSK_SIM_SELECTION_FREE) );
4310 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_LOG, ival ? MSK_ON : MSK_OFF) );
4314 #if DEBUG_PARAM_SETTING
4321 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_SIM_MAX_ITERATIONS, ival) );
4339 assert(MosekEnv != NULL);
4340 assert(lpi != NULL);
4341 assert(lpi->task != NULL);
4345 #if SCIP_CONTROLS_TOLERANCES
4347 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_BASIS_TOL_X, dval) );
4350 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_BASIS_TOL_S, dval) );
4353 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_INTPNT_TOL_REL_GAP, dval) );
4357 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, dval) );
4360 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, dval) );
4363 MOSEK_CALL( MSK_getdouparam(lpi->task, MSK_DPAR_OPTIMIZER_MAX_TIME, dval) );
4380 SCIPdebugMessage( "setting real parameter %s to %g\n", paramty2str(type), dval);
4382 assert(MosekEnv != NULL);
4383 assert(lpi != NULL);
4384 assert(lpi->task != NULL);
4390 #if SCIP_CONTROLS_TOLERANCES
4395 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_BASIS_TOL_X, dval) );
4402 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_BASIS_TOL_S, dval) );
4405 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_INTPNT_TOL_REL_GAP, dval) );
4409 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_LOWER_OBJ_CUT, dval) );
4412 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_UPPER_OBJ_CUT, dval) );
4415 MOSEK_CALL( MSK_putdouparam(lpi->task, MSK_DPAR_OPTIMIZER_MAX_TIME, dval) );
4436 assert(MosekEnv != NULL);
4437 assert(lpi != NULL);
4438 assert(lpi->task != NULL);
4440 return MSK_INFINITY;
4449 assert(MosekEnv != NULL);
4450 assert(lpi != NULL);
4451 assert(lpi->task != NULL);
4470 SCIPdebugMessage( "Calling SCIPlpiReadLP (%d), filename <%s>\n",lpi->lpid, fname);
4472 assert(MosekEnv != NULL);
4473 assert(lpi != NULL);
4474 assert(lpi->task != NULL);
4476 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, &olddataformat) );
4477 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, MSK_DATA_FORMAT_LP) );
4478 MOSEK_CALL( MSK_readdata(lpi->task, fname) );
4479 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_READ_DATA_FORMAT, olddataformat) );
4492 SCIPdebugMessage( "Calling SCIPlpiReadLP (%d), filename <%s>\n",lpi->lpid, fname);
4494 assert(MosekEnv != NULL);
4495 assert(lpi != NULL);
4496 assert(lpi->task != NULL);
4498 MOSEK_CALL( MSK_getintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, &olddataformat) );
4499 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, MSK_DATA_FORMAT_LP) );
4500 MOSEK_CALL( MSK_writedata(lpi->task, fname) );
4501 MOSEK_CALL( MSK_putintparam(lpi->task, MSK_IPAR_WRITE_DATA_FORMAT, olddataformat) );
|