Skip to content

Commit

Permalink
XPRESS: fix QCon
Browse files Browse the repository at this point in the history
XPRSchgqrowcoeff: factor 0.5 for off-diagonal
  • Loading branch information
glebbelov committed Jul 27, 2023
1 parent 6168f8e commit 1977617
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions solvers/xpress/xpressmodelapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ void XpressmpModelAPI::AddConstraint(const IndicatorConstraintLinGE &ic) {
_addIndicator_mp
}

void XpressmpModelAPI::AddLinTerms(XPRSprob lp, const LinTerms& lt, double rhsc, const char typec) {
void XpressmpModelAPI::AddLinTerms(
XPRSprob lp, const LinTerms& lt, double rhsc, const char typec) {
char type[] = { typec };
double rhs[] = { rhsc };
int start[] = { 0 };
Expand All @@ -142,7 +143,9 @@ AddLinTerms(lp(), lt, qc.rhs(), type); \
const auto& qt = qc.GetQPTerms();\
int row = NumLinCons() - 1;\
for (int i = 0; i < qt.size(); i++)\
XPRESSMP_CCALL(XPRSchgqrowcoeff(lp(), row, qt.var1(i), qt.var2(i), qt.coef(i)));
XPRESSMP_CCALL(XPRSchgqrowcoeff(lp(), row, \
qt.var1(i), qt.var2(i), \
qt.var1(i)==qt.var2(i) ? qt.coef(i) : 0.5*qt.coef(i)));

void XpressmpModelAPI::AddConstraint( const QuadConLE& qc ) {
addqp('L')
Expand Down

0 comments on commit 1977617

Please sign in to comment.