Skip to content

Commit 64f1a96

Browse files
committed
Merge branch 'latest' into hi-pdlp
2 parents ceec5a4 + 3b8074d commit 64f1a96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+901
-420
lines changed

check/TestPresolve.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,3 +839,27 @@ TEST_CASE("presolve-egout-ac", "[highs_test_presolve]") {
839839

840840
h.resetGlobalScheduler(true);
841841
}
842+
843+
TEST_CASE("dual-bound-tightening", "[highs_test_presolve]") {
844+
std::string model_file =
845+
std::string(HIGHS_DIR) + "/check/instances/gesa2.mps";
846+
847+
Highs highs;
848+
highs.setOptionValue("output_flag", dev_run);
849+
highs.readModel(model_file);
850+
851+
// complement variables to get code coverage
852+
HighsLp lp = highs.getLp();
853+
std::transform(lp.a_matrix_.value_.begin(), lp.a_matrix_.value_.end(),
854+
lp.a_matrix_.value_.begin(), [](double v) { return -v; });
855+
std::transform(lp.col_cost_.begin(), lp.col_cost_.end(), lp.col_cost_.begin(),
856+
[](double v) { return -v; });
857+
std::transform(lp.col_upper_.begin(), lp.col_upper_.end(),
858+
lp.col_upper_.begin(), [](double v) { return -v; });
859+
std::transform(lp.col_lower_.begin(), lp.col_lower_.end(),
860+
lp.col_lower_.begin(), [](double v) { return -v; });
861+
std::swap(lp.col_lower_, lp.col_upper_);
862+
863+
highs.passModel(lp);
864+
REQUIRE(highs.presolve() == HighsStatus::kOk);
865+
}

docs/HiGHS_CopyrightHeaderUpdateAll

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
./HiGHS_CopyrightHeader.pl ../highs/interfaces/*.hpp
77
./HiGHS_CopyrightHeader.pl ../highs/io/*.cpp
88
./HiGHS_CopyrightHeader.pl ../highs/io/*.h
9-
./HiGHS_CopyrightHeader.pl ../highs/mip/*.cpp
10-
./HiGHS_CopyrightHeader.pl ../highs/mip/*.h
119
./HiGHS_CopyrightHeader.pl ../highs/lp_data/*.h
1210
./HiGHS_CopyrightHeader.pl ../highs/lp_data/*.cpp
13-
./HiGHS_CopyrightHeader.pl ../highs/pdlp/*.cpp
11+
./HiGHS_CopyrightHeader.pl ../highs/mip/*.cpp
12+
./HiGHS_CopyrightHeader.pl ../highs/mip/*.h
13+
./HiGHS_CopyrightHeader.pl ../highs/mip/*.hh
14+
./HiGHS_CopyrightHeader.pl ../highs/model/*.h
15+
./HiGHS_CopyrightHeader.pl ../highs/model/*.cpp
16+
./HiGHS_CopyrightHeader.pl ../highs/parallel/*.h
17+
./HiGHS_CopyrightHeader.pl ../highs/parallel/*.cpp
1418
./HiGHS_CopyrightHeader.pl ../highs/pdlp/*.h
19+
./HiGHS_CopyrightHeader.pl ../highs/pdlp/*.cpp
20+
./HiGHS_CopyrightHeader.pl ../highs/pdlp/hipdlp/*.hpp
21+
./HiGHS_CopyrightHeader.pl ../highs/pdlp/hipdlp/*.cc
1522
./HiGHS_CopyrightHeader.pl ../highs/presolve/*.cpp
1623
./HiGHS_CopyrightHeader.pl ../highs/presolve/*.h
24+
./HiGHS_CopyrightHeader.pl ../highs/qpsolver/*.cpp
25+
./HiGHS_CopyrightHeader.pl ../highs/qpsolver/*.hpp
1726
./HiGHS_CopyrightHeader.pl ../highs/simplex/*.h
1827
./HiGHS_CopyrightHeader.pl ../highs/simplex/*.cpp
1928
./HiGHS_CopyrightHeader.pl ../highs/test_kkt/*.h

highs/mip/HighsMipSolver.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,14 +853,16 @@ void HighsMipSolver::cleanupSolve() {
853853
" Repair LPs 0\n");
854854
}
855855
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
856-
" LP iterations %llu\n"
857-
" %llu (strong br.)\n"
858-
" %llu (separation)\n"
859-
" %llu (heuristics)\n",
860-
(long long unsigned)mipdata_->total_lp_iterations,
861-
(long long unsigned)mipdata_->sb_lp_iterations,
862-
(long long unsigned)mipdata_->sepa_lp_iterations,
863-
(long long unsigned)mipdata_->heuristic_lp_iterations);
856+
" LP iterations %llu\n",
857+
(long long unsigned)mipdata_->total_lp_iterations);
858+
if (mipdata_->total_lp_iterations)
859+
highsLogUser(options_mip_->log_options, HighsLogType::kInfo,
860+
" %llu (strong br.)\n"
861+
" %llu (separation)\n"
862+
" %llu (heuristics)\n",
863+
(long long unsigned)mipdata_->sb_lp_iterations,
864+
(long long unsigned)mipdata_->sepa_lp_iterations,
865+
(long long unsigned)mipdata_->heuristic_lp_iterations);
864866

865867
if (!timeless_log) analysis_.reportMipTimer();
866868

highs/mip/HighsPseudocost.h

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class HighsPostsolveStack;
2424

2525
class HighsPseudocost;
2626

27+
constexpr double minThreshold = 1e-6;
28+
2729
struct HighsPseudocostInitialization {
2830
std::vector<double> pseudocostup;
2931
std::vector<double> pseudocostdown;
@@ -47,6 +49,7 @@ struct HighsPseudocostInitialization {
4749
const HighsPseudocost& pscost, HighsInt maxCount,
4850
const presolve::HighsPostsolveStack& postsolveStack);
4951
};
52+
5053
class HighsPseudocost {
5154
friend struct HighsPseudocostInitialization;
5255
std::vector<double> pseudocostup;
@@ -77,9 +80,7 @@ class HighsPseudocost {
7780
HighsPseudocost(const HighsMipSolver& mipsolver);
7881

7982
void subtractBase(const HighsPseudocost& base) {
80-
HighsInt ncols = pseudocostup.size();
81-
82-
for (HighsInt i = 0; i != ncols; ++i) {
83+
for (size_t i = 0; i != pseudocostup.size(); ++i) {
8384
pseudocostup[i] -= base.pseudocostup[i];
8485
pseudocostdown[i] -= base.pseudocostdown[i];
8586
nsamplesup[i] -= base.nsamplesup[i];
@@ -95,8 +96,7 @@ class HighsPseudocost {
9596
conflict_weight = 1.0;
9697
conflict_avg_score *= scale;
9798

98-
HighsInt numCol = conflictscoreup.size();
99-
for (HighsInt i = 0; i < numCol; ++i) {
99+
for (size_t i = 0; i != conflictscoreup.size(); ++i) {
100100
conflictscoreup[i] *= scale;
101101
conflictscoredown[i] *= scale;
102102
}
@@ -248,11 +248,13 @@ class HighsPseudocost {
248248
}
249249

250250
double getScore(HighsInt col, double upcost, double downcost) const {
251-
double costScore = std::max(upcost, 1e-6) * std::max(downcost, 1e-6) /
252-
std::max(1e-6, cost_total * cost_total);
253-
double inferenceScore = std::max(inferencesup[col], 1e-6) *
254-
std::max(inferencesdown[col], 1e-6) /
255-
std::max(1e-6, inferences_total * inferences_total);
251+
double costScore = std::max(upcost, minThreshold) *
252+
std::max(downcost, minThreshold) /
253+
std::max(minThreshold, cost_total * cost_total);
254+
double inferenceScore =
255+
std::max(inferencesup[col], minThreshold) *
256+
std::max(inferencesdown[col], minThreshold) /
257+
std::max(minThreshold, inferences_total * inferences_total);
256258

257259
double cutOffScoreUp =
258260
ncutoffsup[col] /
@@ -266,18 +268,19 @@ class HighsPseudocost {
266268
std::max(1.0, static_cast<double>(ncutoffstotal) +
267269
static_cast<double>(nsamplestotal));
268270

269-
double cutoffScore = std::max(cutOffScoreUp, 1e-6) *
270-
std::max(cutOffScoreDown, 1e-6) /
271-
std::max(1e-6, avgCutoffs * avgCutoffs);
271+
double cutoffScore = std::max(cutOffScoreUp, minThreshold) *
272+
std::max(cutOffScoreDown, minThreshold) /
273+
std::max(minThreshold, avgCutoffs * avgCutoffs);
272274

273275
double conflictScoreUp = conflictscoreup[col] / conflict_weight;
274276
double conflictScoreDown = conflictscoredown[col] / conflict_weight;
275277
double conflictScoreAvg =
276278
conflict_avg_score /
277279
(conflict_weight * static_cast<double>(conflictscoreup.size()));
278-
double conflictScore = std::max(conflictScoreUp, 1e-6) *
279-
std::max(conflictScoreDown, 1e-6) /
280-
std::max(1e-6, conflictScoreAvg * conflictScoreAvg);
280+
double conflictScore =
281+
std::max(conflictScoreUp, minThreshold) *
282+
std::max(conflictScoreDown, minThreshold) /
283+
std::max(minThreshold, conflictScoreAvg * conflictScoreAvg);
281284

282285
auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); };
283286
return mapScore(costScore) / degeneracyFactor +
@@ -294,9 +297,10 @@ class HighsPseudocost {
294297
}
295298

296299
double getScoreUp(HighsInt col, double frac) const {
297-
double costScore = getPseudocostUp(col, frac) / std::max(1e-6, cost_total);
300+
double costScore =
301+
getPseudocostUp(col, frac) / std::max(minThreshold, cost_total);
298302
double inferenceScore =
299-
inferencesup[col] / std::max(1e-6, inferences_total);
303+
inferencesup[col] / std::max(minThreshold, inferences_total);
300304

301305
double cutOffScoreUp =
302306
ncutoffsup[col] /
@@ -306,13 +310,14 @@ class HighsPseudocost {
306310
std::max(1.0, static_cast<double>(ncutoffstotal) +
307311
static_cast<double>(nsamplestotal));
308312

309-
double cutoffScore = cutOffScoreUp / std::max(1e-6, avgCutoffs);
313+
double cutoffScore = cutOffScoreUp / std::max(minThreshold, avgCutoffs);
310314

311315
double conflictScoreUp = conflictscoreup[col] / conflict_weight;
312316
double conflictScoreAvg =
313317
conflict_avg_score /
314318
(conflict_weight * static_cast<double>(conflictscoreup.size()));
315-
double conflictScore = conflictScoreUp / std::max(1e-6, conflictScoreAvg);
319+
double conflictScore =
320+
conflictScoreUp / std::max(minThreshold, conflictScoreAvg);
316321

317322
auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); };
318323

@@ -323,9 +328,9 @@ class HighsPseudocost {
323328

324329
double getScoreDown(HighsInt col, double frac) const {
325330
double costScore =
326-
getPseudocostDown(col, frac) / std::max(1e-6, cost_total);
331+
getPseudocostDown(col, frac) / std::max(minThreshold, cost_total);
327332
double inferenceScore =
328-
inferencesdown[col] / std::max(1e-6, inferences_total);
333+
inferencesdown[col] / std::max(minThreshold, inferences_total);
329334

330335
double cutOffScoreDown =
331336
ncutoffsdown[col] /
@@ -335,13 +340,14 @@ class HighsPseudocost {
335340
std::max(1.0, static_cast<double>(ncutoffstotal) +
336341
static_cast<double>(nsamplestotal));
337342

338-
double cutoffScore = cutOffScoreDown / std::max(1e-6, avgCutoffs);
343+
double cutoffScore = cutOffScoreDown / std::max(minThreshold, avgCutoffs);
339344

340345
double conflictScoreDown = conflictscoredown[col] / conflict_weight;
341346
double conflictScoreAvg =
342347
conflict_avg_score /
343348
(conflict_weight * static_cast<double>(conflictscoredown.size()));
344-
double conflictScore = conflictScoreDown / std::max(1e-6, conflictScoreAvg);
349+
double conflictScore =
350+
conflictScoreDown / std::max(minThreshold, conflictScoreAvg);
345351

346352
auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); };
347353

highs/mip/feasibilityjump.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2+
/* */
3+
/* This file is part of the HiGHS linear optimization suite */
4+
/* */
5+
/* Available as open-source under the MIT License */
6+
/* */
7+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
18
#include <algorithm>
29
#include <cassert>
310
#include <climits>

highs/model/HighsHessian.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */
5-
/* Written and engineered 2008-2021 at the University of Edinburgh */
6-
/* */
75
/* Available as open-source under the MIT License */
86
/* */
9-
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
10-
/* and Michael Feldmeier */
11-
/* */
127
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138
/**@file lp_data/HighsHessian.cpp
149
* @brief

highs/model/HighsHessian.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */
5-
/* Written and engineered 2008-2021 at the University of Edinburgh */
6-
/* */
75
/* Available as open-source under the MIT License */
86
/* */
9-
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
10-
/* and Michael Feldmeier */
11-
/* */
127
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138
/**@file model/HighsHessian.h
149
* @brief

highs/model/HighsHessianUtils.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */
5-
/* Written and engineered 2008-2021 at the University of Edinburgh */
6-
/* */
75
/* Available as open-source under the MIT License */
86
/* */
9-
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
10-
/* and Michael Feldmeier */
11-
/* */
127
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138
/**@file lp_data/HighsHessianUtils.cpp
149
* @brief

highs/model/HighsHessianUtils.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */
5-
/* Written and engineered 2008-2021 at the University of Edinburgh */
6-
/* */
75
/* Available as open-source under the MIT License */
86
/* */
9-
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
10-
/* and Michael Feldmeier */
11-
/* */
127
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138
/**@file model/HighsHessianUtils.h
149
* @brief Class-independent utilities for HiGHS

highs/model/HighsModel.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
/* */
33
/* This file is part of the HiGHS linear optimization suite */
44
/* */
5-
/* Written and engineered 2008-2021 at the University of Edinburgh */
6-
/* */
75
/* Available as open-source under the MIT License */
86
/* */
9-
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
10-
/* and Michael Feldmeier */
11-
/* */
127
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
138
/**@file lp_data/HighsModel.cpp
149
* @brief

0 commit comments

Comments
 (0)