Skip to content

Commit 931c94c

Browse files
authored
fix: objective constant bug with presolve (#90)
* fix: objective constant bug with presolve * update to version 0.2.9
1 parent 32766eb commit 931c94c

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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 8)
11+
set(CUPDLPX_VERSION_PATCH 9)
1212

1313
set(CUPDLPX_VERSION "${CUPDLPX_VERSION_MAJOR}.${CUPDLPX_VERSION_MINOR}.${CUPDLPX_VERSION_PATCH}")
1414
add_compile_definitions(CUPDLPX_VERSION="${CUPDLPX_VERSION}")

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.8"
7+
version = "0.2.9"
88
description = "Python bindings for cuPDLPx (GPU-accelerated first-order LP solver)"
99
readme = "README.md"
1010
license = { text = "Apache-2.0" }

src/presolve.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const char *get_presolve_status_str(enum PresolveStatus_ status)
3030
}
3131
}
3232

33-
lp_problem_t *convert_pslp_to_cupdlpx(PresolvedProblem *reduced_prob)
33+
lp_problem_t *convert_pslp_to_cupdlpx(PresolvedProblem *reduced_prob, const lp_problem_t *original_prob)
3434
{
3535

3636
lp_problem_t *cupdlpx_prob = (lp_problem_t *)safe_malloc(sizeof(lp_problem_t));
3737
// TODO: handle warmstart here
3838
cupdlpx_prob->primal_start = NULL;
3939
cupdlpx_prob->dual_start = NULL;
4040

41-
cupdlpx_prob->objective_constant = reduced_prob->obj_offset;
41+
cupdlpx_prob->objective_constant = original_prob->objective_constant + reduced_prob->obj_offset;
4242
cupdlpx_prob->objective_vector = reduced_prob->c;
4343

4444
cupdlpx_prob->constraint_lower_bound = reduced_prob->lhs;
@@ -114,7 +114,7 @@ cupdlpx_presolve_info_t *pslp_presolve(const lp_problem_t *original_prob, const
114114
else
115115
{
116116
info->problem_solved_during_presolve = false;
117-
info->reduced_problem = convert_pslp_to_cupdlpx(info->presolver->reduced_prob);
117+
info->reduced_problem = convert_pslp_to_cupdlpx(info->presolver->reduced_prob, original_prob);
118118
}
119119
return info;
120120
}

0 commit comments

Comments
 (0)