Skip to content

Commit c93ec19

Browse files
committed
changing setup_method_ signature
1 parent 5c8f931 commit c93ec19

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

ortools/linear_solver/linear_solver.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void MPSolver::SetSolveParameters(const std::string& parameter)
359359
resolution_parameter_ = parameter;
360360
}
361361

362-
void MPSolver::AddSetupMethod(std::function<void(void)> method)
362+
void MPSolver::AddSetupMethod(std::function<void(void*)> method)
363363
{
364364
setup_method_ = method;
365365
}

ortools/linear_solver/linear_solver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ class MPSolver {
655655

656656
void SetSolveParameters(const std::string& parameter);
657657

658-
void AddSetupMethod(std::function<void(void)>);
658+
void AddSetupMethod(std::function<void(void*)>);
659659

660660
/**
661661
* Sets a hint for solution.
@@ -924,7 +924,7 @@ class MPSolver {
924924

925925
std::string resolution_parameter_;
926926

927-
std::function<void(void)> setup_method_;
927+
std::function<void(void*)> setup_method_;
928928

929929
static absl::Mutex global_count_mutex_;
930930
#ifndef SWIG

ortools/linear_solver/xpress_interface.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ extern "C" {
3030
#include "xprs.h"
3131
}
3232

33+
#include <cassert>
34+
3335
#define XPRS_INTEGER 'I'
3436
#define XPRS_CONTINUOUS 'C'
3537
#define STRINGIFY2(X) #X
@@ -1659,7 +1661,7 @@ MPSolver::ResultStatus XpressInterface::Solve(MPSolverParameters const& param) {
16591661
CHECK_STATUS(XPRSsetintcontrol(mLp, XPRS_MAXTIME, -1 * solver_->time_limit_in_secs()));
16601662
}
16611663
if (solver_->setup_method_ != nullptr)
1662-
solver_->setup_method_();
1664+
solver_->setup_method_(solver_->underlying_solver());
16631665

16641666
// Solve.
16651667
// Do not CHECK_STATUS here since some errors (for example CPXERR_NO_MEMORY)

0 commit comments

Comments
 (0)