21#include "absl/log/check.h"
22#include "ortools/glop/parameters.pb.h"
32#define ADD_LP_PREPROCESSOR(name) \
33 names.push_back(#name); \
34 lp_preprocessors.push_back(std::make_unique<name>(&glop_params));
37 const glop::GlopParameters& glop_params, MPModelProto*
model,
38 std::vector<std::unique_ptr<glop::Preprocessor>>* for_postsolve,
40 CHECK(
model !=
nullptr);
43 if (!
model->general_constraint().empty()) {
48 const bool hint_is_present =
model->has_solution_hint();
49 const auto copy_of_hint =
model->solution_hint();
63 if (!hint_is_present) {
64 const std::string header =
65 "Running basic LP presolve, initial problem dimensions: ";
68 std::vector<std::string> names;
69 std::vector<std::unique_ptr<glop::Preprocessor>> lp_preprocessors;
81 for (
int i = 0; i < lp_preprocessors.size(); ++i) {
87 names[i].resize(header.size(),
' ');
91 if (need_postsolve) for_postsolve->push_back(std::move(
preprocessor));
96 if (!hint_is_present) {
98 std::make_unique<glop::ShiftVariableBoundsPreprocessor>(&glop_params);
99 shift_bounds->UseInMipContext();
100 const bool need_postsolve = shift_bounds->Run(&lp);
102 return shift_bounds->status();
104 if (need_postsolve) {
105 for_postsolve->push_back(std::move(shift_bounds));
113 if (hint_is_present) {
114 *
model->mutable_solution_hint() = copy_of_hint;
120#undef ADD_LP_PREPROCESSOR
static std::unique_ptr< TimeLimit > FromParameters(const Parameters ¶meters)
Removes the fixed variables from the problem.
Removes the constraints with no bounds from the problem.
std::string GetDimensionString() const
A short string with the problem dimension.
bool Run(LinearProgram *lp) final
ProblemStatus status() const
virtual void UseInMipContext()
void SetTimeLimit(TimeLimit *time_limit)
void LinearProgramToMPModelProto(const LinearProgram &input, MPModelProto *output)
Converts a LinearProgram to a MPModelProto.
ProblemStatus
Different statuses for a given problem.
@ INIT
The solver didn't had a chance to prove anything.
void MPModelProtoToLinearProgram(const MPModelProto &input, LinearProgram *output)
Converts a MPModelProto to a LinearProgram.
In SWIG mode, we don't want anything besides these top-level includes.
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,...)