@@ -40,12 +40,11 @@ Int FactorHighsSolver::analyseAS(Symbolic& S) {
4040 // Perform analyse phase of augmented system and return symbolic factorisation
4141 // in object S and the status.
4242
43- if (kkt_.rowsAS .empty () || kkt_.ptrAS .empty ()) return kStatusErrorAnalyse ;
43+ if (kkt_.rowsAS .empty () || kkt_.ptrAS .empty ()) return kErrorAnalyse ;
4444
4545 const Int m = model_.A ().num_row_ ;
4646 const Int n = model_.A ().num_col_ ;
4747
48- // create vector of signs of pivots
4948 std::vector<Int> pivot_signs (n + m, -1 );
5049 for (Int i = 0 ; i < m; ++i) pivot_signs[n + i] = 1 ;
5150
@@ -64,9 +63,8 @@ Int FactorHighsSolver::analyseNE(Symbolic& S) {
6463 // in object S and the status. Structure of the matrix must be already
6564 // computed.
6665
67- if (kkt_.rowsNE .empty () || kkt_.ptrNE .empty ()) return kStatusErrorAnalyse ;
66+ if (kkt_.rowsNE .empty () || kkt_.ptrNE .empty ()) return kErrorAnalyse ;
6867
69- // create vector of signs of pivots
7068 std::vector<Int> pivot_signs (model_.A ().num_row_ , 1 );
7169
7270 logger_.printInfo (" Performing NE analyse phase\n " );
@@ -84,7 +82,6 @@ Int FactorHighsSolver::analyseNE(Symbolic& S) {
8482// =========================================================================
8583
8684Int FactorHighsSolver::factorAS (const std::vector<double >& scaling) {
87- // only execute factorisation if it has not been done yet
8885 assert (!this ->valid_ );
8986
9087 kkt_.buildASvalues (scaling);
@@ -95,16 +92,15 @@ Int FactorHighsSolver::factorAS(const std::vector<double>& scaling) {
9592 Clock clock;
9693 if (FH_ .factorise (kkt_.S , kkt_.n (), kkt_.nz (), kkt_.rowsAS .data (),
9794 kkt_.ptrAS .data (), kkt_.valAS .data ()))
98- return kStatusErrorFactorise ;
95+ return kErrorFactorise ;
9996 info_.factor_time += clock.stop ();
10097 info_.factor_number ++;
10198
10299 this ->valid_ = true ;
103- return kStatusOk ;
100+ return kOk ;
104101}
105102
106103Int FactorHighsSolver::factorNE (const std::vector<double >& scaling) {
107- // only execute factorisation if it has not been done yet
108104 assert (!this ->valid_ );
109105
110106 kkt_.buildNEvalues (scaling);
@@ -115,12 +111,12 @@ Int FactorHighsSolver::factorNE(const std::vector<double>& scaling) {
115111 Clock clock;
116112 if (FH_ .factorise (kkt_.S , kkt_.n (), kkt_.nz (), kkt_.rowsNE .data (),
117113 kkt_.ptrNE .data (), kkt_.valNE .data ()))
118- return kStatusErrorFactorise ;
114+ return kErrorFactorise ;
119115 info_.factor_time += clock.stop ();
120116 info_.factor_number ++;
121117
122118 this ->valid_ = true ;
123- return kStatusOk ;
119+ return kOk ;
124120}
125121
126122// =========================================================================
@@ -131,48 +127,43 @@ Int FactorHighsSolver::solveAS(const std::vector<double>& rhs_x,
131127 const std::vector<double >& rhs_y,
132128 std::vector<double >& lhs_x,
133129 std::vector<double >& lhs_y) {
134- // only execute the solve if factorisation is valid
135130 assert (this ->valid_ );
136131
137132 Int n = rhs_x.size ();
138133
139- // create single rhs
140134 std::vector<double > rhs;
141135 rhs.insert (rhs.end (), rhs_x.begin (), rhs_x.end ());
142136 rhs.insert (rhs.end (), rhs_y.begin (), rhs_y.end ());
143137
144138 Clock clock;
145- if (FH_ .solve (rhs.data ())) return kStatusErrorSolve ;
139+ if (FH_ .solve (rhs.data ())) return kErrorSolve ;
146140
147141 info_.solve_time += clock.stop ();
148142 info_.solve_number ++;
149143
150144 data_.back ().num_solves ++;
151145
152- // split lhs
153146 lhs_x = std::vector<double >(rhs.begin (), rhs.begin () + n);
154147 lhs_y = std::vector<double >(rhs.begin () + n, rhs.end ());
155148
156- return kStatusOk ;
149+ return kOk ;
157150}
158151
159152Int FactorHighsSolver::solveNE (const std::vector<double >& rhs,
160153 std::vector<double >& lhs) {
161- // only execute the solve if factorisation is valid
162154 assert (this ->valid_ );
163155
164- // initialise lhs with rhs
165156 lhs = rhs;
166157
167158 Clock clock;
168- if (FH_ .solve (lhs.data ())) return kStatusErrorSolve ;
159+ if (FH_ .solve (lhs.data ())) return kErrorSolve ;
169160
170161 info_.solve_time += clock.stop ();
171162 info_.solve_number ++;
172163
173164 data_.back ().num_solves ++;
174165
175- return kStatusOk ;
166+ return kOk ;
176167}
177168
178169// =========================================================================
@@ -195,20 +186,17 @@ Int FactorHighsSolver::setup() {
195186
196187 kkt_.S .print (logger_, logger_.debug (1 ));
197188
198- // Warn about large memory consumption
199189 if (kkt_.S .storage () > kLargeStorageGB * 1024 * 1024 * 1024 ) {
200190 logger_.printw (" Large amount of memory required\n " );
201191 }
202192
203193 logger_.print (" \n " );
204194 }
205195
206- return kStatusOk ;
196+ return kOk ;
207197}
208198
209199Int FactorHighsSolver::chooseNla () {
210- // Choose whether to use augmented system or normal equations.
211-
212200 Symbolic symb_NE{};
213201 Symbolic symb_AS{};
214202 bool failure_NE = false ;
@@ -238,7 +226,7 @@ Int FactorHighsSolver::chooseNla() {
238226 Int status = kkt_.buildNEstructure ();
239227 if (status) {
240228 failure_NE = true ;
241- if (status == kStatusOverflow ) {
229+ if (status == kErrorOverflow ) {
242230 logger_.printInfo (" Integer overflow forming NE matrix\n " );
243231 overflow_NE = true ;
244232 }
@@ -261,7 +249,7 @@ Int FactorHighsSolver::chooseNla() {
261249 Int AS_status = kkt_.buildASstructure ();
262250 if (!AS_status) AS_status = analyseAS (symb_AS);
263251 if (AS_status) failure_AS = true ;
264- if (AS_status == kStatusOverflow ) {
252+ if (AS_status == kErrorOverflow ) {
265253 logger_.printInfo (" Integer overflow forming AS matrix\n " );
266254 overflow_AS = true ;
267255 }
@@ -301,11 +289,10 @@ Int FactorHighsSolver::chooseNla() {
301289 run_analyse_AS ();
302290 }
303291
304- Int status = kStatusOk ;
292+ Int status = kOk ;
305293
306294 std::stringstream log_stream;
307295
308- // Decision may be forced by failures
309296 if (failure_NE && !failure_AS) {
310297 options_.nla = kHipoAugmentedString ;
311298 log_stream << textline (" Newton system:" ) << " AS preferred (NE failed)\n " ;
@@ -314,9 +301,9 @@ Int FactorHighsSolver::chooseNla() {
314301 log_stream << textline (" Newton system:" ) << " NE preferred (AS failed)\n " ;
315302 } else if (failure_AS && failure_NE) {
316303 if (overflow_AS && overflow_NE)
317- status = kStatusOverflow ;
304+ status = kErrorOverflow ;
318305 else
319- status = kStatusErrorAnalyse ;
306+ status = kErrorAnalyse ;
320307
321308 logger_.printe (" Both NE and AS failed analyse phase\n " );
322309 } else {
@@ -325,7 +312,6 @@ Int FactorHighsSolver::chooseNla() {
325312 double ops_NE = symb_NE.flops () + symb_NE.spops () * kSpopsWeight ;
326313 double ops_AS = symb_AS.flops () + symb_AS.spops () * kSpopsWeight ;
327314
328- // Average size of supernodes
329315 double sn_size_NE = (double )symb_NE.size () / symb_NE.sn ();
330316 double sn_size_AS = (double )symb_AS.size () / symb_AS.sn ();
331317
@@ -348,7 +334,7 @@ Int FactorHighsSolver::chooseNla() {
348334
349335 logger_.print (log_stream.str ().c_str ());
350336
351- if (status == kStatusOk ) {
337+ if (status == kOk ) {
352338 if (options_.nla == kHipoAugmentedString ) {
353339 kkt_.S = std::move (symb_AS);
354340 kkt_.freeNEmemory ();
@@ -370,7 +356,6 @@ Int FactorHighsSolver::chooseOrdering(const std::vector<Int>& rows,
370356 // - If ordering is "amd", "metis", "rcm" run only the ordering requested.
371357 // - If ordering is "choose", run "amd", "metis", and choose the best.
372358
373- // select which fill-reducing orderings should be tried
374359 std::vector<std::string> orderings_to_try;
375360 if (options_.ordering != kHighsChooseString )
376361 orderings_to_try.push_back (options_.ordering );
@@ -387,7 +372,7 @@ Int FactorHighsSolver::chooseOrdering(const std::vector<Int>& rows,
387372 if (nla == " NE" ) {
388373 if (ptr.back () >= kkt_.NE_nz_limit .load (std::memory_order_relaxed)) {
389374 logger_.printInfo (" NE interrupted\n " );
390- return kStatusErrorAnalyse ;
375+ return kErrorAnalyse ;
391376 }
392377 }
393378
@@ -516,7 +501,7 @@ Int FactorHighsSolver::chooseOrdering(const std::vector<Int>& rows,
516501 ordering = orderings_to_try[chosen];
517502 }
518503
519- return num_success > 0 ? kStatusOk : kStatusErrorAnalyse ;
504+ return num_success > 0 ? kOk : kErrorAnalyse ;
520505}
521506
522507Int FactorHighsSolver::setNla () {
@@ -530,24 +515,24 @@ Int FactorHighsSolver::setNla() {
530515 if (options_.nla == kHipoAugmentedString ) {
531516 Int status = kkt_.buildASstructure ();
532517 if (!status) status = analyseAS (kkt_.S );
533- if (status == kStatusOverflow ) {
518+ if (status == kErrorOverflow ) {
534519 logger_.printe (" AS requested, integer overflow\n " );
535- return kStatusOverflow ;
520+ return kErrorOverflow ;
536521 } else if (status) {
537522 logger_.printe (" AS requested, failed analyse phase\n " );
538- return kStatusErrorAnalyse ;
523+ return kErrorAnalyse ;
539524 }
540525 log_stream << textline (" Newton system:" ) << " AS requested\n " ;
541526
542527 } else if (options_.nla == kHipoNormalEqString ) {
543528 Int status = kkt_.buildNEstructure ();
544529 if (!status) status = analyseNE (kkt_.S );
545- if (status == kStatusOverflow ) {
530+ if (status == kErrorOverflow ) {
546531 logger_.printe (" NE requested, integer overflow\n " );
547- return kStatusOverflow ;
532+ return kErrorOverflow ;
548533 } else if (status) {
549534 logger_.printe (" NE requested, failed analyse phase\n " );
550- return kStatusErrorAnalyse ;
535+ return kErrorAnalyse ;
551536 }
552537 log_stream << textline (" Newton system:" ) << " NE requested\n " ;
553538
@@ -564,15 +549,14 @@ Int FactorHighsSolver::setNla() {
564549 << ' \n ' ;
565550 logger_.print (log_stream.str ().c_str ());
566551
567- return kStatusOk ;
552+ return kOk ;
568553}
569554
570555static bool usingAppleBlas () {
571556 return strstr (HighsExtras::blas::getInfo ()->provider , " Apple" ) != nullptr ;
572557}
573558
574559void FactorHighsSolver::setParallel () {
575- // Set parallel options
576560 bool parallel_tree = false ;
577561 bool parallel_node = false ;
578562
0 commit comments