16#include "absl/memory/memory.h"
23#define ADD_LP_PREPROCESSOR(name) \
24 names.push_back(#name); \
25 lp_preprocessors.push_back(absl::make_unique<name>(&glop_params));
29 std::vector<std::unique_ptr<glop::Preprocessor>>* for_postsolve,
34 if (!
model->general_constraint().empty()) {
39 const bool hint_is_present =
model->has_solution_hint();
40 const auto copy_of_hint =
model->solution_hint();
51 if (!hint_is_present) {
52 const std::string header =
53 "Running basic LP presolve, initial problem dimensions: ";
56 std::vector<std::string> names;
57 std::vector<std::unique_ptr<glop::Preprocessor>> lp_preprocessors;
69 for (
int i = 0; i < lp_preprocessors.size(); ++i) {
70 auto& preprocessor = lp_preprocessors[i];
71 preprocessor->UseInMipContext();
72 const bool need_postsolve = preprocessor->Run(&lp);
73 names[i].resize(header.size(),
' ');
77 if (need_postsolve) for_postsolve->push_back(std::move(preprocessor));
82 if (!hint_is_present) {
84 absl::make_unique<glop::ShiftVariableBoundsPreprocessor>(&glop_params);
85 shift_bounds->UseInMipContext();
86 const bool need_postsolve = shift_bounds->Run(&lp);
88 return shift_bounds->status();
91 for_postsolve->push_back(std::move(shift_bounds));
99 if (hint_is_present) {
100 *
model->mutable_solution_hint() = copy_of_hint;
106#undef ADD_LP_PREPROCESSOR
std::string GetDimensionString() const
void MPModelProtoToLinearProgram(const MPModelProto &input, LinearProgram *output)
void LinearProgramToMPModelProto(const LinearProgram &input, MPModelProto *output)
Collection of objects used to extend the Constraint Solver library.
glop::ProblemStatus ApplyMipPresolveSteps(const glop::GlopParameters &glop_params, MPModelProto *model, std::vector< std::unique_ptr< glop::Preprocessor > > *for_postsolve, SolverLogger *logger)
#define ADD_LP_PREPROCESSOR(name)
#define SOLVER_LOG(logger,...)