Skip to content
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(cupdlpx LANGUAGES C CXX CUDA)

set(CUPDLPX_VERSION_MAJOR 0)
set(CUPDLPX_VERSION_MINOR 2)
set(CUPDLPX_VERSION_PATCH 0)
set(CUPDLPX_VERSION_PATCH 1)

set(CUPDLPX_VERSION "${CUPDLPX_VERSION_MAJOR}.${CUPDLPX_VERSION_MINOR}.${CUPDLPX_VERSION_PATCH}")
add_compile_definitions(CUPDLPX_VERSION="${CUPDLPX_VERSION}")
Expand Down Expand Up @@ -77,7 +77,7 @@ endif()

include(FetchContent)

set(PSLP_VERSION_TAG "v0.0.2")
set(PSLP_VERSION_TAG "v0.0.3")

FetchContent_Declare(
pslp
Expand Down
1 change: 1 addition & 0 deletions include/cupdlpx_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extern "C"
double cumulative_time_sec;
double presolve_time;
int presolve_status;
// PresolveStats presolve_stats;

double absolute_primal_residual;
double relative_primal_residual;
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "cupdlpx"
version = "0.2.0"
version = "0.2.1"
description = "Python bindings for cuPDLPx (GPU-accelerated first-order LP solver)"
readme = "README.md"
license = { text = "Apache-2.0" }
Expand Down
17 changes: 17 additions & 0 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ void save_solver_summary(const cupdlpx_result_t *result, const char *output_dir,
fprintf(outfile, "Reduced Rows: %d\n", result->num_reduced_constraints);
fprintf(outfile, "Reduced Columns: %d\n", result->num_reduced_variables);
fprintf(outfile, "Reduced Nonzeros: %d\n", result->num_reduced_nonzeros);

// if (result->presolve_stats.n_cols_original > 0) {
// fprintf(outfile, "NNZ Removed Trivial: %d\n", result->presolve_stats.nnz_removed_trivial);
// fprintf(outfile, "NNZ Removed Fast: %d\n", result->presolve_stats.nnz_removed_fast);
// fprintf(outfile, "NNZ Removed Primal Propagation: %d\n", result->presolve_stats.nnz_removed_primal_propagation);
// fprintf(outfile, "NNZ Removed Parallel Rows: %d\n", result->presolve_stats.nnz_removed_parallel_rows);
// fprintf(outfile, "NNZ Removed Parallel Cols: %d\n", result->presolve_stats.nnz_removed_parallel_cols);

// fprintf(outfile, "Presolve Time Init (sec): %e\n", result->presolve_stats.time_init);
// fprintf(outfile, "Presolve Time Run (sec): %e\n", result->presolve_stats.time_presolve);
// fprintf(outfile, "Presolve Time Fast (sec): %e\n", result->presolve_stats.time_fast_reductions);
// fprintf(outfile, "Presolve Time Medium (sec): %e\n", result->presolve_stats.time_medium_reductions);
// fprintf(outfile, "Presolve Time Primal Proppagation (sec): %e\n", result->presolve_stats.time_primal_propagation);
// fprintf(outfile, "Presolve Time Parallel Rows (sec): %e\n", result->presolve_stats.time_parallel_rows);
// fprintf(outfile, "Presolve Time Parallel Cols (sec): %e\n", result->presolve_stats.time_parallel_cols);
// fprintf(outfile, "Postsolve Time (sec): %e\n", result->presolve_stats.time_postsolve);
// }
}
if (result->feasibility_polishing_time > 0.0)
{
Expand Down
12 changes: 5 additions & 7 deletions src/presolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const char *get_presolve_status_str(enum PresolveStatus_ status)
return "UNCHANGED";
case REDUCED:
return "REDUCED";
case UNBOUNDED:
return "UNBOUNDED";
case INFEASIBLE:
return "INFEASIBLE";
case UNBNDORINFEAS:
Expand Down Expand Up @@ -104,7 +102,7 @@ cupdlpx_presolve_info_t *pslp_presolve(const lp_problem_t *original_prob, const
printf(" %-15s : %.3g sec\n", "presolve time", info->presolve_time);
}

if (status & INFEASIBLE || status & UNBOUNDED)
if (status & INFEASIBLE || status & UNBNDORINFEAS)
{
info->problem_solved_during_presolve = true;
info->reduced_problem = NULL;
Expand Down Expand Up @@ -134,10 +132,6 @@ cupdlpx_result_t *create_result_from_presolve(const cupdlpx_presolve_info_t *inf
{
result->termination_reason = TERMINATION_REASON_PRIMAL_INFEASIBLE;
}
else if (info->presolve_status == UNBOUNDED)
{
result->termination_reason = TERMINATION_REASON_DUAL_INFEASIBLE;
}
else if (info->presolve_status == UNBNDORINFEAS)
{
result->termination_reason = TERMINATION_REASON_INFEASIBLE_OR_UNBOUNDED;
Expand All @@ -154,6 +148,7 @@ cupdlpx_result_t *create_result_from_presolve(const cupdlpx_presolve_info_t *inf
result->num_reduced_nonzeros = info->presolver->reduced_prob->nnz;
result->presolve_status = info->presolve_status;
result->presolve_time = info->presolve_time;
// result->presolve_stats = *(info->presolver->stats);
// TODO: Verify if setting solution pointers to NULL affects Python/Julia bindings.
if (result->num_variables > 0)
{
Expand Down Expand Up @@ -191,6 +186,9 @@ void pslp_postsolve(cupdlpx_presolve_info_t *info,
memcpy(result->reduced_cost, info->presolver->sol->z, original_prob->num_variables * sizeof(double));
result->primal_objective_value = info->presolver->sol->obj;
result->presolve_time = info->presolve_time;
// if (info->presolver->stats != NULL) {
// result->presolve_stats = *(info->presolver->stats);
// }
}

void cupdlpx_presolve_info_free(cupdlpx_presolve_info_t *info)
Expand Down
5 changes: 5 additions & 0 deletions src/solver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,11 @@ static cupdlpx_result_t *create_result_from_state(pdhg_solver_state_t *state, co
results->termination_reason = state->termination_reason;
results->feasibility_polishing_time = state->feasibility_polishing_time;
results->feasibility_iteration = state->feasibility_iteration;
// if (presolve_stats != NULL) {
// results->presolve_stats = *presolve_stats;
// } else {
// memset(&(results->presolve_stats), 0, sizeof(PresolveStats));
// }

return results;
}
Expand Down