Skip to content

Commit 57129b7

Browse files
committed
address review comments
1 parent ff47875 commit 57129b7

6 files changed

Lines changed: 17 additions & 10 deletions

File tree

cpp/src/dual_simplex/bb_event.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ struct bb_event_t {
6464

6565
bool operator<(const bb_event_t& other) const
6666
{
67-
return std::tie(wut, worker_id, event_sequence) <
68-
std::tie(other.wut, other.worker_id, other.event_sequence);
67+
return std::tie(wut, worker_id, node_id, event_sequence) <
68+
std::tie(other.wut, other.worker_id, other.node_id, other.event_sequence);
6969
}
7070

7171
static bb_event_t make_branched(double work_unit_ts,

cpp/src/dual_simplex/bounds_strengthening.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ bool bounds_strengthening_t<i_t, f_t>::bounds_strengthening(
116116
const i_t col_start = A.col_start[j];
117117
const i_t col_end = A.col_start[j + 1];
118118
for (i_t p = col_start; p < col_end; ++p) {
119-
const i_t i = A.i[p];
119+
const i_t i = A_i[p];
120120
constraint_changed[i] = true;
121121
}
122122
}
@@ -192,7 +192,7 @@ bool bounds_strengthening_t<i_t, f_t>::bounds_strengthening(
192192
const i_t col_end = A.col_start[k + 1];
193193
nnz_processed += (col_end - col_start);
194194
for (i_t p = col_start; p < col_end; ++p) {
195-
const i_t i = A.i[p];
195+
const i_t i = A_i[p];
196196

197197
if (!constraint_changed[i]) { continue; }
198198
const f_t a_ik = A_x[p];

cpp/src/dual_simplex/branch_and_bound.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,6 +2385,7 @@ mip_status_t branch_and_bound_t<i_t, f_t>::solve(mip_solution_t<i_t, f_t>& solut
23852385
lower_bound = node_queue_.best_first_queue_size() > 0 ? node_queue_.get_lower_bound()
23862386
: search_tree_.root.lower_bound;
23872387
}
2388+
solver_status_ = determinism_global_termination_status_;
23882389
set_final_solution(solution, lower_bound);
23892390
return solver_status_;
23902391
}

cpp/src/dual_simplex/deterministic_workers.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class determinism_bfs_worker_t
268268
{
269269
record_event(bb_event_t<i_t, f_t>::make_branched(this->clock,
270270
this->worker_id,
271-
node->node_id,
271+
node->creation_seq,
272272
down_child_id,
273273
up_child_id,
274274
node->lower_bound,
@@ -282,7 +282,7 @@ class determinism_bfs_worker_t
282282
void record_integer_solution(mip_node_t<i_t, f_t>* node, f_t objective)
283283
{
284284
record_event(bb_event_t<i_t, f_t>::make_integer_solution(
285-
this->clock, this->worker_id, node->node_id, objective));
285+
this->clock, this->worker_id, node->creation_seq, objective));
286286
++nodes_processed_this_horizon;
287287
++this->total_nodes_processed;
288288
++this->total_integer_solutions;
@@ -291,7 +291,7 @@ class determinism_bfs_worker_t
291291
void record_fathomed(mip_node_t<i_t, f_t>* node, f_t lower_bound)
292292
{
293293
record_event(bb_event_t<i_t, f_t>::make_fathomed(
294-
this->clock, this->worker_id, node->node_id, lower_bound));
294+
this->clock, this->worker_id, node->creation_seq, lower_bound));
295295
++nodes_processed_this_horizon;
296296
++this->total_nodes_processed;
297297
++total_nodes_pruned;
@@ -300,15 +300,16 @@ class determinism_bfs_worker_t
300300
void record_infeasible(mip_node_t<i_t, f_t>* node)
301301
{
302302
record_event(
303-
bb_event_t<i_t, f_t>::make_infeasible(this->clock, this->worker_id, node->node_id));
303+
bb_event_t<i_t, f_t>::make_infeasible(this->clock, this->worker_id, node->creation_seq));
304304
++nodes_processed_this_horizon;
305305
++this->total_nodes_processed;
306306
++total_nodes_infeasible;
307307
}
308308

309309
void record_numerical(mip_node_t<i_t, f_t>* node)
310310
{
311-
record_event(bb_event_t<i_t, f_t>::make_numerical(this->clock, this->worker_id, node->node_id));
311+
record_event(
312+
bb_event_t<i_t, f_t>::make_numerical(this->clock, this->worker_id, node->creation_seq));
312313
++nodes_processed_this_horizon;
313314
++this->total_nodes_processed;
314315
}

cpp/src/dual_simplex/phase2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3371,7 +3371,7 @@ dual::status_t dual_phase2_with_advanced_basis(i_t phase,
33713371

33723372
// Feature logging for regression training (every FEATURE_LOG_INTERVAL iterations)
33733373
if ((iter % FEATURE_LOG_INTERVAL) == 0 && work_unit_context) {
3374-
i_t iters_elapsed = iter - last_feature_log_iter;
3374+
[[maybe_unused]] i_t iters_elapsed = iter - last_feature_log_iter;
33753375

33763376
auto [total_loads, total_stores] = aggregator.collect_and_flush();
33773377
// features.byte_loads = total_loads;

cpp/tests/mip/determinism_test.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ TEST_F(DeterministicBBTest, reproducible_solution_vector)
164164
settings.num_cpu_threads = 8;
165165
settings.work_limit = 2;
166166

167+
auto seed = std::random_device{}() & 0x7fffffff;
168+
169+
std::cout << "Tested with seed " << seed << "\n";
170+
settings.seed = seed;
171+
167172
auto solution1 = solve_mip(&handle_, problem, settings);
168173
auto solution2 = solve_mip(&handle_, problem, settings);
169174

0 commit comments

Comments
 (0)