26#pragma GCC diagnostic ignored "-Wsign-compare"
27#pragma GCC diagnostic ignored "-Wpedantic"
28#pragma GCC diagnostic ignored "-Wignored-qualifiers"
29#pragma GCC diagnostic ignored "-Wshadow"
30#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
31#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
32#pragma GCC diagnostic ignored "-Woverflow"
48#include "scip/pub_message.h"
53#pragma GCC diagnostic warning "-Wsign-compare"
54#pragma GCC diagnostic warning "-Wpedantic"
55#pragma GCC diagnostic warning "-Wignored-qualifiers"
56#pragma GCC diagnostic warning "-Wshadow"
57#pragma GCC diagnostic warning "-Wnon-virtual-dtor"
58#pragma GCC diagnostic warning "-Wctor-dtor-privacy"
59#pragma GCC diagnostic warning "-Woverflow"
64using operations_research::glop::ColIndex;
79using operations_research::glop::RowIndex;
124#define UNSCALEDFEAS_CHECK 0
126#define UNSCALEDFEAS_CHECK 2
150 return "Glop Linear Solver, developed by Google, part of OR-Tools (developers.google.com/optimization)";
158 assert( lpi != NULL );
160 SCIPerrorMessage(
"SCIPlpiGetSolverPointer() has not been implemented yet.\n");
172 assert( lpi != NULL );
173 assert( lpi->linear_program != NULL );
174 assert( ncols == 0 || ncols == lpi->linear_program->num_variables().value() );
177 for (ColIndex
col(0);
col < ColIndex(ncols); ++
col)
179 assert( intInfo != NULL );
180 int info = intInfo[
col.value()];
181 assert( info == 0 || info == 1 );
226 SCIP_MESSAGEHDLR* messagehdlr,
231 assert( lpi != NULL );
232 assert(
name != NULL );
235 SCIP_ALLOC(BMSallocMemory(lpi));
243 (*lpi)->linear_program->SetName(std::string(
name));
246 (*lpi)->from_scratch =
false;
247 (*lpi)->lp_info =
false;
248 (*lpi)->pricing = SCIP_PRICING_LPIDEFAULT;
249 (*lpi)->lp_modified_since_last_solve =
true;
250 (*lpi)->lp_time_limit_was_reached =
false;
251 (*lpi)->conditionlimit = -1.0;
252 (*lpi)->checkcondition =
false;
253 (*lpi)->niterations = 0LL;
259 (*lpi)->parameters->set_use_scaling(
false);
270 SCIPdebugMessage(
"SCIPlpiFree\n");
272 delete (*lpi)->scaler;
273 delete (*lpi)->parameters;
274 delete (*lpi)->solver;
275 delete (*lpi)->scaled_lp;
276 delete (*lpi)->linear_program;
278 delete (*lpi)->tmp_row;
279 delete (*lpi)->tmp_column;
303 const SCIP_Real* obj,
308 const SCIP_Real* lhs,
309 const SCIP_Real* rhs,
317 assert( lpi != NULL );
318 assert( lpi->linear_program != NULL );
319 assert( obj != NULL );
320 assert( lb != NULL );
321 assert( ub != NULL );
322 assert( beg != NULL );
323 assert( ind != NULL );
324 assert( val != NULL );
326 lpi->linear_program->Clear();
327 SCIP_CALL(
SCIPlpiAddRows(lpi, nrows, lhs, rhs, rownames, 0, NULL, NULL, NULL) );
328 SCIP_CALL(
SCIPlpiAddCols(lpi, ncols, obj, lb, ub, colnames, nnonz, beg, ind, val) );
338 const SCIP_Real* obj,
348 assert( lpi != NULL );
349 assert( lpi->linear_program != NULL );
350 assert( obj != NULL );
351 assert( lb != NULL );
352 assert( ub != NULL );
353 assert( nnonz >= 0) ;
354 assert( ncols >= 0) ;
356 SCIPdebugMessage(
"adding %d columns with %d nonzeros.\n", ncols, nnonz);
361 assert( beg != NULL );
362 assert( ind != NULL );
363 assert( val != NULL );
368 RowIndex num_rows = lpi->linear_program->num_constraints();
369 for (
int j = 0; j < nnonz; ++j)
371 assert( 0 <= ind[j] && ind[j] < num_rows.value() );
372 assert( val[j] != 0.0 );
377 for (
int i = 0; i < ncols; ++i)
379 const ColIndex
col = lpi->linear_program->CreateNewVariable();
380 lpi->linear_program->SetVariableBounds(
col, lb[i], ub[i]);
381 lpi->linear_program->SetObjectiveCoefficient(
col, obj[i]);
382 const int end = (nnonz == 0 || i == ncols - 1) ? nnonz : beg[i + 1];
385 lpi->linear_program->SetCoefficient(RowIndex(ind[nz]),
col, val[nz]);
389 assert( nz == nnonz );
393 for (
int i = 0; i < ncols; ++i)
395 const ColIndex
col = lpi->linear_program->CreateNewVariable();
396 lpi->linear_program->SetVariableBounds(
col, lb[i], ub[i]);
397 lpi->linear_program->SetObjectiveCoefficient(
col, obj[i]);
401 lpi->lp_modified_since_last_solve =
true;
413 assert( lpi != NULL );
414 assert( lpi->linear_program != NULL );
415 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->linear_program->num_variables() );
417 SCIPdebugMessage(
"deleting columns %d to %d.\n", firstcol, lastcol);
419 const ColIndex num_cols = lpi->linear_program->num_variables();
421 for (
int i = firstcol; i <= lastcol; ++i)
422 columns_to_delete[ColIndex(i)] =
true;
424 lpi->linear_program->DeleteColumns(columns_to_delete);
425 lpi->lp_modified_since_last_solve =
true;
438 assert( lpi != NULL );
439 assert( lpi->linear_program != NULL );
440 assert( dstat != NULL );
442 const ColIndex num_cols = lpi->linear_program->num_variables();
445 int num_deleted_columns = 0;
446 for (ColIndex
col(0);
col < num_cols; ++
col)
451 columns_to_delete[
col] =
true;
453 ++num_deleted_columns;
456 dstat[i] = new_index++;
458 SCIPdebugMessage(
"SCIPlpiDelColset: deleting %d columns.\n", num_deleted_columns);
459 lpi->linear_program->DeleteColumns(columns_to_delete);
460 lpi->lp_modified_since_last_solve =
true;
469 const SCIP_Real* lhs,
470 const SCIP_Real* rhs,
478 assert( lpi != NULL );
479 assert( lpi->linear_program != NULL );
480 assert( lhs != NULL );
481 assert( rhs != NULL );
482 assert( nnonz >= 0) ;
483 assert( nrows >= 0) ;
485 SCIPdebugMessage(
"adding %d rows with %d nonzeros.\n", nrows, nnonz);
490 assert( beg != NULL );
491 assert( ind != NULL );
492 assert( val != NULL );
497 const ColIndex num_cols = lpi->linear_program->num_variables();
498 for (
int j = 0; j < nnonz; ++j)
500 assert( val[j] != 0.0 );
501 assert( 0 <= ind[j] && ind[j] < num_cols.value() );
506 for (
int i = 0; i < nrows; ++i)
508 const RowIndex
row = lpi->linear_program->CreateNewConstraint();
509 lpi->linear_program->SetConstraintBounds(
row, lhs[i], rhs[i]);
510 const int end = (nnonz == 0 || i == nrows - 1) ? nnonz : beg[i + 1];
513 lpi->linear_program->SetCoefficient(
row, ColIndex(ind[nz]), val[nz]);
517 assert( nz == nnonz );
521 for (
int i = 0; i < nrows; ++i)
523 const RowIndex
row = lpi->linear_program->CreateNewConstraint();
524 lpi->linear_program->SetConstraintBounds(
row, lhs[i], rhs[i]);
528 lpi->lp_modified_since_last_solve =
true;
540 const RowIndex num_rows = lpi->linear_program->num_constraints();
541 const ColIndex num_cols = lpi->linear_program->num_variables();
545 if ( state.
statuses.
size() == num_cols.value() + num_rows.value() )
549 ColIndex new_size = num_cols;
550 for (RowIndex
row(0);
row < num_rows; ++
row)
552 if ( rows_to_delete[
row] )
557 lpi->solver->LoadStateForNextSolve(state);
560 lpi->linear_program->DeleteRows(rows_to_delete);
561 lpi->lp_modified_since_last_solve =
true;
571 assert( lpi != NULL );
572 assert( lpi->linear_program != NULL );
573 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->linear_program->num_constraints() );
575 const RowIndex num_rows = lpi->linear_program->num_constraints();
577 for (
int i = firstrow; i <= lastrow; ++i)
578 rows_to_delete[RowIndex(i)] =
true;
580 SCIPdebugMessage(
"deleting rows %d to %d.\n", firstrow, lastrow);
594 assert( lpi != NULL );
595 assert( lpi->linear_program != NULL );
597 const RowIndex num_rows = lpi->linear_program->num_constraints();
600 int num_deleted_rows = 0;
601 for (RowIndex
row(0);
row < num_rows; ++
row)
606 rows_to_delete[
row] =
true;
611 dstat[i] = new_index++;
614 SCIPdebugMessage(
"SCIPlpiDelRowset: deleting %d rows.\n", num_deleted_rows);
625 assert( lpi != NULL );
626 assert( lpi->linear_program != NULL );
628 SCIPdebugMessage(
"SCIPlpiClear\n");
630 lpi->linear_program->Clear();
631 lpi->lp_modified_since_last_solve =
true;
645 assert( lpi != NULL );
646 assert( lpi->linear_program != NULL );
647 assert( ncols == 0 || (ind != NULL && lb != NULL && ub != NULL) );
649 SCIPdebugMessage(
"changing %d bounds.\n", ncols);
653 for (
int i = 0; i < ncols; ++i)
655 SCIPdebugMessage(
" col %d: [%g,%g]\n", ind[i], lb[i], ub[i]);
659 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[i]);
664 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[i]);
668 lpi->linear_program->SetVariableBounds(ColIndex(ind[i]), lb[i], ub[i]);
670 lpi->lp_modified_since_last_solve =
true;
680 const SCIP_Real* lhs,
684 assert( lpi != NULL );
685 assert( lpi->linear_program != NULL );
690 SCIPdebugMessage(
"changing %d sides\n", nrows);
692 for (
int i = 0; i < nrows; ++i)
693 lpi->linear_program->SetConstraintBounds(RowIndex(ind[i]), lhs[i], rhs[i]);
695 lpi->lp_modified_since_last_solve =
true;
708 assert( lpi != NULL );
709 assert( lpi->linear_program != NULL );
710 assert( 0 <=
row && row < lpi->linear_program->num_constraints().value() );
711 assert( 0 <=
col && col < lpi->linear_program->num_variables().value() );
713 SCIPdebugMessage(
"Set coefficient (%d,%d) to %f.\n",
row,
col, newval);
714 lpi->linear_program->CleanUp();
715 assert( lpi->linear_program->IsCleanedUp() );
716 lpi->linear_program->SetCoefficient(RowIndex(
row), ColIndex(
col), newval);
718 lpi->lp_modified_since_last_solve =
true;
729 assert( lpi != NULL);
730 assert( lpi->linear_program != NULL);
732 SCIPdebugMessage(
"changing objective sense to %d\n", objsen);
736 case SCIP_OBJSEN_MAXIMIZE:
737 lpi->linear_program->SetMaximizationProblem(
true);
739 case SCIP_OBJSEN_MINIMIZE:
740 lpi->linear_program->SetMaximizationProblem(
false);
743 lpi->lp_modified_since_last_solve =
true;
756 assert( lpi != NULL );
757 assert( lpi->linear_program != NULL );
758 assert( ind != NULL );
759 assert( obj != NULL );
761 SCIPdebugMessage(
"changing %d objective values\n", ncols);
763 for (
int i = 0; i < ncols; ++i)
764 lpi->linear_program->SetObjectiveCoefficient(ColIndex(ind[i]), obj[i]);
766 lpi->lp_modified_since_last_solve =
true;
785 assert( lpi != NULL );
786 assert( lpi->linear_program != NULL );
788 SCIPdebugMessage(
"Scale row %d by %f.\n",
row, scaleval);
791 ColIndex num_cols = lpi->linear_program->num_variables();
793 SCIP_ALLOC( BMSallocMemoryArray(&inds, num_cols.value()) );
794 SCIP_ALLOC( BMSallocMemoryArray(&vals, num_cols.value()) );
800 for (
int j = 0; j < nnonz; ++j)
804 BMSfreeMemoryArray(&vals);
805 BMSfreeMemoryArray(&inds);
810 else if ( scaleval < 0.0 )
815 else if ( scaleval < 0.0 )
818 if ( scaleval > 0.0 )
827 lpi->lp_modified_since_last_solve =
true;
849 assert( lpi != NULL );
850 assert( lpi->linear_program != NULL );
852 SCIPdebugMessage(
"Scale column %d by %f.\n",
col, scaleval);
855 RowIndex num_rows = lpi->linear_program->num_constraints();
857 SCIP_ALLOC( BMSallocMemoryArray(&inds, num_rows.value()) );
858 SCIP_ALLOC( BMSallocMemoryArray(&vals, num_rows.value()) );
864 for (
int j = 0; j < nnonz; ++j)
868 BMSfreeMemoryArray(&vals);
869 BMSfreeMemoryArray(&inds);
879 else if ( scaleval < 0.0 )
884 else if ( scaleval < 0.0 )
887 if ( scaleval > 0.0 )
918 assert( lpi != NULL );
919 assert( lpi->linear_program != NULL );
920 assert( nrows != NULL );
922 SCIPdebugMessage(
"getting number of rows.\n");
924 *nrows = lpi->linear_program->num_constraints().value();
935 assert( lpi != NULL );
936 assert( lpi->linear_program != NULL );
937 assert( ncols != NULL );
939 SCIPdebugMessage(
"getting number of columns.\n");
941 *ncols = lpi->linear_program->num_variables().value();
952 assert( lpi != NULL );
953 assert( lpi->linear_program != NULL );
954 assert( objsen != NULL );
956 SCIPdebugMessage(
"getting objective sense.\n");
958 *objsen = lpi->linear_program->IsMaximizationProblem() ? SCIP_OBJSEN_MAXIMIZE : SCIP_OBJSEN_MINIMIZE;
969 assert( lpi != NULL );
970 assert( lpi->linear_program != NULL );
971 assert( nnonz != NULL );
973 SCIPdebugMessage(
"getting number of non-zeros.\n");
975 *nnonz = (int) lpi->linear_program->num_entries().value();
996 assert( lpi != NULL );
997 assert( lpi->linear_program != NULL );
998 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->linear_program->num_variables() );
999 assert( (lb != NULL && ub != NULL) || (lb == NULL && ub == NULL) );
1000 assert( (nnonz != NULL && beg != NULL && ind != NULL && val != NULL) || (nnonz == NULL && beg == NULL && ind == NULL && val == NULL) );
1002 const DenseRow& tmplb = lpi->linear_program->variable_lower_bounds();
1003 const DenseRow& tmpub = lpi->linear_program->variable_upper_bounds();
1005 if ( nnonz != NULL )
1007 assert( beg != NULL );
1008 assert( ind != NULL );
1009 assert( val != NULL );
1013 for (ColIndex
col(firstcol);
col <= ColIndex(lastcol); ++
col, ++
index)
1020 beg[
index] = *nnonz;
1021 const SparseColumn& column = lpi->linear_program->GetSparseColumn(
col);
1022 for (
const SparseColumn::Entry& entry : column)
1024 const RowIndex
row = entry.row();
1025 ind[*nnonz] =
row.value();
1026 val[*nnonz] = entry.coefficient();
1034 for (ColIndex
col(firstcol);
col <= ColIndex(lastcol); ++
col, ++
index)
1062 assert( lpi != NULL );
1063 assert( lpi->linear_program != NULL );
1064 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->linear_program->num_constraints() );
1065 assert( (lhs == NULL && rhs == NULL) || (rhs != NULL && lhs != NULL) );
1066 assert( (nnonz != NULL && beg != NULL && ind != NULL && val != NULL) || (nnonz == NULL && beg == NULL && ind == NULL && val == NULL) );
1068 const DenseColumn& tmplhs = lpi->linear_program->constraint_lower_bounds();
1069 const DenseColumn& tmprhs = lpi->linear_program->constraint_upper_bounds();
1071 if ( nnonz != NULL )
1073 assert( beg != NULL );
1074 assert( ind != NULL );
1075 assert( val != NULL );
1077 const SparseMatrix& matrixtrans = lpi->linear_program->GetTransposeSparseMatrix();
1081 for (RowIndex
row(firstrow);
row <= RowIndex(lastrow); ++
row, ++
index)
1088 beg[
index] = *nnonz;
1090 for (
const SparseColumn::Entry& entry : column)
1092 const RowIndex rowidx = entry.row();
1093 ind[*nnonz] = rowidx.value();
1094 val[*nnonz] = entry.coefficient();
1102 for (RowIndex
row(firstrow);
row <= RowIndex(lastrow); ++
row, ++
index)
1121 int namestoragesize,
1125 assert( lpi != NULL );
1126 assert( lpi->linear_program != NULL );
1127 assert( colnames != NULL || namestoragesize == 0 );
1128 assert( namestorage != NULL || namestoragesize == 0 );
1129 assert( namestoragesize >= 0 );
1130 assert( storageleft != NULL );
1131 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->linear_program->num_variables() );
1133 SCIPerrorMessage(
"SCIPlpiGetColNames() has not been implemented yet.\n");
1135 return SCIP_NOTIMPLEMENTED;
1145 int namestoragesize,
1149 assert( lpi != NULL );
1150 assert( lpi->linear_program != NULL );
1151 assert( rownames != NULL || namestoragesize == 0 );
1152 assert( namestorage != NULL || namestoragesize == 0 );
1153 assert( namestoragesize >= 0 );
1154 assert( storageleft != NULL );
1155 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->linear_program->num_constraints() );
1157 SCIPerrorMessage(
"SCIPlpiGetRowNames() has not been implemented yet.\n");
1159 return SCIP_NOTIMPLEMENTED;
1170 assert( lpi != NULL );
1171 assert( lpi->linear_program != NULL );
1172 assert( firstcol <= lastcol );
1173 assert( vals != NULL );
1175 SCIPdebugMessage(
"getting objective values %d to %d\n", firstcol, lastcol);
1178 for (ColIndex
col(firstcol);
col <= ColIndex(lastcol); ++
col)
1180 vals[
index] = lpi->linear_program->objective_coefficients()[
col];
1196 assert( lpi != NULL );
1197 assert( lpi->linear_program != NULL );
1198 assert( firstcol <= lastcol );
1200 SCIPdebugMessage(
"getting bounds %d to %d\n", firstcol, lastcol);
1203 for (ColIndex
col(firstcol);
col <= ColIndex(lastcol); ++
col)
1206 lbs[
index] = lpi->linear_program->variable_lower_bounds()[
col];
1209 ubs[
index] = lpi->linear_program->variable_upper_bounds()[
col];
1226 assert( lpi != NULL );
1227 assert( lpi->linear_program != NULL );
1228 assert( firstrow <= lastrow );
1230 SCIPdebugMessage(
"getting row sides %d to %d\n", firstrow, lastrow);
1233 for (RowIndex
row(firstrow);
row <= RowIndex(lastrow); ++
row)
1236 lhss[
index] = lpi->linear_program->constraint_lower_bounds()[
row];
1239 rhss[
index] = lpi->linear_program->constraint_upper_bounds()[
row];
1255 assert( lpi != NULL );
1256 assert( lpi->linear_program != NULL );
1257 assert( val != NULL );
1260 const SparseMatrix& matrix = lpi->linear_program->GetSparseMatrix();
1284 if ( ! lpi->lp_modified_since_last_solve )
1287 lpi->scaled_lp->PopulateFromLinearProgram(*lpi->linear_program);
1288 lpi->scaled_lp->AddSlackVariablesWhereNecessary(
false);
1292 if ( lpi->parameters->use_scaling() )
1293 lpi->scaler->Scale(lpi->scaled_lp);
1295 lpi->scaler->Clear();
1304 assert( lpi != NULL );
1305 assert( lpi->solver != NULL );
1306 assert( lpi->linear_program != NULL );
1308#if UNSCALEDFEAS_CHECK == 1
1310 const ColIndex num_cols = lpi->linear_program->num_variables();
1312 for (ColIndex
col = ColIndex(0);
col < num_cols; ++
col)
1313 unscaledsol[
col] = lpi->scaler->UnscaleVariableValue(
col, lpi->solver->GetVariableValue(
col));
1316 const double feastol = lpi->parameters->primal_feasibility_tolerance();
1317 return lpi->linear_program->SolutionIsLPFeasible(unscaledsol, feastol);
1319#elif UNSCALEDFEAS_CHECK == 2
1320 const double feastol = lpi->parameters->primal_feasibility_tolerance();
1323 const ColIndex num_cols = lpi->linear_program->num_variables();
1324 for (ColIndex
col = ColIndex(0);
col < num_cols; ++
col)
1326 const Fractional val = lpi->scaler->UnscaleVariableValue(
col, lpi->solver->GetVariableValue(
col));
1327 const Fractional lb = lpi->linear_program->variable_lower_bounds()[
col];
1328 if ( val < lb - feastol )
1330 const Fractional ub = lpi->linear_program->variable_upper_bounds()[
col];
1331 if ( val > ub + feastol )
1336 const RowIndex num_rows = lpi->linear_program->num_constraints();
1337 for (RowIndex
row(0);
row < num_rows; ++
row)
1339 const Fractional val = lpi->scaler->UnscaleConstraintActivity(
row, lpi->solver->GetConstraintActivity(
row));
1340 const Fractional lhs = lpi->linear_program->constraint_lower_bounds()[
row];
1341 if ( val < lhs - feastol )
1343 const Fractional rhs = lpi->linear_program->constraint_upper_bounds()[
row];
1344 if ( val > rhs + feastol )
1360 assert( lpi != NULL );
1361 assert( lpi->solver != NULL );
1362 assert( lpi->parameters != NULL );
1366 lpi->solver->SetParameters(*(lpi->parameters));
1367 lpi->lp_time_limit_was_reached =
false;
1370 if ( lpi->from_scratch )
1371 lpi->solver->ClearStateForNextSolve();
1373 if ( ! lpi->solver->Solve(*(lpi->scaled_lp),
time_limit.get()).ok() )
1375 return SCIP_LPERROR;
1377 lpi->lp_time_limit_was_reached =
time_limit->LimitReached();
1379 lpi->niterations += (SCIP_Longint) lpi->solver->GetNumberOfIterations();
1381 lpi->niterations = (SCIP_Longint) lpi->solver->GetNumberOfIterations();
1383 SCIPdebugMessage(
"status=%s obj=%f iter=%ld.\n",
GetProblemStatusString(lpi->solver->GetProblemStatus()).c_str(),
1384 lpi->solver->GetObjectiveValue(), lpi->solver->GetNumberOfIterations());
1391 SCIPdebugMessage(
"Solution not feasible w.r.t. absolute tolerance %g -> reoptimize.\n", lpi->parameters->primal_feasibility_tolerance());
1394 lpi->parameters->set_use_scaling(
false);
1395 lpi->lp_modified_since_last_solve =
true;
1397 lpi->parameters->set_use_scaling(
true);
1401 SCIPdebugMessage(
"Solution still not feasible after turning off scaling.\n");
1406 lpi->lp_modified_since_last_solve =
false;
1416 assert( lpi != NULL );
1417 assert( lpi->solver != NULL );
1418 assert( lpi->linear_program != NULL );
1419 assert( lpi->parameters != NULL );
1421 SCIPdebugMessage(
"SCIPlpiSolvePrimal: %d rows, %d cols.\n", lpi->linear_program->num_constraints().value(), lpi->linear_program->num_variables().value());
1422 std::unique_ptr<TimeLimit>
time_limit = TimeLimit::FromParameters(*lpi->parameters);
1423 lpi->niterations = 0;
1425 lpi->parameters->set_use_dual_simplex(
false);
1434 assert( lpi != NULL );
1435 assert( lpi->solver != NULL );
1436 assert( lpi->linear_program != NULL );
1437 assert( lpi->parameters != NULL );
1439 SCIPdebugMessage(
"SCIPlpiSolveDual: %d rows, %d cols.\n", lpi->linear_program->num_constraints().value(), lpi->linear_program->num_variables().value());
1440 std::unique_ptr<TimeLimit>
time_limit = TimeLimit::FromParameters(*lpi->parameters);
1441 lpi->niterations = 0;
1443 lpi->parameters->set_use_dual_simplex(
true);
1453 assert( lpi != NULL );
1454 assert( lpi->solver != NULL );
1455 assert( lpi->linear_program != NULL );
1456 assert( lpi->parameters != NULL );
1458 SCIPerrorMessage(
"SCIPlpiSolveBarrier - Not supported.\n");
1460 return SCIP_NOTIMPLEMENTED;
1468 assert( lpi != NULL );
1469 assert( lpi->linear_program != NULL );
1470 assert( lpi->solver != NULL );
1483 assert( lpi != NULL );
1484 assert( lpi->linear_program != NULL );
1485 assert( lpi->solver != NULL );
1509 SCIP_Bool* downvalid,
1516 assert( lpi != NULL );
1517 assert( lpi->scaled_lp != NULL );
1518 assert( down != NULL );
1519 assert( up != NULL );
1520 assert( downvalid != NULL );
1521 assert( upvalid != NULL );
1523 SCIPdebugMessage(
"calling strongbranching on variable %d (%d iterations)\n", col_index, itlim);
1526 const ColIndex
col(col_index);
1527 const Fractional lb = lpi->scaled_lp->variable_lower_bounds()[
col];
1528 const Fractional ub = lpi->scaled_lp->variable_upper_bounds()[
col];
1529 const double value = psol * lpi->scaler->VariableScalingFactor(
col);
1534 int num_iterations = 0;
1535 lpi->parameters->set_use_dual_simplex(
true);
1536 lpi->solver->SetParameters(*(lpi->parameters));
1537 const Fractional eps = lpi->parameters->primal_feasibility_tolerance();
1539 std::unique_ptr<TimeLimit>
time_limit = TimeLimit::FromParameters(*lpi->parameters);
1543 if ( newub >= lb - 0.5 )
1545 lpi->scaled_lp->SetVariableBounds(
col, lb, newub);
1547 if ( lpi->solver->Solve(*(lpi->scaled_lp),
time_limit.get()).ok() )
1549 num_iterations += (int) lpi->solver->GetNumberOfIterations();
1550 *down = lpi->solver->GetObjectiveValue();
1551 *downvalid =
IsDualBoundValid(lpi->solver->GetProblemStatus()) ? TRUE : FALSE;
1553 SCIPdebugMessage(
"down: itlim=%d col=%d [%f,%f] obj=%f status=%d iter=%ld.\n", itlim, col_index, lb, EPSCEIL(
value - 1.0, eps),
1554 lpi->solver->GetObjectiveValue(), (
int) lpi->solver->GetProblemStatus(), lpi->solver->GetNumberOfIterations());
1558 SCIPerrorMessage(
"error during solve");
1565 if ( lpi->linear_program->IsMaximizationProblem() )
1566 *down = lpi->parameters->objective_lower_limit();
1568 *down = lpi->parameters->objective_upper_limit();
1574 if ( newlb <= ub + 0.5 )
1576 lpi->scaled_lp->SetVariableBounds(
col, newlb, ub);
1578 if ( lpi->solver->Solve(*(lpi->scaled_lp),
time_limit.get()).ok() )
1580 num_iterations += (int) lpi->solver->GetNumberOfIterations();
1581 *up = lpi->solver->GetObjectiveValue();
1582 *upvalid =
IsDualBoundValid(lpi->solver->GetProblemStatus()) ? TRUE : FALSE;
1584 SCIPdebugMessage(
"up: itlim=%d col=%d [%f,%f] obj=%f status=%d iter=%ld.\n", itlim, col_index, EPSFLOOR(
value + 1.0, eps), ub,
1585 lpi->solver->GetObjectiveValue(), (
int) lpi->solver->GetProblemStatus(), lpi->solver->GetNumberOfIterations());
1589 SCIPerrorMessage(
"error during solve");
1596 if (lpi->linear_program->IsMaximizationProblem())
1597 *up = lpi->parameters->objective_lower_limit();
1599 *up = lpi->parameters->objective_upper_limit();
1604 lpi->scaled_lp->SetVariableBounds(
col, lb, ub);
1606 *iter = num_iterations;
1619 SCIP_Bool* downvalid,
1626 assert( lpi != NULL );
1627 assert( lpi->scaled_lp != NULL );
1628 assert( down != NULL );
1629 assert( up != NULL );
1630 assert( downvalid != NULL );
1631 assert( upvalid != NULL );
1633 SCIPdebugMessage(
"calling strongbranching on fractional variable %d (%d iterations)\n", col_index, itlim);
1635 SCIP_CALL(
strongbranch(lpi, col_index, psol, itlim, down, up, downvalid, upvalid, iter) );
1649 SCIP_Bool* downvalid,
1656 assert( lpi != NULL );
1657 assert( lpi->linear_program != NULL );
1658 assert( cols != NULL );
1659 assert( psols != NULL );
1660 assert( down != NULL) ;
1661 assert( up != NULL );
1662 assert( downvalid != NULL );
1663 assert( upvalid != NULL );
1665 SCIPerrorMessage(
"SCIPlpiStrongbranchesFrac - not implemented.\n");
1667 return SCIP_NOTIMPLEMENTED;
1678 SCIP_Bool* downvalid,
1685 assert( lpi != NULL );
1686 assert( lpi->linear_program != NULL );
1687 assert( down != NULL );
1688 assert( up != NULL );
1689 assert( downvalid != NULL );
1690 assert( upvalid != NULL );
1692 SCIP_CALL(
strongbranch(lpi,
col, psol, itlim, down, up, downvalid, upvalid, iter) );
1706 SCIP_Bool* downvalid,
1713 assert( lpi != NULL );
1714 assert( lpi->linear_program != NULL );
1715 assert( cols != NULL );
1716 assert( psols != NULL );
1717 assert( down != NULL) ;
1718 assert( up != NULL );
1719 assert( downvalid != NULL );
1720 assert( upvalid != NULL );
1722 SCIPerrorMessage(
"SCIPlpiStrongbranchesInt - not implemented.\n");
1724 return SCIP_NOTIMPLEMENTED;
1743 assert( lpi != NULL );
1746 return ( ! lpi->lp_modified_since_last_solve );
1761 SCIP_Bool* primalfeasible,
1762 SCIP_Bool* dualfeasible
1765 assert( lpi != NULL );
1766 assert( lpi->solver != NULL );
1767 assert( primalfeasible != NULL );
1768 assert( dualfeasible != NULL );
1774 SCIPdebugMessage(
"SCIPlpiGetSolFeasibility primal:%d dual:%d\n", *primalfeasible, *dualfeasible);
1786 assert( lpi != NULL );
1787 assert( lpi->solver != NULL );
1789 return lpi->solver->GetProblemStatus() == ProblemStatus::PRIMAL_UNBOUNDED;
1799 assert( lpi != NULL );
1800 assert( lpi->solver != NULL );
1802 return lpi->solver->GetProblemStatus() == ProblemStatus::PRIMAL_UNBOUNDED;
1810 assert( lpi != NULL );
1811 assert( lpi->solver != NULL );
1813 return lpi->solver->GetProblemStatus() == ProblemStatus::PRIMAL_UNBOUNDED;
1821 assert( lpi != NULL );
1822 assert( lpi->solver != NULL );
1826 return status == ProblemStatus::DUAL_UNBOUNDED ||
status == ProblemStatus::PRIMAL_INFEASIBLE;
1834 assert( lpi != NULL );
1835 assert( lpi->solver != NULL );
1849 assert( lpi != NULL );
1850 assert( lpi->solver != NULL );
1854 return status == ProblemStatus::DUAL_UNBOUNDED;
1864 assert( lpi != NULL );
1865 assert( lpi->solver != NULL );
1869 return status == ProblemStatus::DUAL_UNBOUNDED;
1877 assert( lpi != NULL );
1878 assert( lpi->solver != NULL );
1881 return status == ProblemStatus::DUAL_UNBOUNDED;
1889 assert( lpi != NULL );
1890 assert( lpi->solver != NULL );
1893 return status == ProblemStatus::PRIMAL_UNBOUNDED ||
status == ProblemStatus::DUAL_INFEASIBLE;
1901 assert( lpi != NULL );
1902 assert( lpi->solver != NULL );
1914 assert( lpi != NULL );
1915 assert( lpi->solver != NULL );
1931 assert( lpi != NULL );
1932 assert( lpi->solver != NULL );
1938 if ( (
status == ProblemStatus::PRIMAL_FEASIBLE ||
status == ProblemStatus::DUAL_FEASIBLE) &&
1941 SCIPdebugMessage(
"OPTIMAL not reached and no limit: unstable.\n");
1945 if (
status == ProblemStatus::ABNORMAL ||
status == ProblemStatus::INVALID_PROBLEM ||
status == ProblemStatus::IMPRECISE )
1952 SCIP_RETCODE retcode;
1956 if ( retcode != SCIP_OKAY )
1958 assert( kappa != SCIP_INVALID );
1960 if ( kappa > lpi->conditionlimit )
1972 assert( lpi != NULL );
1973 assert( lpi->solver != NULL );
1975 return lpi->solver->objective_limit_reached();
1983 assert( lpi != NULL );
1984 assert( lpi->solver != NULL );
1985 assert( lpi->niterations >= (
int) lpi->solver->GetNumberOfIterations() );
1987 int maxiter = (int) lpi->parameters->max_number_of_iterations();
1988 return maxiter >= 0 && lpi->niterations >= maxiter;
1996 assert( lpi != NULL );
1997 assert( lpi->solver != NULL );
1999 return lpi->lp_time_limit_was_reached;
2007 assert( lpi != NULL );
2008 assert( lpi->solver != NULL );
2010 return static_cast<int>(lpi->solver->GetProblemStatus());
2019 assert( lpi != NULL );
2020 assert( lpi->solver != NULL );
2021 assert( success != NULL );
2034 assert( lpi != NULL );
2035 assert( lpi->solver != NULL );
2036 assert( objval != NULL );
2038 *objval = lpi->solver->GetObjectiveValue();
2053 SCIP_Real* activity,
2057 assert( lpi != NULL );
2058 assert( lpi->solver != NULL );
2060 SCIPdebugMessage(
"SCIPlpiGetSol\n");
2061 if ( objval != NULL )
2062 *objval = lpi->solver->GetObjectiveValue();
2064 const ColIndex num_cols = lpi->linear_program->num_variables();
2065 for (ColIndex
col(0);
col < num_cols; ++
col)
2067 int i =
col.value();
2069 if ( primsol != NULL )
2070 primsol[i] = lpi->scaler->UnscaleVariableValue(
col, lpi->solver->GetVariableValue(
col));
2072 if ( redcost != NULL )
2073 redcost[i] = lpi->scaler->UnscaleReducedCost(
col, lpi->solver->GetReducedCost(
col));
2076 const RowIndex num_rows = lpi->linear_program->num_constraints();
2077 for (RowIndex
row(0);
row < num_rows; ++
row)
2079 int j =
row.value();
2081 if ( dualsol != NULL )
2082 dualsol[j] = lpi->scaler->UnscaleDualValue(
row, lpi->solver->GetDualValue(
row));
2084 if ( activity != NULL )
2085 activity[j] = lpi->scaler->UnscaleConstraintActivity(
row, lpi->solver->GetConstraintActivity(
row));
2097 assert( lpi != NULL );
2098 assert( lpi->solver != NULL );
2099 assert( ray != NULL );
2101 SCIPdebugMessage(
"SCIPlpiGetPrimalRay\n");
2103 const ColIndex num_cols = lpi->linear_program->num_variables();
2104 const DenseRow& primal_ray = lpi->solver->GetPrimalRay();
2105 for (ColIndex
col(0);
col < num_cols; ++
col)
2106 ray[
col.value()] = lpi->scaler->UnscaleVariableValue(
col, primal_ray[
col]);
2114 SCIP_Real* dualfarkas
2117 assert( lpi != NULL );
2118 assert( lpi->solver != NULL );
2119 assert( dualfarkas != NULL );
2121 SCIPdebugMessage(
"SCIPlpiGetDualfarkas\n");
2123 const RowIndex num_rows = lpi->linear_program->num_constraints();
2124 const DenseColumn& dual_ray = lpi->solver->GetDualRay();
2125 for (RowIndex
row(0);
row < num_rows; ++
row)
2126 dualfarkas[
row.value()] = -lpi->scaler->UnscaleDualValue(
row, dual_ray[
row]);
2137 assert( lpi != NULL );
2138 assert( lpi->solver != NULL );
2139 assert( iterations != NULL );
2141 *iterations = (int) lpi->niterations;
2153 SCIP_LPSOLQUALITY qualityindicator,
2157 assert( lpi != NULL );
2158 assert( lpi->solver != NULL );
2159 assert( quality != NULL );
2161 SCIPdebugMessage(
"Requesting solution quality: quality %d\n", qualityindicator);
2163 switch ( qualityindicator )
2165 case SCIP_LPSOLQUALITY_ESTIMCONDITION:
2166 *quality = lpi->solver->GetBasisFactorization().ComputeInfinityNormConditionNumber();
2169 case SCIP_LPSOLQUALITY_EXACTCONDITION:
2170 *quality = lpi->solver->GetBasisFactorization().ComputeInfinityNormConditionNumberUpperBound();
2174 SCIPerrorMessage(
"Solution quality %d unknown.\n", qualityindicator);
2175 return SCIP_INVALIDDATA;
2202 case VariableStatus::BASIC:
2203 return SCIP_BASESTAT_BASIC;
2204 case VariableStatus::AT_UPPER_BOUND:
2205 return SCIP_BASESTAT_UPPER;
2206 case VariableStatus::AT_LOWER_BOUND:
2207 return SCIP_BASESTAT_LOWER;
2208 case VariableStatus::FREE:
2209 return SCIP_BASESTAT_ZERO;
2210 case VariableStatus::FIXED_VALUE:
2211 return rc > 0.0 ? SCIP_BASESTAT_LOWER : SCIP_BASESTAT_UPPER;
2213 SCIPerrorMessage(
"invalid Glop basis status.\n");
2227 case ConstraintStatus::BASIC:
2228 return SCIP_BASESTAT_BASIC;
2229 case ConstraintStatus::AT_UPPER_BOUND:
2230 return SCIP_BASESTAT_UPPER;
2231 case ConstraintStatus::AT_LOWER_BOUND:
2232 return SCIP_BASESTAT_LOWER;
2233 case ConstraintStatus::FREE:
2234 return SCIP_BASESTAT_ZERO;
2235 case ConstraintStatus::FIXED_VALUE:
2236 return dual > 0.0 ? SCIP_BASESTAT_LOWER : SCIP_BASESTAT_UPPER;
2238 SCIPerrorMessage(
"invalid Glop basis status.\n");
2251 case SCIP_BASESTAT_BASIC:
2252 return VariableStatus::BASIC;
2253 case SCIP_BASESTAT_UPPER:
2254 return VariableStatus::AT_UPPER_BOUND;
2255 case SCIP_BASESTAT_LOWER:
2256 return VariableStatus::AT_LOWER_BOUND;
2257 case SCIP_BASESTAT_ZERO:
2258 return VariableStatus::FREE;
2260 SCIPerrorMessage(
"invalid SCIP basis status.\n");
2276 case SCIP_BASESTAT_BASIC:
2277 return VariableStatus::BASIC;
2278 case SCIP_BASESTAT_UPPER:
2279 return VariableStatus::AT_LOWER_BOUND;
2280 case SCIP_BASESTAT_LOWER:
2281 return VariableStatus::AT_UPPER_BOUND;
2282 case SCIP_BASESTAT_ZERO:
2283 return VariableStatus::FREE;
2285 SCIPerrorMessage(
"invalid SCIP basis status.\n");
2297 SCIPdebugMessage(
"SCIPlpiGetBase\n");
2301 if ( cstat != NULL )
2303 const ColIndex num_cols = lpi->linear_program->num_variables();
2304 for (ColIndex
col(0);
col < num_cols; ++
col)
2306 int i =
col.value();
2311 if ( rstat != NULL )
2313 const RowIndex num_rows = lpi->linear_program->num_constraints();
2314 for (RowIndex
row(0);
row < num_rows; ++
row)
2316 int i =
row.value();
2331 assert( lpi != NULL );
2332 assert( lpi->linear_program != NULL );
2333 assert( lpi->solver != NULL );
2335 const ColIndex num_cols = lpi->linear_program->num_variables();
2336 const RowIndex num_rows = lpi->linear_program->num_constraints();
2338 assert( cstat != NULL || num_cols == 0 );
2339 assert( rstat != NULL || num_rows == 0 );
2341 SCIPdebugMessage(
"SCIPlpiSetBase\n");
2344 state.
statuses.
reserve(ColIndex(num_cols.value() + num_rows.value()));
2346 for (ColIndex
col(0);
col < num_cols; ++
col)
2349 for (RowIndex
row(0);
row < num_rows; ++
row)
2352 lpi->solver->LoadStateForNextSolve(state);
2363 assert( lpi != NULL );
2364 assert( lpi->linear_program != NULL );
2365 assert( lpi->solver != NULL );
2366 assert( bind != NULL );
2368 SCIPdebugMessage(
"SCIPlpiGetBasisInd\n");
2371 const ColIndex num_cols = lpi->linear_program->num_variables();
2372 const RowIndex num_rows = lpi->linear_program->num_constraints();
2373 for (RowIndex
row(0);
row < num_rows; ++
row)
2375 const ColIndex
col = lpi->solver->GetBasis(
row);
2377 bind[
row.value()] =
col.value();
2380 assert(
col < num_cols.value() + num_rows.value() );
2381 bind[
row.value()] = -1 - (
col - num_cols).
value();
2403 assert( lpi != NULL );
2404 assert( lpi->linear_program != NULL );
2405 assert( lpi->solver != NULL );
2406 assert( lpi->scaler != NULL );
2407 assert(
coef != NULL );
2409 lpi->solver->GetBasisFactorization().LeftSolveForUnitRow(ColIndex(r), lpi->tmp_row);
2410 lpi->scaler->UnscaleUnitRowLeftSolve(lpi->solver->GetBasis(RowIndex(r)), lpi->tmp_row);
2412 const ColIndex size = lpi->tmp_row->values.size();
2413 assert( size.value() == lpi->linear_program->num_constraints() );
2416 if ( ninds != NULL && inds != NULL )
2421 if ( ! lpi->tmp_row->non_zeros.empty() )
2426 int idx = (*iter).column().value();
2427 assert( 0 <= idx && idx < lpi->linear_program->num_constraints() );
2428 coef[idx] = (*iter).coefficient();
2429 inds[(*ninds)++] = idx;
2435 const Fractional eps = lpi->parameters->primal_feasibility_tolerance();
2436 for (ColIndex
col(0);
col < size; ++
col)
2438 SCIP_Real val = (*lpi->tmp_row)[
col];
2439 if ( fabs(val) >= eps )
2442 inds[(*ninds)++] =
col.value();
2450 for (ColIndex
col(0);
col < size; ++
col)
2453 if ( ninds != NULL )
2478 assert( lpi != NULL );
2479 assert( lpi->linear_program != NULL );
2480 assert( lpi->solver != NULL );
2481 assert( lpi->scaler != NULL );
2482 assert(
coef != NULL );
2485 const ColIndex
col(c);
2486 const RowIndex num_rows = lpi->linear_program->num_constraints();
2489 if ( ninds != NULL && inds != NULL )
2491 const Fractional eps = lpi->parameters->primal_feasibility_tolerance();
2494 for (
int row = 0;
row < num_rows; ++
row)
2496 lpi->solver->GetBasisFactorization().LeftSolveForUnitRow(ColIndex(
row), lpi->tmp_row);
2497 lpi->scaler->UnscaleUnitRowLeftSolve(lpi->solver->GetBasis(RowIndex(
row)), lpi->tmp_row);
2499 SCIP_Real val = (*lpi->tmp_row)[
col];
2500 if ( fabs(val) >= eps )
2503 inds[(*ninds)++] =
row;
2510 for (
int row = 0;
row < num_rows; ++
row)
2512 lpi->solver->GetBasisFactorization().LeftSolveForUnitRow(ColIndex(
row), lpi->tmp_row);
2513 lpi->scaler->UnscaleUnitRowLeftSolve(lpi->solver->GetBasis(RowIndex(
row)), lpi->tmp_row);
2517 if ( ninds != NULL )
2532 const SCIP_Real* binvrow,
2539 assert( lpi != NULL );
2540 assert( lpi->linear_program != NULL );
2541 assert( lpi->solver != NULL );
2542 assert( lpi->scaler != NULL );
2543 assert(
coef != NULL );
2546 lpi->solver->GetBasisFactorization().LeftSolveForUnitRow(ColIndex(r), lpi->tmp_row);
2547 lpi->scaler->UnscaleUnitRowLeftSolve(lpi->solver->GetBasis(RowIndex(r)), lpi->tmp_row);
2549 const ColIndex num_cols = lpi->linear_program->num_variables();
2552 if ( ninds != NULL && inds != NULL )
2554 const Fractional eps = lpi->parameters->primal_feasibility_tolerance();
2557 for (ColIndex
col(0);
col < num_cols; ++
col)
2560 if ( fabs(val) >= eps )
2563 inds[(*ninds)++] =
col.value();
2570 for (ColIndex
col(0);
col < num_cols; ++
col)
2573 if ( ninds != NULL )
2594 assert( lpi != NULL );
2595 assert( lpi->linear_program != NULL );
2596 assert( lpi->solver != NULL );
2597 assert( lpi->scaler != NULL );
2598 assert(
coef != NULL );
2600 lpi->solver->GetBasisFactorization().RightSolveForProblemColumn(ColIndex(c), lpi->tmp_column);
2601 lpi->scaler->UnscaleColumnRightSolve(lpi->solver->GetBasisVector(), ColIndex(c), lpi->tmp_column);
2603 const RowIndex num_rows = lpi->tmp_column->values.size();
2606 if ( ninds != NULL && inds != NULL )
2611 if ( ! lpi->tmp_column->non_zeros.empty() )
2616 int idx = (*iter).row().value();
2617 assert( 0 <= idx && idx < num_rows );
2618 coef[idx] = (*iter).coefficient();
2619 inds[(*ninds)++] = idx;
2625 const Fractional eps = lpi->parameters->primal_feasibility_tolerance();
2626 for (RowIndex
row(0);
row < num_rows; ++
row)
2628 SCIP_Real val = (*lpi->tmp_column)[
row];
2629 if ( fabs(val) > eps )
2632 inds[(*ninds)++] =
row.value();
2640 for (RowIndex
row(0);
row < num_rows; ++
row)
2643 if ( ninds != NULL )
2672 SCIP_LPISTATE** lpistate
2675 assert( lpi != NULL );
2676 assert( lpi->solver != NULL );
2677 assert( lpistate != NULL );
2679 *lpistate =
static_cast<SCIP_LPISTATE*
>(
new BasisState(lpi->solver->GetState()));
2690 const SCIP_LPISTATE* lpistate
2693 assert( lpi != NULL );
2694 assert( lpi->solver != NULL );
2695 assert( lpistate != NULL );
2697 lpi->solver->LoadStateForNextSolve(*lpistate);
2707 assert( lpi != NULL );
2708 assert( lpi->solver != NULL );
2710 lpi->solver->ClearStateForNextSolve();
2719 SCIP_LPISTATE** lpistate
2722 assert( lpi != NULL );
2723 assert( lpi->solver != NULL );
2724 assert( lpistate != NULL );
2735 SCIP_LPISTATE* lpistate
2738 assert( lpi != NULL );
2739 assert( lpi->solver != NULL );
2741 return lpistate != NULL;
2750 assert( lpi != NULL );
2751 assert( lpi->solver != NULL );
2753 SCIPerrorMessage(
"SCIPlpiReadState - not implemented.\n");
2755 return SCIP_NOTIMPLEMENTED;
2764 assert( lpi != NULL );
2765 assert( lpi->solver != NULL );
2767 SCIPerrorMessage(
"SCIPlpiWriteState - not implemented.\n");
2769 return SCIP_NOTIMPLEMENTED;
2795 SCIP_LPINORMS** lpinorms
2798 assert( lpi != NULL );
2799 assert( blkmem != NULL );
2800 assert( lpi->solver != NULL );
2801 assert( lpinorms != NULL );
2812 const SCIP_LPINORMS* lpinorms
2815 assert( lpi != NULL );
2816 assert( blkmem != NULL );
2817 assert( lpi->solver != NULL );
2818 assert( lpinorms != NULL );
2827 SCIP_LPINORMS** lpinorms
2830 assert( lpi != NULL );
2831 assert( blkmem != NULL );
2832 assert( lpi->solver != NULL );
2833 assert( lpinorms != NULL );
2857 assert( lpi != NULL );
2858 assert( lpi->parameters != NULL );
2863 case SCIP_LPPAR_FROMSCRATCH:
2864 *ival = (int) lpi->from_scratch;
2865 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_FROMSCRATCH = %d.\n", *ival);
2867 case SCIP_LPPAR_LPINFO:
2868 *ival = (int) lpi->lp_info;
2869 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_LPINFO = %d.\n", *ival);
2871 case SCIP_LPPAR_LPITLIM:
2872 *ival = (int) lpi->parameters->max_number_of_iterations();
2873 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_LPITLIM = %d.\n", *ival);
2875 case SCIP_LPPAR_PRESOLVING:
2876 *ival = lpi->parameters->use_preprocessing();
2877 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_PRESOLVING = %d.\n", *ival);
2879 case SCIP_LPPAR_PRICING:
2880 *ival = lpi->pricing;
2881 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_PRICING = %d.\n", *ival);
2884 case SCIP_LPPAR_SCALING:
2885 *ival = lpi->parameters->use_scaling();
2886 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_SCALING = %d.\n", *ival);
2889 case SCIP_LPPAR_THREADS:
2890 *ival = lpi->numthreads;
2891 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_THREADS = %d.\n", *ival);
2893 case SCIP_LPPAR_TIMING:
2894 *ival = lpi->timing;
2895 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_TIMING = %d.\n", *ival);
2897 case SCIP_LPPAR_RANDOMSEED:
2898 *ival = (int) lpi->parameters->random_seed();
2899 SCIPdebugMessage(
"SCIPlpiGetIntpar: SCIP_LPPAR_RANDOMSEED = %d.\n", *ival);
2902 return SCIP_PARAMETERUNKNOWN;
2915 assert( lpi != NULL );
2916 assert( lpi->parameters != NULL );
2920 case SCIP_LPPAR_FROMSCRATCH:
2921 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_FROMSCRATCH -> %d.\n", ival);
2922 lpi->from_scratch = (bool) ival;
2924 case SCIP_LPPAR_LPINFO:
2925 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_LPINFO -> %d.\n", ival);
2929 lpi->lp_info =
false;
2934 lpi->lp_info =
true;
2937 case SCIP_LPPAR_LPITLIM:
2938 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_LPITLIM -> %d.\n", ival);
2939 lpi->parameters->set_max_number_of_iterations(ival);
2941 case SCIP_LPPAR_PRESOLVING:
2942 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_PRESOLVING -> %d.\n", ival);
2943 lpi->parameters->set_use_preprocessing(ival);
2945 case SCIP_LPPAR_PRICING:
2946 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_PRICING -> %d.\n", ival);
2947 lpi->pricing = (SCIP_Pricing)ival;
2948 switch ( lpi->pricing )
2950 case SCIP_PRICING_LPIDEFAULT:
2951 case SCIP_PRICING_AUTO:
2952 case SCIP_PRICING_PARTIAL:
2953 case SCIP_PRICING_STEEP:
2954 case SCIP_PRICING_STEEPQSTART:
2957 case SCIP_PRICING_FULL:
2961 case SCIP_PRICING_DEVEX:
2965 return SCIP_PARAMETERUNKNOWN;
2969 case SCIP_LPPAR_SCALING:
2970 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_SCALING -> %d.\n", ival);
2971 lpi->parameters->set_use_scaling(ival);
2974 case SCIP_LPPAR_THREADS:
2975 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_THREADS -> %d.\n", ival);
2976 assert( ival >= 0 );
2977 lpi->numthreads = ival;
2979 lpi->parameters->set_num_omp_threads(1);
2981 lpi->parameters->set_num_omp_threads(ival);
2983 case SCIP_LPPAR_TIMING:
2984 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_TIMING -> %d.\n", ival);
2985 assert( 0 <= ival && ival <= 2 );
2988 absl::SetFlag(&FLAGS_time_limit_use_usertime,
true);
2990 absl::SetFlag(&FLAGS_time_limit_use_usertime,
false);
2992 case SCIP_LPPAR_RANDOMSEED:
2993 SCIPdebugMessage(
"SCIPlpiSetIntpar: SCIP_LPPAR_RANDOMSEED -> %d.\n", ival);
2994 assert( ival >= 0 );
2995 lpi->parameters->set_random_seed(ival);
2998 return SCIP_PARAMETERUNKNOWN;
3011 assert( lpi != NULL );
3012 assert( lpi->parameters != NULL );
3017 case SCIP_LPPAR_FEASTOL:
3018 *dval = lpi->parameters->primal_feasibility_tolerance();
3019 SCIPdebugMessage(
"SCIPlpiGetRealpar: SCIP_LPPAR_FEASTOL = %g.\n", *dval);
3021 case SCIP_LPPAR_DUALFEASTOL:
3022 *dval = lpi->parameters->dual_feasibility_tolerance();
3023 SCIPdebugMessage(
"SCIPlpiGetRealpar: SCIP_LPPAR_DUALFEASTOL = %g.\n", *dval);
3025 case SCIP_LPPAR_OBJLIM:
3026 if (lpi->linear_program->IsMaximizationProblem())
3027 *dval = lpi->parameters->objective_lower_limit();
3029 *dval = lpi->parameters->objective_upper_limit();
3030 SCIPdebugMessage(
"SCIPlpiGetRealpar: SCIP_LPPAR_OBJLIM = %f.\n", *dval);
3032 case SCIP_LPPAR_LPTILIM:
3033 if ( absl::GetFlag(FLAGS_time_limit_use_usertime) )
3034 *dval = lpi->parameters->max_time_in_seconds();
3036 *dval = lpi->parameters->max_deterministic_time();
3037 SCIPdebugMessage(
"SCIPlpiGetRealpar: SCIP_LPPAR_LPTILIM = %f.\n", *dval);
3039 case SCIP_LPPAR_CONDITIONLIMIT:
3040 *dval = lpi->conditionlimit;
3042#ifdef SCIP_DISABLED_CODE
3044 case SCIP_LPPAR_MARKOWITZ:
3045 *dval = lpi->parameters->markowitz_singularity_threshold();
3046 SCIPdebugMessage(
"SCIPlpiGetRealpar: SCIP_LPPAR_MARKOWITZ = %f.\n", *dval);
3050 return SCIP_PARAMETERUNKNOWN;
3063 assert( lpi != NULL );
3064 assert( lpi->parameters != NULL );
3068 case SCIP_LPPAR_FEASTOL:
3069 SCIPdebugMessage(
"SCIPlpiSetRealpar: SCIP_LPPAR_FEASTOL -> %g.\n", dval);
3070 lpi->parameters->set_primal_feasibility_tolerance(dval);
3072 case SCIP_LPPAR_DUALFEASTOL:
3073 SCIPdebugMessage(
"SCIPlpiSetRealpar: SCIP_LPPAR_DUALFEASTOL -> %g.\n", dval);
3074 lpi->parameters->set_dual_feasibility_tolerance(dval);
3076 case SCIP_LPPAR_OBJLIM:
3077 SCIPdebugMessage(
"SCIPlpiSetRealpar: SCIP_LPPAR_OBJLIM -> %f.\n", dval);
3078 if (lpi->linear_program->IsMaximizationProblem())
3079 lpi->parameters->set_objective_lower_limit(dval);
3081 lpi->parameters->set_objective_upper_limit(dval);
3083 case SCIP_LPPAR_LPTILIM:
3084 SCIPdebugMessage(
"SCIPlpiSetRealpar: SCIP_LPPAR_LPTILIM -> %f.\n", dval);
3085 if ( absl::GetFlag(FLAGS_time_limit_use_usertime) )
3086 lpi->parameters->set_max_time_in_seconds(dval);
3088 lpi->parameters->set_max_deterministic_time(dval);
3090 case SCIP_LPPAR_CONDITIONLIMIT:
3091 lpi->conditionlimit = dval;
3092 lpi->checkcondition = (dval >= 0.0);
3094#ifdef SCIP_DISABLED_CODE
3096 case SCIP_LPPAR_MARKOWITZ:
3097 SCIPdebugMessage(
"SCIPlpiSetRealpar: SCIP_LPPAR_MARKOWITZ -> %f.\n", dval);
3098 lpi->parameters->set_markowitz_singularity_threshold(dval);
3102 return SCIP_PARAMETERUNKNOWN;
3115 assert(lpi != NULL);
3137 assert( lpi != NULL );
3138 return std::numeric_limits<SCIP_Real>::infinity();
3147 assert( lpi != NULL );
3149 return val == std::numeric_limits<SCIP_Real>::infinity();
3170 assert( lpi != NULL );
3171 assert( lpi->linear_program != NULL );
3172 assert( fname != NULL );
3174 const std::string filespec(fname);
3178 SCIPerrorMessage(
"Could not read <%s>\n", fname);
3179 return SCIP_READERROR;
3181 lpi->linear_program->Clear();
3193 assert( lpi != NULL );
3194 assert( lpi->linear_program != NULL );
3195 assert( fname != NULL );
3199 const std::string filespec(fname);
3202 SCIPerrorMessage(
"Could not write <%s>\n", fname);
3203 return SCIP_READERROR;
A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...
Fractional LookUpValue(RowIndex row, ColIndex col) const
const SparseColumn & column(ColIndex col) const
void resize(IntType size)
void reserve(IntType size)
ModelSharedTimeLimit * time_limit
SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
changes left and right hand sides of rows
SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPISTATE *lpistate)
loads LPi state (like basis information) into solver; note that the LP might have been extended with ...
SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
get column of inverse basis matrix times constraint matrix B^-1 * A
SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
gets floating point parameter of LP
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
returns value treated as infinity in the LP solver
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
returns TRUE iff the objective limit was reached
SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen)
changes the objective sense
static char glopname[128]
SCIP_Bool SCIPlpiIsInfinity(SCIP_LPI *lpi, SCIP_Real val)
checks if given value is treated as infinity in the LP solver
SCIP_RETCODE SCIPlpiClear(SCIP_LPI *lpi)
clears the whole LP
SCIP_RETCODE SCIPlpiClearState(SCIP_LPI *lpi)
clears current LPi state (like basis information) of the solver
SCIP_Bool SCIPlpiExistsDualRay(SCIP_LPI *lpi)
returns TRUE iff LP is proven to have a dual unbounded ray (but not necessary a dual feasible point);...
SCIP_Bool SCIPlpiExistsPrimalRay(SCIP_LPI *lpi)
returns TRUE iff LP is proven to have a primal unbounded ray (but not necessary a primal feasible poi...
SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
gets current basis status for columns and rows; arrays must be large enough to store the basis status
SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname)
reads LP state (like basis information from a file
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)
adds rows to the LP
SCIP_RETCODE SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray)
gets primal ray for unbounded LPs
SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
gets integer parameter of LP
SCIP_RETCODE SCIPlpiStrongbranchFrac(SCIP_LPI *lpi, int col_index, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
performs strong branching iterations on one fractional candidate
SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname)
writes LP to a file
static SCIP_BASESTAT ConvertGlopConstraintStatus(ConstraintStatus status, Fractional dual)
convert Glop constraint basis status to SCIP status
SCIP_RETCODE SCIPlpiSetIntegralityInformation(SCIP_LPI *lpi, int ncols, int *intInfo)
pass integrality information to LP solver
SCIP_Bool SCIPlpiIsDualInfeasible(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be dual infeasible
static void deleteRowsAndUpdateCurrentBasis(SCIP_LPI *lpi, const DenseBooleanColumn &rows_to_delete)
delete rows from LP and update the current basis
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
sets floating point parameter of LP
SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPINORMS *lpinorms)
loads LPi pricing norms into solver; note that the LP might have been extended with additional column...
SCIP_RETCODE SCIPlpiGetNNonz(SCIP_LPI *lpi, int *nnonz)
gets the number of nonzero elements in the LP constraint matrix
SCIP_Bool SCIPlpiHasPrimalSolve(void)
informs about availability of a primal simplex solving method
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)
performs strong branching iterations on one candidate with integral value
SCIP_RETCODE SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
gets current bounds from LP problem object
SCIP_Bool SCIPlpiHasBarrierSolve(void)
informs about availability of a barrier solving method
SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas)
gets dual Farkas proof for infeasibility
SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval)
gets objective value of solution
SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval)
multiplies a column with a non-zero scalar; the objective value is multiplied with the scalar,...
int SCIPlpiGetInternalStatus(SCIP_LPI *lpi)
returns the internal solution status of the solver
SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi)
start strong branching
SCIP_RETCODE SCIPlpiGetSolFeasibility(SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible)
gets information about primal and dual feasibility of the current LP solution
SCIP_RETCODE SCIPlpiFreeNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
frees pricing norms information
SCIP_Bool SCIPlpiIsIterlimExc(SCIP_LPI *lpi)
returns TRUE iff the iteration limit was reached
SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
changes lower and upper bounds of columns
SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be primal unbounded
SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success)
tries to reset the internal status of the LP solver in order to ignore an instability of the last sol...
SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname)
writes LPi state (i.e.
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
deletes an LP problem object
static SCIP_BASESTAT ConvertGlopVariableStatus(VariableStatus status, Fractional rc)
convert Glop variable basis status to SCIP status
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)
performs strong branching iterations on given fractional candidates
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
gets a single coefficient
static VariableStatus ConvertSCIPConstraintStatusToSlackStatus(int status)
Convert a SCIP constraint status to its corresponding Glop slack VariableStatus.
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be primal feasible
SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname)
reads LP from a file
SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
gets information about the quality of an LP solution
SCIP_Bool SCIPlpiIsDualFeasible(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be dual feasible
SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
stores LPi pricing norms information
SCIP_Bool SCIPlpiIsTimelimExc(SCIP_LPI *lpi)
returns TRUE iff the time limit was reached
SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
checks, whether the given LP state contains simplex basis information
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
sets integer parameter of LP
const char * SCIPlpiGetSolverName(void)
gets name and version of LP solver
static bool IsDualBoundValid(ProblemStatus status)
determine whether the dual bound is valid
SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, const int *cstat, const int *rstat)
sets current basis status for columns and rows
SCIP_Bool SCIPlpiHasPrimalRay(SCIP_LPI *lpi)
returns TRUE iff LP is proven to have a primal unbounded ray (but not necessary a primal feasible poi...
SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds)
get row of inverse basis matrix B^-1
SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow)
deletes all rows in the given range from LP
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)
gets columns from LP problem object; the arrays have to be large enough to store all values Either bo...
static SCIP_RETCODE strongbranch(SCIP_LPI *lpi, int col_index, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
performs strong branching iterations
SCIP_RETCODE SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
get column of inverse basis matrix B^-1
SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
gets column names
SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds)
get row of inverse basis matrix times constraint matrix B^-1 * A
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)
gets rows from LP problem object; the arrays have to be large enough to store all values.
SCIP_Bool SCIPlpiWasSolved(SCIP_LPI *lpi)
returns whether a solve method was called after the last modification of the LP
static SCIP_RETCODE SolveInternal(SCIP_LPI *lpi, bool recursive, std::unique_ptr< TimeLimit > &time_limit)
common function between the two LPI Solve() functions
const char * SCIPlpiGetSolverDesc(void)
gets description of LP solver (developer, webpage, ...)
SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover)
calls barrier or interior point algorithm to solve the LP with crossover to simplex basis
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
returns TRUE iff LP was solved to optimality
SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
gets row names
SCIP_Bool SCIPlpiHasDualSolve(void)
informs about availability of a dual simplex solving method
SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi)
end strong branching
static void updateScaledLP(SCIP_LPI *lpi)
update scaled linear program
SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
gets current row sides from LP problem object
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)
performs strong branching iterations on given candidates with integral values
SCIP_RETCODE SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
gets primal and dual solution vectors for feasible LPs
SCIP_Bool SCIPlpiHasDualRay(SCIP_LPI *lpi)
returns TRUE iff LP is proven to have a dual unbounded ray (but not necessary a dual feasible point),...
SCIP_RETCODE SCIPlpiDelColset(SCIP_LPI *lpi, int *dstat)
deletes columns from SCIP_LP; the new position of a column must not be greater that its old position
SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
gets objective coefficients from LP problem object
SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
frees LPi state information
SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be primal infeasible
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
calls dual simplex to solve the LP
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)
adds columns to the LP
SCIP_RETCODE SCIPlpiSolvePrimal(SCIP_LPI *lpi)
calls primal simplex to solve the LP
static bool checkUnscaledPrimalFeasibility(SCIP_LPI *lpi)
check primal feasibility
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)
copies LP data with column matrix into LP solver
SCIP_Bool SCIPlpiIsDualUnbounded(SCIP_LPI *lpi)
returns TRUE iff LP is proven to be dual unbounded
SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations)
gets the number of LP iterations of the last solve call
SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind)
returns the indices of the basic columns and rows; basic column n gives value n, basic row m gives va...
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
creates an LP problem object
void * SCIPlpiGetSolverPointer(SCIP_LPI *lpi)
gets pointer for LP solver - use only with great care
SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *obj)
changes objective values of columns in the LP
SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen)
gets objective sense of the LP
SCIP_Bool SCIPlpiIsStable(SCIP_LPI *lpi)
returns TRUE iff current LP solution is stable
SCIP_RETCODE SCIPlpiGetNCols(SCIP_LPI *lpi, int *ncols)
gets the number of columns in the LP
SCIP_RETCODE SCIPlpiInterrupt(SCIP_LPI *lpi, SCIP_Bool interrupt)
interrupts the currently ongoing lp solve or disables the interrupt
static VariableStatus ConvertSCIPVariableStatus(int status)
Convert SCIP variable status to Glop status.
SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol)
deletes all columns in the given range from LP
SCIP_RETCODE SCIPlpiDelRowset(SCIP_LPI *lpi, int *dstat)
deletes rows from SCIP_LP; the new position of a row must not be greater that its old position
SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval)
multiplies a row with a non-zero scalar; for negative scalars, the row's sense is switched accordingl...
SCIP_RETCODE SCIPlpiGetNRows(SCIP_LPI *lpi, int *nrows)
gets the number of rows in the LP
SCIP_RETCODE SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
stores LPi state (like basis information) into lpistate object
SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
changes a single coefficient
bool WriteProtoToFile(const google::protobuf::Message &proto, const absl::string_view &file_name)
bool ReadFileToProto(const absl::string_view &file_name, google::protobuf::Message *proto)
int SetVLOGLevel(const char *module_pattern, int log_level)
std::vector< ColIndex > ColIndexVector
Fractional ScalarProduct(const DenseRowOrColumn1 &u, const DenseRowOrColumn2 &v)
void MPModelProtoToLinearProgram(const MPModelProto &input, LinearProgram *output)
StrictITIVector< ColIndex, Fractional > DenseRow
std::string GetProblemStatusString(ProblemStatus problem_status)
StrictITIVector< ColIndex, VariableStatus > VariableStatusRow
StrictITIVector< RowIndex, ConstraintStatus > ConstraintStatusColumn
void LinearProgramToMPModelProto(const LinearProgram &input, MPModelProto *output)
ColIndex RowToColIndex(RowIndex row)
VectorIterator< ScatteredColumnEntry > ScatteredColumnIterator
@ GlopParameters_PricingRule_DANTZIG
@ GlopParameters_PricingRule_DEVEX
@ GlopParameters_PricingRule_STEEPEST_EDGE
VectorIterator< ScatteredRowEntry > ScatteredRowIterator
StrictITIVector< ColIndex, bool > DenseBooleanRow
StrictITIVector< RowIndex, Fractional > DenseColumn
StrictITIVector< RowIndex, bool > DenseBooleanColumn
int OrToolsMinorVersion()
int OrToolsMajorVersion()
std::optional< int64_t > end
bool from_scratch
store whether basis is ignored for next solving call
int timing
type of timer (1 - cpu, 2 - wallclock, 0 - off)
ScatteredColumn * tmp_column
temporary vector
operations_research::glop::LinearProgram * scaled_lp
scaled linear program
operations_research::glop::RevisedSimplex * solver
direct reference to the revised simplex, not passing through lp_solver
operations_research::glop::GlopParameters * parameters
parameters
bool lp_info
whether additional output is turned on
SCIP_Longint niterations
number of iterations used
SCIP_Real conditionlimit
maximum condition number of LP basis counted as stable (-1.0: no limit)
operations_research::glop::LpScalingHelper * scaler
scaler auxiliary class
int numthreads
number of threads used to solve the LP (0 = automatic)
ScatteredRow * tmp_row
temporary vector
bool lp_modified_since_last_solve
bool checkcondition
Should condition number of LP basis be checked for stability?
bool lp_time_limit_was_reached
SCIP_PRICING pricing
SCIP pricing setting
operations_research::glop::LinearProgram * linear_program
the linear program
VariableStatusRow statuses