Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitialized member variables - part 2 #1815

Merged
merged 9 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/io/HMpsFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/lp_data/HighsModelUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ bool hasNamesWithSpaces(const HighsLogOptions& log_options,
const std::vector<std::string>& 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,
Expand Down
12 changes: 7 additions & 5 deletions src/mip/HighsCliqueTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<int>(
globaldomain.col_lower_[v.col]) ==
static_cast<int>(1 - v.val);
}),
clique.end());
}
Expand Down Expand Up @@ -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<int>(
globaldomain.col_lower_[v.col]) ==
static_cast<int>(1 - v.val);
}),
extensionvars.end());

Expand Down
49 changes: 21 additions & 28 deletions src/mip/HighsDebugSol.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<HighsInt>& newColIndex) const {}
void shrink(const std::vector<HighsInt>&) 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<HighsDomain::ConflictSet::LocalDomChg>& reasonSideFrontier,
const std::vector<HighsDomainChange>& domchgstack) const {}
const std::set<HighsDomain::ConflictSet::LocalDomChg>&,
const std::vector<HighsDomainChange>&) const {}

void checkConflictReconvergenceFrontier(
const std::set<HighsDomain::ConflictSet::LocalDomChg>&
reconvergenceFrontier,
const HighsDomain::ConflictSet::LocalDomChg& reconvDomchgPos,
const std::vector<HighsDomainChange>& domchgstack) const {}
const std::set<HighsDomain::ConflictSet::LocalDomChg>&,
const HighsDomain::ConflictSet::LocalDomChg&,
const std::vector<HighsDomainChange>&) const {}
};
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/mip/HighsGFkSolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <>
Expand Down
14 changes: 7 additions & 7 deletions src/mip/HighsMipSolverData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions src/mip/HighsMipSolverData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/parallel/HighsMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int>::max(), std::memory_order_release);

if (prevState != 1) {
unsigned int notifyWorkerId = (prevState >> 1) - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/qpsolver/a_quass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/qpsolver/steepestedgepricing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class SteepestEdgePricing : public Pricing {

std::vector<int> correct_weights;
std::vector<int> incorrect_weights;
bool ret = true;
for (int i=0; i<runtime.instance.num_var; i++) {
bool correct = check_weight(i);
if (correct) {
Expand Down Expand Up @@ -132,7 +131,7 @@ class SteepestEdgePricing : public Pricing {

QpVector delta = basis.ftran(aq);

double old_weight_p_updated = weights[rowindex_p];
//double old_weight_p_updated = weights[rowindex_p];
// exact weight coming in needs to come in before update.
double old_weight_p_computed = ep.dot(ep);

Expand Down
2 changes: 1 addition & 1 deletion src/simplex/HEkkDual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 5 additions & 5 deletions src/simplex/HEkkDualRow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -212,10 +212,10 @@ HighsInt HEkkDualRow::chooseFinal() {

// 3. Choose large alpha
analysis->simplexTimerStart(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);
Expand Down
2 changes: 1 addition & 1 deletion src/simplex/HEkkPrimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
39 changes: 34 additions & 5 deletions src/util/HFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -304,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
Expand Down Expand Up @@ -339,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;

Expand Down
Loading