21 #include "absl/memory/memory.h"
22 #include "ortools/glop/parameters.pb.h"
28 #define ADD_LP_PREPROCESSOR(name) \
29 names.push_back(#name); \
30 lp_preprocessors.push_back(std::make_unique<name>(&glop_params));
33 const glop::GlopParameters& glop_params, MPModelProto*
model,
34 std::vector<std::unique_ptr<glop::Preprocessor>>* for_postsolve,
36 CHECK(
model !=
nullptr);
39 if (!
model->general_constraint().empty()) {
44 const bool hint_is_present =
model->has_solution_hint();
45 const auto copy_of_hint =
model->solution_hint();
56 if (!hint_is_present) {
57 const std::string header =
58 "Running basic LP presolve, initial problem dimensions: ";
61 std::vector<std::string> names;
62 std::vector<std::unique_ptr<glop::Preprocessor>> lp_preprocessors;
74 for (
int i = 0; i < lp_preprocessors.size(); ++i) {
78 names[i].resize(header.size(),
' ');
82 if (need_postsolve) for_postsolve->push_back(std::move(
preprocessor));
87 if (!hint_is_present) {
89 std::make_unique<glop::ShiftVariableBoundsPreprocessor>(&glop_params);
90 shift_bounds->UseInMipContext();
91 const bool need_postsolve = shift_bounds->Run(&lp);
93 return shift_bounds->status();
96 for_postsolve->push_back(std::move(shift_bounds));
104 if (hint_is_present) {
105 *
model->mutable_solution_hint() = copy_of_hint;
111 #undef ADD_LP_PREPROCESSOR
std::string GetDimensionString() const
bool Run(LinearProgram *lp) final
ProblemStatus status() const
virtual void UseInMipContext()
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)
glop::MainLpPreprocessor preprocessor
#define ADD_LP_PREPROCESSOR(name)
#define SOLVER_LOG(logger,...)