Skip to content

Commit 70d71d5

Browse files
committed
Fix starting point
1 parent 45b32e6 commit 70d71d5

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

highs/ipm/hipo/ipm/Solver.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,17 @@ bool Solver::startingPoint() {
674674
// y starting point
675675
// *********************************************************************
676676

677+
std::vector<double> cPlusQx(n_);
678+
if (model_.qp()) model_.Q().product(x, cPlusQx);
679+
vectorAdd(cPlusQx, model_.c());
680+
681+
double max_norm_x = std::max(infNorm(x), std::max(infNorm(xl), infNorm(xu)));
682+
if (infNorm(cPlusQx) > max_norm_x * 1e3) cPlusQx = model_.c();
683+
677684
if (options_.nla == kOptionNlaNormEq) {
678-
// compute A*c
685+
// compute A*(c+Qx)
679686
std::fill(temp_m.begin(), temp_m.end(), 0.0);
680-
model_.A().alphaProductPlusY(1.0, model_.c(), temp_m);
687+
model_.A().alphaProductPlusY(1.0, cPlusQx, temp_m);
681688

682689
if (Int status = LS_->solveNE(temp_m, y)) {
683690
logH_.printe("Error while solvingF normal equations\n");
@@ -686,14 +693,14 @@ bool Solver::startingPoint() {
686693
}
687694

688695
} else if (options_.nla == kOptionNlaAugmented) {
689-
// obtain solution of A*A^T * y = A*c by solving
690-
// [ -I A^T] [...] = [ c ]
691-
// [ A 0 ] [ y ] = [ 0 ]
696+
// obtain solution of A*A^T * y = A*(c+Qx) by solving
697+
// [ -I A^T] [...] = [ c+Qx ]
698+
// [ A 0 ] [ y ] = [ 0 ]
692699

693700
std::vector<double> rhs_y(m_, 0.0);
694701
std::vector<double> lhs_x(n_);
695702

696-
if (Int status = LS_->solveAS(model_.c(), rhs_y, lhs_x, y)) {
703+
if (Int status = LS_->solveAS(cPlusQx, rhs_y, lhs_x, y)) {
697704
logH_.printe("Error while solving augmented system\n");
698705
info_.status = (Status)status;
699706
return true;
@@ -704,8 +711,8 @@ bool Solver::startingPoint() {
704711
// *********************************************************************
705712
// zl, zu starting point
706713
// *********************************************************************
707-
// compute c - A^T * y and store in zl
708-
zl = model_.c();
714+
// compute c + Q * x - A^T * y and store in zl
715+
zl = cPlusQx;
709716
model_.A().alphaProductPlusY(-1.0, y, zl, true);
710717

711718
// split result between zl and zu

0 commit comments

Comments
 (0)