Skip to content

Commit bc4219b

Browse files
authored
Update PSLP to v0.0.3 (#56)
* add support for PSLP v0.0.3 * add presolve_stats in results * comment out presolve stats * release v0.2.1
1 parent 27e6292 commit bc4219b

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project(cupdlpx LANGUAGES C CXX CUDA)
88

99
set(CUPDLPX_VERSION_MAJOR 0)
1010
set(CUPDLPX_VERSION_MINOR 2)
11-
set(CUPDLPX_VERSION_PATCH 0)
11+
set(CUPDLPX_VERSION_PATCH 1)
1212

1313
set(CUPDLPX_VERSION "${CUPDLPX_VERSION_MAJOR}.${CUPDLPX_VERSION_MINOR}.${CUPDLPX_VERSION_PATCH}")
1414
add_compile_definitions(CUPDLPX_VERSION="${CUPDLPX_VERSION}")
@@ -77,7 +77,7 @@ endif()
7777

7878
include(FetchContent)
7979

80-
set(PSLP_VERSION_TAG "v0.0.2")
80+
set(PSLP_VERSION_TAG "v0.0.3")
8181

8282
FetchContent_Declare(
8383
pslp

include/cupdlpx_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ extern "C"
115115
double cumulative_time_sec;
116116
double presolve_time;
117117
int presolve_status;
118+
// PresolveStats presolve_stats;
118119

119120
double absolute_primal_residual;
120121
double relative_primal_residual;

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "cupdlpx"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
description = "Python bindings for cuPDLPx (GPU-accelerated first-order LP solver)"
99
readme = "README.md"
1010
license = { text = "Apache-2.0" }

src/cli.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ void save_solver_summary(const cupdlpx_result_t *result, const char *output_dir,
124124
fprintf(outfile, "Reduced Rows: %d\n", result->num_reduced_constraints);
125125
fprintf(outfile, "Reduced Columns: %d\n", result->num_reduced_variables);
126126
fprintf(outfile, "Reduced Nonzeros: %d\n", result->num_reduced_nonzeros);
127+
128+
// if (result->presolve_stats.n_cols_original > 0) {
129+
// fprintf(outfile, "NNZ Removed Trivial: %d\n", result->presolve_stats.nnz_removed_trivial);
130+
// fprintf(outfile, "NNZ Removed Fast: %d\n", result->presolve_stats.nnz_removed_fast);
131+
// fprintf(outfile, "NNZ Removed Primal Propagation: %d\n", result->presolve_stats.nnz_removed_primal_propagation);
132+
// fprintf(outfile, "NNZ Removed Parallel Rows: %d\n", result->presolve_stats.nnz_removed_parallel_rows);
133+
// fprintf(outfile, "NNZ Removed Parallel Cols: %d\n", result->presolve_stats.nnz_removed_parallel_cols);
134+
135+
// fprintf(outfile, "Presolve Time Init (sec): %e\n", result->presolve_stats.time_init);
136+
// fprintf(outfile, "Presolve Time Run (sec): %e\n", result->presolve_stats.time_presolve);
137+
// fprintf(outfile, "Presolve Time Fast (sec): %e\n", result->presolve_stats.time_fast_reductions);
138+
// fprintf(outfile, "Presolve Time Medium (sec): %e\n", result->presolve_stats.time_medium_reductions);
139+
// fprintf(outfile, "Presolve Time Primal Proppagation (sec): %e\n", result->presolve_stats.time_primal_propagation);
140+
// fprintf(outfile, "Presolve Time Parallel Rows (sec): %e\n", result->presolve_stats.time_parallel_rows);
141+
// fprintf(outfile, "Presolve Time Parallel Cols (sec): %e\n", result->presolve_stats.time_parallel_cols);
142+
// fprintf(outfile, "Postsolve Time (sec): %e\n", result->presolve_stats.time_postsolve);
143+
// }
127144
}
128145
if (result->feasibility_polishing_time > 0.0)
129146
{

src/presolve.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const char *get_presolve_status_str(enum PresolveStatus_ status)
2121
return "UNCHANGED";
2222
case REDUCED:
2323
return "REDUCED";
24-
case UNBOUNDED:
25-
return "UNBOUNDED";
2624
case INFEASIBLE:
2725
return "INFEASIBLE";
2826
case UNBNDORINFEAS:
@@ -104,7 +102,7 @@ cupdlpx_presolve_info_t *pslp_presolve(const lp_problem_t *original_prob, const
104102
printf(" %-15s : %.3g sec\n", "presolve time", info->presolve_time);
105103
}
106104

107-
if (status & INFEASIBLE || status & UNBOUNDED)
105+
if (status & INFEASIBLE || status & UNBNDORINFEAS)
108106
{
109107
info->problem_solved_during_presolve = true;
110108
info->reduced_problem = NULL;
@@ -134,10 +132,6 @@ cupdlpx_result_t *create_result_from_presolve(const cupdlpx_presolve_info_t *inf
134132
{
135133
result->termination_reason = TERMINATION_REASON_PRIMAL_INFEASIBLE;
136134
}
137-
else if (info->presolve_status == UNBOUNDED)
138-
{
139-
result->termination_reason = TERMINATION_REASON_DUAL_INFEASIBLE;
140-
}
141135
else if (info->presolve_status == UNBNDORINFEAS)
142136
{
143137
result->termination_reason = TERMINATION_REASON_INFEASIBLE_OR_UNBOUNDED;
@@ -154,6 +148,7 @@ cupdlpx_result_t *create_result_from_presolve(const cupdlpx_presolve_info_t *inf
154148
result->num_reduced_nonzeros = info->presolver->reduced_prob->nnz;
155149
result->presolve_status = info->presolve_status;
156150
result->presolve_time = info->presolve_time;
151+
// result->presolve_stats = *(info->presolver->stats);
157152
// TODO: Verify if setting solution pointers to NULL affects Python/Julia bindings.
158153
if (result->num_variables > 0)
159154
{
@@ -191,6 +186,9 @@ void pslp_postsolve(cupdlpx_presolve_info_t *info,
191186
memcpy(result->reduced_cost, info->presolver->sol->z, original_prob->num_variables * sizeof(double));
192187
result->primal_objective_value = info->presolver->sol->obj;
193188
result->presolve_time = info->presolve_time;
189+
// if (info->presolver->stats != NULL) {
190+
// result->presolve_stats = *(info->presolver->stats);
191+
// }
194192
}
195193

196194
void cupdlpx_presolve_info_free(cupdlpx_presolve_info_t *info)

src/solver.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,11 @@ static cupdlpx_result_t *create_result_from_state(pdhg_solver_state_t *state, co
10451045
results->termination_reason = state->termination_reason;
10461046
results->feasibility_polishing_time = state->feasibility_polishing_time;
10471047
results->feasibility_iteration = state->feasibility_iteration;
1048+
// if (presolve_stats != NULL) {
1049+
// results->presolve_stats = *presolve_stats;
1050+
// } else {
1051+
// memset(&(results->presolve_stats), 0, sizeof(PresolveStats));
1052+
// }
10481053

10491054
return results;
10501055
}

0 commit comments

Comments
 (0)