Skip to content

Commit 15e192f

Browse files
committed
Added test code in 1.9.0
1 parent 66f735e commit 15e192f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/lp_data/Highs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4607,6 +4607,8 @@ void Highs::reportSolvedLpQpStats() {
46074607
const double relative_primal_dual_gap =
46084608
std::fabs(info_.objective_function_value - dual_objective_value) /
46094609
std::max(1.0, std::fabs(info_.objective_function_value));
4610+
printf("P-D: primal objective = %g\n", info_.objective_function_value);
4611+
printf("P-D: dual objective = %g\n", dual_objective_value);
46104612
highsLogUser(log_options, HighsLogType::kInfo,
46114613
"Relative P-D gap : %17.10e\n", relative_primal_dual_gap);
46124614
}

src/lp_data/HighsSolution.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@ bool computeDualObjectiveValue(const HighsLp& lp, const HighsSolution& solution,
625625

626626
dual_objective_value = lp.offset_;
627627
double bound = 0;
628+
assert(HighsInt(lp.col_lower_.size()) >= lp.num_col_);
629+
assert(HighsInt(lp.col_upper_.size()) >= lp.num_col_);
630+
assert(HighsInt(lp.row_lower_.size()) >= lp.num_row_);
631+
assert(HighsInt(lp.row_upper_.size()) >= lp.num_row_);
628632
for (HighsInt iVar = 0; iVar < lp.num_col_ + lp.num_row_; iVar++) {
629633
const bool is_col = iVar < lp.num_col_;
630634
const HighsInt iRow = iVar - lp.num_col_;
@@ -634,6 +638,7 @@ bool computeDualObjectiveValue(const HighsLp& lp, const HighsSolution& solution,
634638
is_col ? solution.col_dual[iVar] : solution.row_dual[iRow];
635639
const double lower = is_col ? lp.col_lower_[iVar] : lp.row_lower_[iRow];
636640
const double upper = is_col ? lp.col_upper_[iVar] : lp.row_upper_[iRow];
641+
if (!is_col) assert(iRow < lp.num_row_);
637642
if (lower <= -kHighsInf && upper >= kHighsInf) {
638643
// Free
639644
bound = 1;
@@ -642,6 +647,12 @@ bool computeDualObjectiveValue(const HighsLp& lp, const HighsSolution& solution,
642647
bound = primal < mid ? lower : upper;
643648
}
644649
dual_objective_value += bound * dual;
650+
if (bound * dual)
651+
printf(
652+
"computeDualObjectiveValue: %s %6d: bound = %11.5g; dual = %11.5g; "
653+
"objective = %11.5g\n",
654+
is_col ? "col" : "row", is_col ? int(iVar) : int(iRow), bound, dual,
655+
dual_objective_value);
645656
}
646657
return true;
647658
}

src/simplex/HEkk.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,13 @@ HighsStatus HEkk::solve(const bool force_phase2) {
11411141
reportSimplexPhaseIterations(options_->log_options, iteration_count_, info_);
11421142
if (return_status == HighsStatus::kError)
11431143
return returnFromEkkSolve(return_status);
1144+
printf("EKK max_primal_infeasibility = %g\n",
1145+
info_.max_primal_infeasibility);
1146+
printf("EKK sum_primal_infeasibilities = %g\n",
1147+
info_.sum_primal_infeasibilities);
1148+
printf("EKK max_ dual_infeasibility = %g\n", info_.max_dual_infeasibility);
1149+
printf("EKK sum_ dual_infeasibilities = %g\n",
1150+
info_.sum_dual_infeasibilities);
11441151
highsLogDev(options_->log_options, HighsLogType::kInfo,
11451152
"EKK %s simplex solver returns %" HIGHSINT_FORMAT
11461153
" primal and %" HIGHSINT_FORMAT

0 commit comments

Comments
 (0)