Skip to content

Commit d751d4e

Browse files
committed
Now clean up hacked in pdlp_log_file
1 parent cf4c1e4 commit d751d4e

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1+
user/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */

highs/pdlp/hipdlp/scaling.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void Scaling::LogMatrixNorms(const std::string& stage) {
3939
}
4040

4141
// --- Calculate and Log Column Norms (Infinity Norm) ---
42-
std::cout << "Column Infinity Norms:" << std::endl;
42+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Column Infinity Norms:\n");
4343
for (HighsInt iCol = 0; iCol < lp.num_col_; ++iCol) {
4444
double max_abs_val = 0.0;
4545
for (HighsInt iEl = lp.a_matrix_.start_[iCol];
@@ -50,7 +50,7 @@ void Scaling::LogMatrixNorms(const std::string& stage) {
5050
}
5151

5252
// --- Calculate and Log Row Norms (Infinity Norm) ---
53-
std::cout << "Row Infinity Norms:" << std::endl;
53+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Row Infinity Norms:\n");
5454
std::vector<double> row_max_abs_vals(lp.num_row_, 0.0);
5555
for (HighsInt iCol = 0; iCol < lp.num_col_; ++iCol) {
5656
for (HighsInt iEl = lp.a_matrix_.start_[iCol];
@@ -69,23 +69,23 @@ void Scaling::LogMatrixNorms(const std::string& stage) {
6969

7070
void Scaling::scaleProblem() {
7171
if (params_->scaling_method == ScalingMethod::NONE) {
72-
std::cout << "No scaling applied." << std::endl;
72+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "No scaling applied\n");
7373
return;
7474
}
7575

76-
std::cout << "Applying scaling method: "
77-
<< static_cast<int>(params_->scaling_method) << std::endl;
76+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Applying scaling method: %d\n",
77+
static_cast<int>(params_->scaling_method));
7878
if (params_->use_pc_scaling) {
79-
std::cout << "Applying Pock-Chambolle scaling..." << std::endl;
79+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Applying Pock-Chambolle scaling...\n");
8080
ApplyPockChambolleScaling();
8181
}
8282
if (params_->use_ruiz_scaling) {
83-
std::cout << "Applying Ruiz scaling..." << std::endl;
83+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Applying Ruiz scaling...\n");
8484
ApplyRuizScaling();
8585
}
8686
if (params_->use_l2_scaling ||
8787
params_->scaling_method == ScalingMethod::L2_NORM) {
88-
std::cout << "Applying L2 norm scaling..." << std::endl;
88+
highsLogUser(params_->log_options_, HighsLogType::kInfo, "Applying L2 norm scaling...\n");
8989
ApplyL2Scaling();
9090
}
9191

@@ -140,8 +140,7 @@ void Scaling::ApplyRuizScaling() {
140140
}
141141
}
142142
} else {
143-
std::cerr << "Currently only support infinity norm for Ruiz scaling"
144-
<< std::endl;
143+
highsLogUser(params_->log_options_, HighsLogType::kError, "Currently only support infinity norm for Ruiz scaling\n");
145144
exit(1);
146145
}
147146

@@ -160,7 +159,7 @@ void Scaling::ApplyRuizScaling() {
160159

161160
void Scaling::ApplyPockChambolleScaling() {
162161
if (params_->pc_alpha < 0.0 || params_->pc_alpha > 2.0) {
163-
std::cerr << "PC alpha should be in [0, 2]" << std::endl;
162+
highsLogUser(params_->log_options_, HighsLogType::kError, "PC alpha should be in [0, 2]\n");
164163
exit(1);
165164
}
166165

highs/pdlp/hipdlp/step.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,11 @@ void PdlpStep::UpdateIteratesAdaptive(
225225
: // in cupdlp-c, the factor is 1
226226
std::numeric_limits<double>::infinity();
227227

228-
// std::cout << "Iteration " << inner_iterations << ": eta = " <<
229-
// current_eta
230-
// << ", movement = " << movement << ", nonlinearity = " <<
231-
// nonlinearity
232-
// << ", limit = " << step_size_limit << std::endl;
233-
228+
/*
229+
highsLogUser(*log_options_, HighsLogType::kInfo,
230+
"Iteration %d: eta = %g, movement = %g nonlinearity = %g, limit = %g\n",
231+
inner_iterations, current_eta, movement, nonlinearity. step_size_limit);
232+
*/
234233
if (current_eta <= step_size_limit) {
235234
// Accept the step
236235
x_new = x_candidate;

highs/pdlp/hipdlp/step.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ class PdlpStep {
7373
void passDebugLogFile(const FILE* pdlp_log_file) { pdlp_log_file_ = pdlp_log_file; };
7474
private:
7575
const HighsLp* lp_;
76+
// JAJH has only passed log_options_ into PdlpStep, leaving YZ to
77+
// handle "params" as she sees fit.
7678
const HighsLogOptions* log_options_;
79+
// JAJH has passed pdlp_log_file_ into PdlpStep separately, as it's
80+
// only temporary.
7781
const FILE* pdlp_log_file_;
7882
};
7983

0 commit comments

Comments
 (0)