Skip to content

Commit dc2937b

Browse files
committed
Integrate CliqueMerging presolver
1 parent ac1c293 commit dc2937b

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

cpp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ endif()
181181
FetchContent_Declare(
182182
papilo
183183
GIT_REPOSITORY "https://github.com/scipopt/papilo.git"
184-
GIT_TAG "v2.4.3"
184+
# Get the latest commit from development branch
185+
GIT_TAG "bd1222a6b6608283d31a0fea6735695345bcd936"
186+
GIT_PROGRESS TRUE
185187
SYSTEM
186188
)
187189

cpp/src/mip/presolve/third_party_presolve.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ static papilo::PostsolveStorage<double> post_solve_storage_;
3434
static bool maximize_ = false;
3535

3636
template <typename i_t, typename f_t>
37-
papilo::Problem<f_t> build_papilo_problem(const optimization_problem_t<i_t, f_t>& op_problem)
37+
papilo::Problem<f_t> build_papilo_problem(const optimization_problem_t<i_t, f_t>& op_problem,
38+
problem_category_t category)
3839
{
3940
// Build papilo problem from optimization problem
4041
papilo::ProblemBuilder<f_t> builder;
@@ -167,7 +168,10 @@ papilo::Problem<f_t> build_papilo_problem(const optimization_problem_t<i_t, f_t>
167168

168169
if (h_entries.size()) {
169170
auto constexpr const sorted_entries = true;
170-
auto csr_storage = papilo::SparseStorage<f_t>(h_entries, num_rows, num_cols, sorted_entries);
171+
// MIP reductions like clique merging and substituition require more fillin
172+
const double spare_ratio = category == problem_category_t::MIP ? 4.0 : 2.0;
173+
const int min_inter_row_space = category == problem_category_t::MIP ? 30 : 4;
174+
auto csr_storage = papilo::SparseStorage<f_t>(h_entries, num_rows, num_cols, sorted_entries, spare_ratio, min_inter_row_space);
171175
problem.setConstraintMatrix(csr_storage, h_constr_lb, h_constr_ub, h_row_flags);
172176

173177
papilo::ConstraintMatrix<f_t>& matrix = problem.getConstraintMatrix();
@@ -308,10 +312,6 @@ void set_presolve_methods(papilo::Presolve<f_t>& presolver, problem_category_t c
308312
{
309313
using uptr = std::unique_ptr<papilo::PresolveMethod<f_t>>;
310314

311-
// cuopt custom presolvers
312-
if (category == problem_category_t::MIP)
313-
presolver.addPresolveMethod(uptr(new cuopt::linear_programming::detail::GF2Presolve<f_t>()));
314-
315315
// fast presolvers
316316
presolver.addPresolveMethod(uptr(new papilo::SingletonCols<f_t>()));
317317
presolver.addPresolveMethod(uptr(new papilo::CoefficientStrengthening<f_t>()));
@@ -336,6 +336,24 @@ void set_presolve_methods(papilo::Presolve<f_t>& presolver, problem_category_t c
336336
presolver.addPresolveMethod(uptr(new papilo::SimpleSubstitution<f_t>()));
337337
presolver.addPresolveMethod(uptr(new papilo::Sparsify<f_t>()));
338338
presolver.addPresolveMethod(uptr(new papilo::Substitution<f_t>()));
339+
340+
341+
if (category == problem_category_t::MIP) {
342+
// cuOpt custom GF2 presolver
343+
presolver.addPresolveMethod(uptr(new cuopt::linear_programming::detail::GF2Presolve<f_t>()));
344+
345+
// clique merging presolver that is part of development branch of papilo
346+
const int max_edges_parallel = 1000000;
347+
const int max_edges_sequential = 100000;
348+
const int max_clique_size = 100;
349+
const int max_greedy_calls = 20000;
350+
// const int max_calls = 50; // FIXME:: make this change once the papilo PR is merged
351+
papilo::CliqueMerging<f_t> clique_merging;
352+
clique_merging.setEnabled(true); // This is currently disabled in the papilo presolver
353+
clique_merging.setParameters(max_edges_parallel, max_edges_sequential, max_clique_size, max_greedy_calls /* , max_calls */);
354+
presolver.addPresolveMethod(
355+
uptr(new papilo::CliqueMerging<f_t>(std::move(clique_merging))));
356+
}
339357
}
340358

341359
template <typename i_t, typename f_t>
@@ -360,7 +378,7 @@ std::pair<optimization_problem_t<i_t, f_t>, bool> third_party_presolve_t<i_t, f_
360378
double time_limit,
361379
i_t num_cpu_threads)
362380
{
363-
papilo::Problem<f_t> papilo_problem = build_papilo_problem(op_problem);
381+
papilo::Problem<f_t> papilo_problem = build_papilo_problem(op_problem, category);
364382

365383
CUOPT_LOG_INFO("Unpresolved problem:: %d constraints, %d variables, %d nonzeros",
366384
papilo_problem.getNRows(),

0 commit comments

Comments
 (0)