Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use XPRSmipoptimize and XPRSlpoptimize instead of XPRSminim and XPRSmaxim #114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ortools/linear_solver/xpress_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1912,16 +1912,10 @@ MPSolver::ResultStatus XpressInterface::Solve(MPSolverParameters const& param) {

int xpress_stat = 0;
if (mMip) {
if (this->maximize_)
status = XPRSmaxim(mLp, "g");
else
status = XPRSminim(mLp, "g");
status = XPRSmipoptimize(mLp,"");
XPRSgetintattrib(mLp, XPRS_MIPSTATUS, &xpress_stat);
} else {
if (this->maximize_)
status = XPRSmaxim(mLp, "");
else
status = XPRSminim(mLp, "");
status = XPRSlpoptimize(mLp,"");
XPRSgetintattrib(mLp, XPRS_LPSTATUS, &xpress_stat);
}

Expand Down
9 changes: 5 additions & 4 deletions ortools/xpress/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ std::function<int(XPRSprob prob, int nrows, const int rowind[], const char rowty
std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p, int priority)> XPRSaddcbintsol = nullptr;
std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p)> XPRSremovecbintsol = nullptr;
std::function<int(XPRSprob prob, void (XPRS_CC *f_message)(XPRSprob cbprob, void* cbdata, const char* msg, int msglen, int msgtype), void* p, int priority)> XPRSaddcbmessage = nullptr;
std::function<int(XPRSprob prob, const char* flags)> XPRSminim = nullptr;
std::function<int(XPRSprob prob, const char* flags)> XPRSmaxim = nullptr;
std::function<int(XPRSprob prob, const char* flags)> XPRSlpoptimize = nullptr;
std::function<int(XPRSprob prob, const char* flags)> XPRSmipoptimize = nullptr;

absl::Status LoadXpressFunctions(DynamicLibrary* xpress_dynamic_library) {
// This was generated with the parse_header_xpress.py script.
Expand Down Expand Up @@ -156,8 +156,9 @@ absl::Status LoadXpressFunctions(DynamicLibrary* xpress_dynamic_library) {
xpress_dynamic_library->GetFunction(&XPRSaddcbintsol, "XPRSaddcbintsol");
xpress_dynamic_library->GetFunction(&XPRSremovecbintsol, "XPRSremovecbintsol");
xpress_dynamic_library->GetFunction(&XPRSaddcbmessage, "XPRSaddcbmessage");
xpress_dynamic_library->GetFunction(&XPRSminim, "XPRSminim");
xpress_dynamic_library->GetFunction(&XPRSmaxim, "XPRSmaxim");
xpress_dynamic_library->GetFunction(&XPRSlpoptimize, "XPRSlpoptimize");
xpress_dynamic_library->GetFunction(&XPRSmipoptimize, "XPRSmipoptimize");


auto notFound = xpress_dynamic_library->FunctionsNotFound();
if (!notFound.empty()) {
Expand Down
4 changes: 2 additions & 2 deletions ortools/xpress/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ extern std::function<int(XPRSprob prob, int nrows, const int rowind[], const cha
extern std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p, int priority)> XPRSaddcbintsol;
extern std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p)> XPRSremovecbintsol;
extern std::function<int(XPRSprob prob, void (XPRS_CC *f_message)(XPRSprob cbprob, void* cbdata, const char* msg, int msglen, int msgtype), void* p, int priority)> XPRSaddcbmessage;
extern std::function<int(XPRSprob prob, const char* flags)> XPRSminim;
extern std::function<int(XPRSprob prob, const char* flags)> XPRSmaxim;
extern std::function<int(XPRSprob prob, const char* flags)> XPRSlpoptimize;
extern std::function<int(XPRSprob prob, const char* flags)> XPRSmipoptimize;

} // namespace operations_research

Expand Down
4 changes: 2 additions & 2 deletions ortools/xpress/parse_header_xpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def __init__(self):
"XPRSwriteprob", "XPRSgetrowtype", "XPRSgetcoltype", "XPRSgetlpsol",
"XPRSgetmipsol", "XPRSchgbounds", "XPRSchgobj", "XPRSchgcoef", "XPRSchgmcoef",
"XPRSchgrhs", "XPRSchgrhsrange", "XPRSchgrowtype", "XPRSaddcbmessage", "XPRSsetcbmessage",
"XPRSminim", "XPRSmaxim", "XPRSaddmipsol", "XPRSaddcbintsol", "XPRSremovecbintsol",
"XPRSinterrupt"}
"XPRSaddmipsol", "XPRSaddcbintsol", "XPRSremovecbintsol",
"XPRSinterrupt", "XPRSlpoptimize", "XPRSmipoptimize"}
self.__missing_required_functions = self.__required_functions
self.__XPRSprob_section = False

Expand Down