Skip to content

Commit ebd456a

Browse files
authored
Merge pull request ERGO-Code#1815 from fwesselm/moreCompilerWarningsFun3
Uninitialized member variables - part 2
2 parents b3a96cb + f9e8c3e commit ebd456a

File tree

14 files changed

+126
-62
lines changed

14 files changed

+126
-62
lines changed

src/io/HMpsFF.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,12 +2036,12 @@ double HMpsFF::getValue(const std::string& word, bool& is_nan,
20362036
const HighsInt id) const {
20372037
// Lambda to replace any d or D by E
20382038
auto dD2e = [&](std::string& word) {
2039-
HighsInt ix = word.find("D");
2040-
if (ix >= 0) {
2039+
size_t ix = word.find("D");
2040+
if (ix != std::string::npos) {
20412041
word.replace(ix, 1, "E");
20422042
} else {
20432043
ix = word.find("d");
2044-
if (ix >= 0) word.replace(ix, 1, "E");
2044+
if (ix != std::string::npos) word.replace(ix, 1, "E");
20452045
}
20462046
};
20472047

src/lp_data/HighsModelUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ bool hasNamesWithSpaces(const HighsLogOptions& log_options,
319319
const std::vector<std::string>& names) {
320320
HighsInt num_names_with_spaces = 0;
321321
for (HighsInt ix = 0; ix < num_name; ix++) {
322-
HighsInt space_pos = names[ix].find(" ");
323-
if (space_pos >= 0) {
322+
size_t space_pos = names[ix].find(" ");
323+
if (space_pos != std::string::npos) {
324324
if (num_names_with_spaces == 0) {
325325
highsLogDev(
326326
log_options, HighsLogType::kInfo,

src/mip/HighsCliqueTable.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void HighsCliqueTable::bronKerboschRecurse(BronKerboschData& data,
189189
if (data.stop()) return;
190190

191191
double pivweight = -1.0;
192-
CliqueVar pivot;
192+
CliqueVar pivot{0, 0};
193193

194194
for (HighsInt i = 0; i != Xlen; ++i) {
195195
if (X[i].weight(data.sol) > pivweight) {
@@ -2021,8 +2021,9 @@ void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain,
20212021
std::remove_if(clique.begin(), clique.end(),
20222022
[&](CliqueVar v) {
20232023
return globaldomain.isFixed(v.col) &&
2024-
int(globaldomain.col_lower_[v.col]) ==
2025-
(1 - v.val);
2024+
static_cast<int>(
2025+
globaldomain.col_lower_[v.col]) ==
2026+
static_cast<int>(1 - v.val);
20262027
}),
20272028
clique.end());
20282029
}
@@ -2190,8 +2191,9 @@ void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain) {
21902191
std::remove_if(extensionvars.begin(), extensionvars.end(),
21912192
[&](CliqueVar v) {
21922193
return globaldomain.isFixed(v.col) &&
2193-
int(globaldomain.col_lower_[v.col]) ==
2194-
(1 - v.val);
2194+
static_cast<int>(
2195+
globaldomain.col_lower_[v.col]) ==
2196+
static_cast<int>(1 - v.val);
21952197
}),
21962198
extensionvars.end());
21972199

src/mip/HighsDebugSol.h

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,54 +88,47 @@ struct HighsDebugSol {
8888

8989
#else
9090
struct HighsDebugSol {
91-
HighsDebugSol(HighsMipSolver& mipsolver) {}
91+
HighsDebugSol(HighsMipSolver&) {}
9292

9393
void newIncumbentFound() const {}
9494

9595
void activate() const {}
9696

97-
void shrink(const std::vector<HighsInt>& newColIndex) const {}
97+
void shrink(const std::vector<HighsInt>&) const {}
9898

99-
void registerDomain(const HighsDomain& domain) const {}
99+
void registerDomain(const HighsDomain&) const {}
100100

101-
void boundChangeAdded(const HighsDomain& domain,
102-
const HighsDomainChange& domchg,
103-
bool branching = false) const {}
101+
void boundChangeAdded(const HighsDomain&, const HighsDomainChange&,
102+
bool = false) const {}
104103

105-
void boundChangeRemoved(const HighsDomain& domain,
106-
const HighsDomainChange& domchg) const {}
104+
void boundChangeRemoved(const HighsDomain&, const HighsDomainChange&) const {}
107105

108-
void resetDomain(const HighsDomain& domain) const {}
106+
void resetDomain(const HighsDomain&) const {}
109107

110-
void nodePruned(const HighsDomain& localdomain) const {}
108+
void nodePruned(const HighsDomain&) const {}
111109

112-
void checkCut(const HighsInt* Rindex, const double* Rvalue, HighsInt Rlen,
113-
double rhs) const {}
110+
void checkCut(const HighsInt*, const double*, HighsInt, double) const {}
114111

115-
void checkRow(const HighsInt* Rindex, const double* Rvalue, HighsInt Rlen,
116-
double Rlower, double Rupper) const {}
112+
void checkRow(const HighsInt*, const double*, HighsInt, double,
113+
double) const {}
117114

118-
void checkRowAggregation(const HighsLp& lp, const HighsInt* Rindex,
119-
const double* Rvalue, HighsInt Rlen) const {}
115+
void checkRowAggregation(const HighsLp&, const HighsInt*, const double*,
116+
HighsInt) const {}
120117

121-
void checkClique(const HighsCliqueTable::CliqueVar* clq,
122-
HighsInt clqlen) const {}
118+
void checkClique(const HighsCliqueTable::CliqueVar*, HighsInt) const {}
123119

124-
void checkVub(HighsInt col, HighsInt vubcol, double vubcoef,
125-
double vubconstant) const {}
120+
void checkVub(HighsInt, HighsInt, double, double) const {}
126121

127-
void checkVlb(HighsInt col, HighsInt vlbcol, double vlbcoef,
128-
double vlbconstant) const {}
122+
void checkVlb(HighsInt, HighsInt, double, double) const {}
129123

130124
void checkConflictReasonFrontier(
131-
const std::set<HighsDomain::ConflictSet::LocalDomChg>& reasonSideFrontier,
132-
const std::vector<HighsDomainChange>& domchgstack) const {}
125+
const std::set<HighsDomain::ConflictSet::LocalDomChg>&,
126+
const std::vector<HighsDomainChange>&) const {}
133127

134128
void checkConflictReconvergenceFrontier(
135-
const std::set<HighsDomain::ConflictSet::LocalDomChg>&
136-
reconvergenceFrontier,
137-
const HighsDomain::ConflictSet::LocalDomChg& reconvDomchgPos,
138-
const std::vector<HighsDomainChange>& domchgstack) const {}
129+
const std::set<HighsDomain::ConflictSet::LocalDomChg>&,
130+
const HighsDomain::ConflictSet::LocalDomChg&,
131+
const std::vector<HighsDomainChange>&) const {}
139132
};
140133
#endif
141134

src/mip/HighsGFkSolve.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct HighsGFk;
3939
template <>
4040
struct HighsGFk<2> {
4141
static constexpr unsigned int powk(unsigned int a) { return a * a; }
42-
static constexpr unsigned int inverse(unsigned int a) { return 1; }
42+
static constexpr unsigned int inverse(unsigned int) { return 1; }
4343
};
4444

4545
template <>

src/mip/HighsMipSolverData.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,17 @@ void HighsMipSolverData::finishSymmetryDetection(
183183
"No symmetry present\n\n");
184184
} else if (symmetries.orbitopes.size() == 0) {
185185
highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo,
186-
"Found %" HIGHSINT_FORMAT " generators\n\n",
186+
"Found %" HIGHSINT_FORMAT " generator(s)\n\n",
187187
symmetries.numGenerators);
188188

189189
} else {
190190
if (symmetries.numPerms != 0) {
191-
highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo,
192-
"Found %" HIGHSINT_FORMAT " generators and %" HIGHSINT_FORMAT
193-
" full orbitope(s) acting on %" HIGHSINT_FORMAT
194-
" columns\n\n",
195-
symmetries.numPerms, (HighsInt)symmetries.orbitopes.size(),
196-
(HighsInt)symmetries.columnToOrbitope.size());
191+
highsLogUser(
192+
mipsolver.options_mip_->log_options, HighsLogType::kInfo,
193+
"Found %" HIGHSINT_FORMAT " generator(s) and %" HIGHSINT_FORMAT
194+
" full orbitope(s) acting on %" HIGHSINT_FORMAT " columns\n\n",
195+
symmetries.numPerms, (HighsInt)symmetries.orbitopes.size(),
196+
(HighsInt)symmetries.columnToOrbitope.size());
197197
} else {
198198
highsLogUser(mipsolver.options_mip_->log_options, HighsLogType::kInfo,
199199
"Found %" HIGHSINT_FORMAT

src/mip/HighsMipSolverData.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,46 @@ struct HighsMipSolverData {
128128
implications(mipsolver),
129129
heuristics(mipsolver),
130130
objectiveFunction(mipsolver),
131+
presolve_status(HighsPresolveStatus::kNotSet),
132+
cliquesExtracted(false),
133+
rowMatrixSet(false),
134+
analyticCenterComputed(false),
135+
analyticCenterStatus(HighsModelStatus::kNotset),
136+
detectSymmetries(false),
137+
numRestarts(0),
138+
numRestartsRoot(0),
139+
numCliqueEntriesAfterPresolve(0),
140+
numCliqueEntriesAfterFirstPresolve(0),
141+
feastol(0.0),
142+
epsilon(0.0),
143+
heuristic_effort(0.0),
144+
dispfreq(0),
145+
firstlpsolobj(-kHighsInf),
146+
rootlpsolobj(-kHighsInf),
147+
numintegercols(0),
148+
maxTreeSizeLog2(0),
149+
pruned_treeweight(0),
150+
avgrootlpiters(0.0),
151+
last_disptime(0.0),
152+
firstrootlpiters(0),
153+
num_nodes(0),
154+
num_leaves(0),
155+
num_leaves_before_run(0),
156+
num_nodes_before_run(0),
157+
total_lp_iterations(0),
158+
heuristic_lp_iterations(0),
159+
sepa_lp_iterations(0),
160+
sb_lp_iterations(0),
161+
total_lp_iterations_before_run(0),
162+
heuristic_lp_iterations_before_run(0),
163+
sepa_lp_iterations_before_run(0),
164+
sb_lp_iterations_before_run(0),
165+
num_disp_lines(0),
166+
numImprovingSols(0),
167+
lower_bound(-kHighsInf),
168+
upper_bound(kHighsInf),
169+
upper_limit(kHighsInf),
170+
optimality_limit(kHighsInf),
131171
debugSolution(mipsolver) {
132172
domain.addCutpool(cutpool);
133173
domain.addConflictPool(conflictPool);

src/parallel/HighsMutex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ class HighsMutex {
114114
}
115115

116116
void unlock() {
117-
unsigned int prevState = state.fetch_add(-1, std::memory_order_release);
117+
unsigned int prevState = state.fetch_add(
118+
std::numeric_limits<unsigned int>::max(), std::memory_order_release);
118119

119120
if (prevState != 1) {
120121
unsigned int notifyWorkerId = (prevState >> 1) - 1;

src/qpsolver/a_quass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ QpAsmStatus solveqp(Instance& instance,
157157
}
158158

159159
// solve
160-
QpAsmStatus status = solveqp_actual(instance, settings, startinfo, stats, qp_model_status, qp_solution, qp_timer);
160+
solveqp_actual(instance, settings, startinfo, stats, qp_model_status, qp_solution, qp_timer);
161161

162162
// undo perturbation and resolve
163163

src/qpsolver/steepestedgepricing.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class SteepestEdgePricing : public Pricing {
9191

9292
std::vector<int> correct_weights;
9393
std::vector<int> incorrect_weights;
94-
bool ret = true;
9594
for (int i=0; i<runtime.instance.num_var; i++) {
9695
bool correct = check_weight(i);
9796
if (correct) {
@@ -132,7 +131,7 @@ class SteepestEdgePricing : public Pricing {
132131

133132
QpVector delta = basis.ftran(aq);
134133

135-
double old_weight_p_updated = weights[rowindex_p];
134+
//double old_weight_p_updated = weights[rowindex_p];
136135
// exact weight coming in needs to come in before update.
137136
double old_weight_p_computed = ep.dot(ep);
138137

0 commit comments

Comments
 (0)