Skip to content
Open
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
8 changes: 8 additions & 0 deletions cpp/src/barrier/barrier.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,14 @@ int barrier_solver_t<i_t, f_t>::initial_point(iteration_data_t<i_t, f_t>& data)
settings.log.printf("min v %e min z %e\n", data.v.minimum(), data.z.minimum());
#endif

if (x_pdhg.size() > 0) {
data.x = x_pdhg;
data.w = w_pdhg;
data.y = y_pdhg;
data.z = z_pdhg;
data.v = v_pdhg;
}
Comment on lines +1974 to +1980
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Validate the PDHG warm start before overwriting the barrier point.

x_pdhg.size() > 0 is the only gate here, so a partially populated or mis-sized warm start can shrink data.w/y/z/v to the wrong dimensions. Also, because this overwrite happens after the positivity adjustments above, zeros or negatives can flow into the later z / x and v / w divisions in gpu_compute_search_direction(). Please validate all five vector sizes against the current presolved problem and re-establish strict interiority after the overwrite.

Suggested guard
-  if (x_pdhg.size() > 0) {
+  if (!x_pdhg.empty()) {
+    if (x_pdhg.size() != data.x.size() || w_pdhg.size() != data.w.size() ||
+        y_pdhg.size() != data.y.size() || z_pdhg.size() != data.z.size() ||
+        v_pdhg.size() != data.v.size()) {
+      settings.log.printf("Invalid PDHG warm-start dimensions\n");
+      return -1;
+    }
     data.x = x_pdhg;
     data.w = w_pdhg;
     data.y = y_pdhg;
     data.z = z_pdhg;
     data.v = v_pdhg;
+    data.w.ensure_positive(epsilon_adjust);
+    data.x.ensure_positive(epsilon_adjust);
+    data.v.ensure_positive(epsilon_adjust);
+    data.z.ensure_positive(epsilon_adjust);
   }

Based on learnings: Validate correct initialization of variable bounds, constraint coefficients, and algorithm state before solving; ensure reset when transitioning between algorithm phases, and ensure variables and constraints are accessed from the correct problem context (original vs presolve vs folded vs postsolve); verify index mapping consistency across problem transformations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cpp/src/barrier/barrier.cu` around lines 1974 - 1980, Validate that all
warm-start vectors x_pdhg, w_pdhg, y_pdhg, z_pdhg, v_pdhg are present and
exactly match the current presolved problem dimensions (match data.x.size(),
data.w.size(), data.y.size(), data.z.size(), data.v.size() or the problem n/m
counts) before assigning them to data.x/data.w/data.y/data.z/data.v; if any size
mismatches occur, skip the warm start and leave existing data or reset to a safe
default. After a successful full-size overwrite, re-establish strict interiority
by pushing any non‑positive entries in data.x/data.z and data.w/data.v to a
small positive tolerance (e.g., eps) so subsequent divisions in
gpu_compute_search_direction() cannot divide by zero or negative values. Ensure
you reference and check the five symbols x_pdhg, w_pdhg, y_pdhg, z_pdhg, v_pdhg
and update data.x, data.w, data.y, data.z, data.v atomically only when all
validations pass.


return 0;
}

Expand Down
6 changes: 6 additions & 0 deletions cpp/src/barrier/barrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class barrier_solver_t {

// To be able to directly pass lambdas to transform functions
public:

std::vector<f_t> x_pdhg;
std::vector<f_t> w_pdhg;
std::vector<f_t> y_pdhg;
std::vector<f_t> z_pdhg;
std::vector<f_t> v_pdhg;
void compute_next_iterate(iteration_data_t<i_t, f_t>& data,
f_t step_scale,
f_t step_primal,
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/dual_simplex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(DUAL_SIMPLEX_SRC_FILES
${CMAKE_CURRENT_SOURCE_DIR}/basis_solves.cpp
${CMAKE_CURRENT_SOURCE_DIR}/basis_updates.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bound_flipping_ratio_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/crossover.cpp
${CMAKE_CURRENT_SOURCE_DIR}/crossover.cu
${CMAKE_CURRENT_SOURCE_DIR}/folding.cpp
${CMAKE_CURRENT_SOURCE_DIR}/initial_basis.cpp
${CMAKE_CURRENT_SOURCE_DIR}/phase1.cpp
Expand Down
Loading