Skip to content

Commit 4485d0e

Browse files
committed
Remove nz limit for NE
1 parent f7344cb commit 4485d0e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

highs/ipm/hipo/ipm/FactorHiGHSSolver.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,11 @@ Int FactorHiGHSSolver::buildNEstructure(const HighsSparseMatrix& A,
195195
}
196196
// intersection of row with rows below finished.
197197

198-
// if the total number of nonzeros exceeds the maximum, return error
199-
if (ptrNE_[row] + (Int64)nz_in_col >= nz_limit) return kStatusOoM;
198+
// if the total number of nonzeros exceeds the maximum, return error.
199+
// All integers are 64-bit, so no overflow is possible in practice. The
200+
// limit may not be set.
201+
if (nz_limit > 0 && ptrNE_[row] + (Int64)nz_in_col >= nz_limit)
202+
return kStatusOoM;
200203

201204
// update pointers
202205
ptrNE_[row + 1] = ptrNE_[row] + (Int64)nz_in_col;
@@ -462,7 +465,7 @@ Int FactorHiGHSSolver::chooseNla() {
462465
// If NE has more nonzeros than the factor of AS, then it's likely that AS
463466
// will be preferred, so stop computation of NE.
464467
Int64 NE_nz_limit = symb_AS.nz() * kSymbNzMult;
465-
if (failure_AS || NE_nz_limit > kHighsIInf) NE_nz_limit = kHighsIInf;
468+
if (failure_AS) NE_nz_limit = -1;
466469

467470
Int NE_status = analyseNE(symb_NE, NE_nz_limit);
468471
if (NE_status) failure_NE = true;

highs/ipm/hipo/ipm/FactorHiGHSSolver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class FactorHiGHSSolver : public LinearSolver {
3939
Int setNla();
4040
void setParallel();
4141

42-
Int buildNEstructure(const HighsSparseMatrix& A, Int64 nz_limit = kHighsIInf);
42+
Int buildNEstructure(const HighsSparseMatrix& A, Int64 nz_limit = -1);
4343
Int buildNEvalues(const HighsSparseMatrix& A,
4444
const std::vector<double>& scaling);
4545
void freeNEmemory();
4646

4747
Int analyseAS(Symbolic& S);
48-
Int analyseNE(Symbolic& S, Int64 nz_limit = kHighsIInf);
48+
Int analyseNE(Symbolic& S, Int64 nz_limit = -1);
4949

5050
public:
5151
FactorHiGHSSolver(Options& options, const Model& model,

0 commit comments

Comments
 (0)