From 032b4990a951f21248e3e74d7da5d5a4b5f994c5 Mon Sep 17 00:00:00 2001 From: fwesselm Date: Fri, 21 Jun 2024 15:01:02 +0200 Subject: [PATCH 1/9] Add constructor in HFactor.h and other minor things --- src/mip/HighsCliqueTable.cpp | 2 +- src/qpsolver/steepestedgepricing.hpp | 3 +-- src/simplex/HEkkDualRow.cpp | 8 ++++---- src/util/HFactor.h | 29 ++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/mip/HighsCliqueTable.cpp b/src/mip/HighsCliqueTable.cpp index 9a51cda7f9..123a479158 100644 --- a/src/mip/HighsCliqueTable.cpp +++ b/src/mip/HighsCliqueTable.cpp @@ -189,7 +189,7 @@ void HighsCliqueTable::bronKerboschRecurse(BronKerboschData& data, if (data.stop()) return; double pivweight = -1.0; - CliqueVar pivot; + CliqueVar pivot{0, 0}; for (HighsInt i = 0; i != Xlen; ++i) { if (X[i].weight(data.sol) > pivweight) { diff --git a/src/qpsolver/steepestedgepricing.hpp b/src/qpsolver/steepestedgepricing.hpp index 0002bd6e13..0a216394ee 100644 --- a/src/qpsolver/steepestedgepricing.hpp +++ b/src/qpsolver/steepestedgepricing.hpp @@ -91,7 +91,6 @@ class SteepestEdgePricing : public Pricing { std::vector correct_weights; std::vector incorrect_weights; - bool ret = true; for (int i=0; isimplexTimerStart(Chuzc4bClock); - HighsInt breakIndex; - HighsInt breakGroup; - HighsInt alt_breakIndex; - HighsInt alt_breakGroup; + HighsInt breakIndex = -1; + HighsInt breakGroup = -1; + HighsInt alt_breakIndex = -1; + HighsInt alt_breakGroup = -1; if (use_quad_sort) chooseFinalLargeAlpha(breakIndex, breakGroup, workCount, workData, workGroup); diff --git a/src/util/HFactor.h b/src/util/HFactor.h index a846c9c528..f4057b88ee 100644 --- a/src/util/HFactor.h +++ b/src/util/HFactor.h @@ -105,6 +105,35 @@ struct InvertibleRepresentation { */ class HFactor { public: + HFactor() + : build_realTick(0.0), + build_synthetic_tick(0.0), + rank_deficiency(0), + basis_matrix_num_el(0), + invert_num_el(0), + kernel_dim(0), + kernel_num_el(0), + num_row(0), + num_col(0), + num_basic(0), + a_matrix_valid(false), + a_start(nullptr), + a_index(nullptr), + a_value(nullptr), + basic_index(nullptr), + pivot_threshold(0.0), + pivot_tolerance(0.0), + highs_debug_level(0), + time_limit_(0.0), + use_original_HFactor_logic(false), + debug_report_(false), + basis_matrix_limit_size(0), + update_method(0), + build_timer_(nullptr), + nwork(0), + u_merit_x(0), + u_total_x(0){}; + /** * @brief Copy problem size and pointers of constraint matrix, and set * up space for INVERT From 4418ec5f810dec57bbeef366a85c8cb96b608ca2 Mon Sep 17 00:00:00 2001 From: fwesselm Date: Fri, 21 Jun 2024 15:05:01 +0200 Subject: [PATCH 2/9] Make compiler happy --- src/simplex/HEkkDual.cpp | 2 +- src/simplex/HEkkPrimal.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simplex/HEkkDual.cpp b/src/simplex/HEkkDual.cpp index 30d42a96a2..6a6ca9d13e 100644 --- a/src/simplex/HEkkDual.cpp +++ b/src/simplex/HEkkDual.cpp @@ -1063,7 +1063,7 @@ void HEkkDual::rebuild() { // Note that computePrimalObjectiveValue sets // has_primal_objective_value const bool check_updated_objective_value = status.has_dual_objective_value; - double previous_dual_objective_value; + double previous_dual_objective_value = -kHighsInf; if (check_updated_objective_value) { // debugUpdatedObjectiveValue(ekk_instance_, algorithm, solve_phase, // "Before computeDual"); diff --git a/src/simplex/HEkkPrimal.cpp b/src/simplex/HEkkPrimal.cpp index 8c9787cee4..9a258ad90e 100644 --- a/src/simplex/HEkkPrimal.cpp +++ b/src/simplex/HEkkPrimal.cpp @@ -697,7 +697,7 @@ void HEkkPrimal::rebuild() { // basic variables, and baseValue only corresponds to the new // ordering once computePrimal has been called const bool check_updated_objective_value = status.has_primal_objective_value; - double previous_primal_objective_value; + double previous_primal_objective_value = -kHighsInf; if (check_updated_objective_value) { // debugUpdatedObjectiveValue(ekk_instance_, algorithm, solve_phase, // "Before INVERT"); From b831faa63810ce9b0bff2a5b406e96e69e5ac824 Mon Sep 17 00:00:00 2001 From: fwesselm Date: Fri, 21 Jun 2024 15:09:24 +0200 Subject: [PATCH 3/9] WIP --- src/util/HFactor.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/HFactor.h b/src/util/HFactor.h index f4057b88ee..d06a79af67 100644 --- a/src/util/HFactor.h +++ b/src/util/HFactor.h @@ -333,10 +333,10 @@ class HFactor { RefactorInfo refactor_info_; // Properties of data held in HFactor.h - HighsInt basis_matrix_num_el = 0; - HighsInt invert_num_el = 0; - HighsInt kernel_dim = 0; - HighsInt kernel_num_el = 0; + HighsInt basis_matrix_num_el; + HighsInt invert_num_el; + HighsInt kernel_dim; + HighsInt kernel_num_el; /** * Data of the factor @@ -368,7 +368,7 @@ class HFactor { HighsLogOptions log_options; bool use_original_HFactor_logic; - bool debug_report_ = false; + bool debug_report_; HighsInt basis_matrix_limit_size; HighsInt update_method; From 38578b2c40a9059cdd709fc0315fe687f97186fa Mon Sep 17 00:00:00 2001 From: fwesselm Date: Fri, 21 Jun 2024 15:19:56 +0200 Subject: [PATCH 4/9] Fix two warnings --- src/qpsolver/a_quass.cpp | 2 +- src/simplex/HEkkDualRow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qpsolver/a_quass.cpp b/src/qpsolver/a_quass.cpp index a8e2583b12..b62d22ebc9 100644 --- a/src/qpsolver/a_quass.cpp +++ b/src/qpsolver/a_quass.cpp @@ -157,7 +157,7 @@ QpAsmStatus solveqp(Instance& instance, } // solve - QpAsmStatus status = solveqp_actual(instance, settings, startinfo, stats, qp_model_status, qp_solution, qp_timer); + solveqp_actual(instance, settings, startinfo, stats, qp_model_status, qp_solution, qp_timer); // undo perturbation and resolve diff --git a/src/simplex/HEkkDualRow.cpp b/src/simplex/HEkkDualRow.cpp index 11813c6ab3..6f0e00bc6c 100644 --- a/src/simplex/HEkkDualRow.cpp +++ b/src/simplex/HEkkDualRow.cpp @@ -186,7 +186,7 @@ HighsInt HEkkDualRow::chooseFinal() { alt_workCount = workCount; } analysis->simplexTimerStart(Chuzc4Clock); - bool choose_ok; + bool choose_ok = false; if (use_quad_sort) { // Use the O(n^2) quadratic sort for the candidates analysis->simplexTimerStart(Chuzc4a0Clock); From 71fc39ea9f710d40f46000d4e5348635d1a6b49a Mon Sep 17 00:00:00 2001 From: fwesselm Date: Mon, 24 Jun 2024 10:26:07 +0200 Subject: [PATCH 5/9] Unreferenced parameters --- src/mip/HighsDebugSol.h | 49 ++++++++++++++++++----------------------- src/mip/HighsGFkSolve.h | 2 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/mip/HighsDebugSol.h b/src/mip/HighsDebugSol.h index 9c8852ad9b..ddce632c45 100644 --- a/src/mip/HighsDebugSol.h +++ b/src/mip/HighsDebugSol.h @@ -88,54 +88,47 @@ struct HighsDebugSol { #else struct HighsDebugSol { - HighsDebugSol(HighsMipSolver& mipsolver) {} + HighsDebugSol(HighsMipSolver&) {} void newIncumbentFound() const {} void activate() const {} - void shrink(const std::vector& newColIndex) const {} + void shrink(const std::vector&) const {} - void registerDomain(const HighsDomain& domain) const {} + void registerDomain(const HighsDomain&) const {} - void boundChangeAdded(const HighsDomain& domain, - const HighsDomainChange& domchg, - bool branching = false) const {} + void boundChangeAdded(const HighsDomain&, const HighsDomainChange&, + bool = false) const {} - void boundChangeRemoved(const HighsDomain& domain, - const HighsDomainChange& domchg) const {} + void boundChangeRemoved(const HighsDomain&, const HighsDomainChange&) const {} - void resetDomain(const HighsDomain& domain) const {} + void resetDomain(const HighsDomain&) const {} - void nodePruned(const HighsDomain& localdomain) const {} + void nodePruned(const HighsDomain&) const {} - void checkCut(const HighsInt* Rindex, const double* Rvalue, HighsInt Rlen, - double rhs) const {} + void checkCut(const HighsInt*, const double*, HighsInt, double) const {} - void checkRow(const HighsInt* Rindex, const double* Rvalue, HighsInt Rlen, - double Rlower, double Rupper) const {} + void checkRow(const HighsInt*, const double*, HighsInt, double, + double) const {} - void checkRowAggregation(const HighsLp& lp, const HighsInt* Rindex, - const double* Rvalue, HighsInt Rlen) const {} + void checkRowAggregation(const HighsLp&, const HighsInt*, const double*, + HighsInt) const {} - void checkClique(const HighsCliqueTable::CliqueVar* clq, - HighsInt clqlen) const {} + void checkClique(const HighsCliqueTable::CliqueVar*, HighsInt) const {} - void checkVub(HighsInt col, HighsInt vubcol, double vubcoef, - double vubconstant) const {} + void checkVub(HighsInt, HighsInt, double, double) const {} - void checkVlb(HighsInt col, HighsInt vlbcol, double vlbcoef, - double vlbconstant) const {} + void checkVlb(HighsInt, HighsInt, double, double) const {} void checkConflictReasonFrontier( - const std::set& reasonSideFrontier, - const std::vector& domchgstack) const {} + const std::set&, + const std::vector&) const {} void checkConflictReconvergenceFrontier( - const std::set& - reconvergenceFrontier, - const HighsDomain::ConflictSet::LocalDomChg& reconvDomchgPos, - const std::vector& domchgstack) const {} + const std::set&, + const HighsDomain::ConflictSet::LocalDomChg&, + const std::vector&) const {} }; #endif diff --git a/src/mip/HighsGFkSolve.h b/src/mip/HighsGFkSolve.h index 7cfd5a52e2..75519459de 100644 --- a/src/mip/HighsGFkSolve.h +++ b/src/mip/HighsGFkSolve.h @@ -39,7 +39,7 @@ struct HighsGFk; template <> struct HighsGFk<2> { static constexpr unsigned int powk(unsigned int a) { return a * a; } - static constexpr unsigned int inverse(unsigned int a) { return 1; } + static constexpr unsigned int inverse(unsigned int) { return 1; } }; template <> From 358f90e6567f19b2db3d3f6890475af350de75f9 Mon Sep 17 00:00:00 2001 From: fwesselm Date: Mon, 24 Jun 2024 14:01:08 +0200 Subject: [PATCH 6/9] Initialize member variables in HighsMipSolverData --- src/mip/HighsMipSolverData.h | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/mip/HighsMipSolverData.h b/src/mip/HighsMipSolverData.h index 07a17e23f6..cbf697fcfc 100644 --- a/src/mip/HighsMipSolverData.h +++ b/src/mip/HighsMipSolverData.h @@ -128,6 +128,46 @@ struct HighsMipSolverData { implications(mipsolver), heuristics(mipsolver), objectiveFunction(mipsolver), + presolve_status(HighsPresolveStatus::kNotSet), + cliquesExtracted(false), + rowMatrixSet(false), + analyticCenterComputed(false), + analyticCenterStatus(HighsModelStatus::kNotset), + detectSymmetries(false), + numRestarts(0), + numRestartsRoot(0), + numCliqueEntriesAfterPresolve(0), + numCliqueEntriesAfterFirstPresolve(0), + feastol(0.0), + epsilon(0.0), + heuristic_effort(0.0), + dispfreq(0), + firstlpsolobj(-kHighsInf), + rootlpsolobj(-kHighsInf), + numintegercols(0), + maxTreeSizeLog2(0), + pruned_treeweight(0), + avgrootlpiters(0.0), + last_disptime(0.0), + firstrootlpiters(0), + num_nodes(0), + num_leaves(0), + num_leaves_before_run(0), + num_nodes_before_run(0), + total_lp_iterations(0), + heuristic_lp_iterations(0), + sepa_lp_iterations(0), + sb_lp_iterations(0), + total_lp_iterations_before_run(0), + heuristic_lp_iterations_before_run(0), + sepa_lp_iterations_before_run(0), + sb_lp_iterations_before_run(0), + num_disp_lines(0), + numImprovingSols(0), + lower_bound(-kHighsInf), + upper_bound(kHighsInf), + upper_limit(kHighsInf), + optimality_limit(kHighsInf), debugSolution(mipsolver) { domain.addCutpool(cutpool); domain.addConflictPool(conflictPool); From 61c1a1bc4be3bdd9edeaf71be7ce0005b235b43e Mon Sep 17 00:00:00 2001 From: fwesselm Date: Mon, 24 Jun 2024 14:35:30 +0200 Subject: [PATCH 7/9] Two more warnings fixed --- src/mip/HighsCliqueTable.cpp | 10 ++++++---- src/parallel/HighsMutex.h | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mip/HighsCliqueTable.cpp b/src/mip/HighsCliqueTable.cpp index 123a479158..54490e08e0 100644 --- a/src/mip/HighsCliqueTable.cpp +++ b/src/mip/HighsCliqueTable.cpp @@ -2021,8 +2021,9 @@ void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain, std::remove_if(clique.begin(), clique.end(), [&](CliqueVar v) { return globaldomain.isFixed(v.col) && - int(globaldomain.col_lower_[v.col]) == - (1 - v.val); + static_cast( + globaldomain.col_lower_[v.col]) == + static_cast(1 - v.val); }), clique.end()); } @@ -2190,8 +2191,9 @@ void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain) { std::remove_if(extensionvars.begin(), extensionvars.end(), [&](CliqueVar v) { return globaldomain.isFixed(v.col) && - int(globaldomain.col_lower_[v.col]) == - (1 - v.val); + static_cast( + globaldomain.col_lower_[v.col]) == + static_cast(1 - v.val); }), extensionvars.end()); diff --git a/src/parallel/HighsMutex.h b/src/parallel/HighsMutex.h index cd39788ace..34d8b95541 100644 --- a/src/parallel/HighsMutex.h +++ b/src/parallel/HighsMutex.h @@ -114,7 +114,8 @@ class HighsMutex { } void unlock() { - unsigned int prevState = state.fetch_add(-1, std::memory_order_release); + unsigned int prevState = state.fetch_add( + std::numeric_limits::max(), std::memory_order_release); if (prevState != 1) { unsigned int notifyWorkerId = (prevState >> 1) - 1; From 397e0266c075d5fe4e20e897a54fccee92244df2 Mon Sep 17 00:00:00 2001 From: fwesselm Date: Mon, 24 Jun 2024 15:09:14 +0200 Subject: [PATCH 8/9] Two minor changes --- src/io/HMpsFF.cpp | 6 +++--- src/lp_data/HighsModelUtils.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/io/HMpsFF.cpp b/src/io/HMpsFF.cpp index cf18f204d5..14f0bf5dc0 100644 --- a/src/io/HMpsFF.cpp +++ b/src/io/HMpsFF.cpp @@ -2036,12 +2036,12 @@ double HMpsFF::getValue(const std::string& word, bool& is_nan, const HighsInt id) const { // Lambda to replace any d or D by E auto dD2e = [&](std::string& word) { - HighsInt ix = word.find("D"); - if (ix >= 0) { + size_t ix = word.find("D"); + if (ix != std::string::npos) { word.replace(ix, 1, "E"); } else { ix = word.find("d"); - if (ix >= 0) word.replace(ix, 1, "E"); + if (ix != std::string::npos) word.replace(ix, 1, "E"); } }; diff --git a/src/lp_data/HighsModelUtils.cpp b/src/lp_data/HighsModelUtils.cpp index 1e878740b0..6a60010282 100644 --- a/src/lp_data/HighsModelUtils.cpp +++ b/src/lp_data/HighsModelUtils.cpp @@ -319,8 +319,8 @@ bool hasNamesWithSpaces(const HighsLogOptions& log_options, const std::vector& names) { HighsInt num_names_with_spaces = 0; for (HighsInt ix = 0; ix < num_name; ix++) { - HighsInt space_pos = names[ix].find(" "); - if (space_pos >= 0) { + size_t space_pos = names[ix].find(" "); + if (space_pos != std::string::npos) { if (num_names_with_spaces == 0) { highsLogDev( log_options, HighsLogType::kInfo, From f9e8c3e2f97aefb10f120b6e6d84e8206e1f791f Mon Sep 17 00:00:00 2001 From: fwesselm Date: Tue, 25 Jun 2024 09:42:25 +0200 Subject: [PATCH 9/9] Fix output "generators" -> "generator(s)" --- src/mip/HighsMipSolverData.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mip/HighsMipSolverData.cpp b/src/mip/HighsMipSolverData.cpp index 4070dfb021..1d926134ab 100644 --- a/src/mip/HighsMipSolverData.cpp +++ b/src/mip/HighsMipSolverData.cpp @@ -183,17 +183,17 @@ void HighsMipSolverData::finishSymmetryDetection( "No symmetry present\n\n"); } else if (symmetries.orbitopes.size() == 0) { highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo, - "Found %" HIGHSINT_FORMAT " generators\n\n", + "Found %" HIGHSINT_FORMAT " generator(s)\n\n", symmetries.numGenerators); } else { if (symmetries.numPerms != 0) { - highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo, - "Found %" HIGHSINT_FORMAT " generators and %" HIGHSINT_FORMAT - " full orbitope(s) acting on %" HIGHSINT_FORMAT - " columns\n\n", - symmetries.numPerms, (HighsInt)symmetries.orbitopes.size(), - (HighsInt)symmetries.columnToOrbitope.size()); + highsLogUser( + mipsolver.options_mip_->log_options, HighsLogType::kInfo, + "Found %" HIGHSINT_FORMAT " generator(s) and %" HIGHSINT_FORMAT + " full orbitope(s) acting on %" HIGHSINT_FORMAT " columns\n\n", + symmetries.numPerms, (HighsInt)symmetries.orbitopes.size(), + (HighsInt)symmetries.columnToOrbitope.size()); } else { highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo, "Found %" HIGHSINT_FORMAT