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));
28 bool log_info,
const glop::GlopParameters& glop_params, MPModelProto*
model,
29 std::vector<std::unique_ptr<glop::Preprocessor>>* for_postsolve) {
30 CHECK(
model !=
nullptr);
33 if (!
model->general_constraint().empty()) {
38 const bool hint_is_present =
model->has_solution_hint();
39 const auto copy_of_hint =
model->solution_hint();
50 if (!hint_is_present) {
51 const std::string header =
52 "Running basic LP presolve, initial problem dimensions: ";
54 std::vector<std::string> names;
55 std::vector<std::unique_ptr<glop::Preprocessor>> lp_preprocessors;
67 for (
int i = 0; i < lp_preprocessors.size(); ++i) {
68 auto& preprocessor = lp_preprocessors[i];
69 preprocessor->UseInMipContext();
70 const bool need_postsolve = preprocessor->Run(&lp);
71 names[i].resize(header.size(),
' ');
75 if (status == glop::ProblemStatus::PRIMAL_INFEASIBLE ||
76 status == glop::ProblemStatus::INFEASIBLE_OR_UNBOUNDED) {
81 if (need_postsolve) for_postsolve->push_back(std::move(preprocessor));
86 if (!hint_is_present) {
88 absl::make_unique<glop::ShiftVariableBoundsPreprocessor>(&glop_params);
89 shift_bounds->UseInMipContext();
90 if (shift_bounds->Run(&lp)) {
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