From 0bf8516b8224edaaf9e55d8a65cb11ea4f4470c0 Mon Sep 17 00:00:00 2001 From: dance858 Date: Sat, 14 Nov 2026 07:36:48 -0800 Subject: [PATCH] Return a status from the postsolve functions postsolve, map_original_sol_to_reduced, postsolve_primal_infeas_ray and postsolve_dual_infeas_ray were void and reported a failure (out of memory, unsupported problem, call after free_presolver_reduced_problem) only by printing to stderr. A program that embeds PSLP could neither route that text nor detect the failure (#133). They now return bool, true on success. The reason for a failure is printed to stdout and only when 'verbose' is set, so a release build no longer writes to stderr from these functions. Also: - map_original_sol_to_reduced: an output requested without its input is a precondition (assert) and no longer a runtime warning. - postsolve_primal_infeas_ray: a failed scratch allocation returns false instead of dereferencing NULL in a release build. - The "Maximum time limit reached" line is printed only when 'verbose' is set. Co-Authored-By: Claude Fable 5.2 --- include/PSLP/PSLP_API.h | 44 ++++++++++++++-------- include/core/glbopts.h | 8 ++++ src/core/MapToReduced.c | 56 ++++++++++------------------ src/core/Presolver.c | 73 +++++++++++++++++++++---------------- tests/test_cones.h | 6 ++- tests/test_fold.h | 8 ++-- tests/test_map_to_reduced.h | 29 +++++++-------- tests/test_postsolve.h | 2 +- tests/test_ray_postsolve.h | 14 ++++++- 9 files changed, 133 insertions(+), 107 deletions(-) diff --git a/include/PSLP/PSLP_API.h b/include/PSLP/PSLP_API.h index 08f0217e..c922e884 100644 --- a/include/PSLP/PSLP_API.h +++ b/include/PSLP/PSLP_API.h @@ -218,8 +218,12 @@ extern "C" for a variable at its lower bound, z <= 0 at its upper bound, y >= 0 for a row active at its lhs and y <= 0 at its rhs. The function populates presolver->sol, so if you're looking for the solution to the original - problem, you want to look there. */ - void postsolve(Presolver *presolver, const double *x, const double *y, + problem, you want to look there. + + Returns true on success. Returns false if memory runs out; presolver->sol + then does not hold the solution. With 'verbose' set, the reason for a + failure is printed (this holds for all functions below as well). */ + bool postsolve(Presolver *presolver, const double *x, const double *y, const double *z); /* Map a primal-dual point (x, y) of the original problem to the reduced @@ -229,17 +233,21 @@ extern "C" x has length n and y has length m (original dimensions). On return, x_red (length reduced_prob->n) and y_red (length reduced_prob->m) hold the mapped point and z_red (length reduced_prob->n) holds z_red = c_red - - A_red^T y_red. Any output pointer may be NULL to skip that part; x_red - requires x, y_red requires y, and z_red requires y_red. The function does - not modify presolver->sol. + A_red^T y_red. Any output pointer may be NULL to skip that part. The + caller must pass x when x_red is requested, y when y_red is requested, + and y_red when z_red is requested. The function does not modify + presolver->sol. The semantics are as follows. If (x, y) is an optimal primal-dual point of the original problem and 'relax_bounds' is false, (x_red, y_red, z_red) is an optimal primal-dual point of the reduced problem. - This function is currently only implemented for LPs. For a QP it prints - an error and leaves x_red, y_red and z_red untouched. */ - void map_original_sol_to_reduced(Presolver *presolver, const double *x, + Returns true on success and false otherwise. It fails + * for a QP (currently only implemented for LPs) or if memory runs out; + x_red, y_red and z_red are then left untouched; + * if z_red is requested after 'free_presolver_reduced_problem'; x_red + and y_red are then still computed and z_red is left untouched. */ + bool map_original_sol_to_reduced(Presolver *presolver, const double *x, const double *y, double *x_red, double *y_red, double *z_red); @@ -248,10 +256,13 @@ extern "C" to y_orig. It does not check whether y is a valid ray. y uses the Farkas sign convention, yi >= 0 when row i is active at its - rhs, the opposite of postsolve(). It matches Gurobi's FarkasDual. Not - available yet for a problem with cone blocks: an error is printed and y_orig - is left untouched. */ - void postsolve_primal_infeas_ray(Presolver *presolver, const double *y, + rhs, the opposite of postsolve(). It matches Gurobi's FarkasDual. + + Returns true on success. Returns false, and leaves y_orig untouched, for + a problem with cone blocks or with 'lp_fold' applied (not available + yet), if called after 'free_presolver_reduced_problem', or if memory + runs out. */ + bool postsolve_primal_infeas_ray(Presolver *presolver, const double *y, double *y_orig); /* Postsolve a dual infeasibility ray x of the reduced problem. @@ -260,9 +271,12 @@ extern "C" x is an unbounded direction: a recession direction of the constraint set with Px = 0 and c'x < 0 (for an LP simply c'x < 0); no sign - convention involved. Not available yet for a problem with cone - blocks: an error is printed and x_orig is left untouched. */ - void postsolve_dual_infeas_ray(Presolver *presolver, const double *x, + convention involved. + + Returns true on success. Returns false, and leaves x_orig untouched, for + a problem with cone blocks or with 'lp_fold' applied (not available + yet), or if memory runs out. */ + bool postsolve_dual_infeas_ray(Presolver *presolver, const double *x, double *x_orig); #ifdef __cplusplus diff --git a/include/core/glbopts.h b/include/core/glbopts.h index ff48e5c7..ec9660ab 100644 --- a/include/core/glbopts.h +++ b/include/core/glbopts.h @@ -20,6 +20,7 @@ #define GLB_H_GUARD #include +#include #define INF (INFINITY) #define IS_POS_INF(x) (isinf(x) && (x) > 0) #define IS_NEG_INF(x) (isinf(x) && (x) < 0) @@ -32,6 +33,13 @@ #define RETURN_IF_NOT_UNCHANGED(x) \ if ((x) != UNCHANGED) return x +/* Reports why a public call failed. Silent unless 'verbose' is set. */ +#define PSLP_FAIL_MSG(stgs, msg) \ + do \ + { \ + if ((stgs)->verbose) printf("PSLP error: " msg "\n"); \ + } while (0) + #define SIZE_INACTIVE_ROW -1 #define SIZE_INACTIVE_COL -1 diff --git a/src/core/MapToReduced.c b/src/core/MapToReduced.c index 55816497..2f0e031f 100644 --- a/src/core/MapToReduced.c +++ b/src/core/MapToReduced.c @@ -34,6 +34,7 @@ #include "Workspace.h" #include "dVec.h" #include "fold_postsolve.h" +#include "glbopts.h" #include "iVec.h" #include "u16Vec.h" #include @@ -215,7 +216,7 @@ static void compute_reduced_dual_slack(double *z, const ProblemData *prob, } } -void map_original_sol_to_reduced(Presolver *presolver, const double *x, +bool map_original_sol_to_reduced(Presolver *presolver, const double *x, const double *y, double *x_red, double *y_red, double *z_red) { @@ -234,38 +235,19 @@ void map_original_sol_to_reduced(Presolver *presolver, const double *x, /* 'stats' survives 'free_presolver_reduced_problem', unlike the reduced P */ if (presolver->stats->Pnnz_original > 0 || presolver->stats->Pnnz_reduced > 0) { - fprintf(stderr, "PSLP error: map_original_sol_to_reduced is not supported " - "for QPs yet! Outputs are left untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, "map_original_sol_to_reduced is not " + "supported for QPs yet"); + return false; } - if (x_red && !x) - { - fprintf(stderr, - "PSLP warning: map_original_sol_to_reduced needs x to compute " - "x_red! x_red is left untouched. \n"); - x_red = NULL; - } - - if (y_red && !y) - { - fprintf(stderr, - "PSLP warning: map_original_sol_to_reduced needs y to compute " - "y_red! y_red and z_red are left untouched. \n"); - y_red = NULL; - z_red = NULL; - } - - if (z_red && !y_red) - { - fprintf(stderr, "PSLP warning: map_original_sol_to_reduced needs y_red to " - "compute z_red! z_red is left untouched. \n"); - z_red = NULL; - } + /* an output needs its input */ + assert(!x_red || x); + assert(!y_red || y); + assert(!z_red || y_red); if (!x_red && !y_red) { - return; + return true; } // scratch space for the replay and, with a fold, for the folded point (we @@ -274,10 +256,9 @@ void map_original_sol_to_reduced(Presolver *presolver, const double *x, work = (double *) ps_malloc(n_fold * (fold_maps ? 2 : 1) + 1, sizeof(double)); if (!work) { - fprintf(stderr, - "PSLP warning: map_original_sol_to_reduced failed to allocate " - "memory! Outputs are left untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, + "out of memory in map_original_sol_to_reduced"); + return false; } if (fold_maps) @@ -310,18 +291,19 @@ void map_original_sol_to_reduced(Presolver *presolver, const double *x, if (!z_red) { - return; + return true; } if (!reduced_prob->Ax) { // The reduced problem data was released by // 'free_presolver_reduced_problem', so z_red cannot be computed. - fprintf(stderr, "PSLP warning: map_original_sol_to_reduced called after " - "free_presolver_reduced_problem! z_red is left " - "untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, + "map_original_sol_to_reduced cannot compute z_red after " + "free_presolver_reduced_problem"); + return false; } compute_reduced_dual_slack(z_red, reduced_prob, y_red); + return true; } diff --git a/src/core/Presolver.c b/src/core/Presolver.c index 518abf97..e81c56a7 100644 --- a/src/core/Presolver.c +++ b/src/core/Presolver.c @@ -518,7 +518,7 @@ Presolver *new_presolver_from_problem(const ProblemData *problem, static inline bool update_termination(size_t nnz_after_cycle, size_t nnz_before_cycle, Complexity complexity, PresolveStatus status, double max_time, - Timer outer_timer) + Timer outer_timer, bool verbose) { if (HAS_STATUS(status, UNBNDORINFEAS)) { @@ -535,7 +535,10 @@ static inline bool update_termination(size_t nnz_after_cycle, if (GET_ELAPSED_SECONDS(outer_timer) >= max_time) { - printf("Maximum time limit of %.2f seconds reached.\n", max_time); + if (verbose) + { + printf("Maximum time limit of %.2f seconds reached.\n", max_time); + } return true; } @@ -941,7 +944,7 @@ PresolveStatus run_presolver(Presolver *presolver) terminate = update_termination(nnz_after_cycle, nnz_before_cycle, curr_complexity, - status, stgs->max_time, outer_timer); + status, stgs->max_time, outer_timer, stgs->verbose); if (curr_complexity == MEDIUM) { @@ -1044,8 +1047,8 @@ void free_presolver_reduced_problem(Presolver *presolver) free_reduced_problem_arrays(reduced_prob); } -/* Allocates presolver->sol on the first postsolve call. Returns false (and - prints an error) if the allocation fails. */ +/* Allocates presolver->sol on the first postsolve call. Returns false if the + allocation fails. */ static bool ensure_solution(Presolver *presolver) { if (presolver->sol) @@ -1057,21 +1060,21 @@ static bool ensure_solution(Presolver *presolver) presolver->stats->n_cols_original); if (!presolver->sol) { - fprintf(stderr, "PSLP error: out of memory when allocating the " - "postsolved solution. Outputs are left untouched. \n"); + PSLP_FAIL_MSG(presolver->stgs, "out of memory when allocating the " + "postsolved solution"); return false; } return true; } -void postsolve(Presolver *presolver, const double *x, const double *y, +bool postsolve(Presolver *presolver, const double *x, const double *y, const double *z) { Timer timer; PresolveStats *stats = presolver->stats; if (!ensure_solution(presolver)) { - return; + return false; } Solution *sol = presolver->sol; State *data = presolver->prob->constraints->state; @@ -1096,6 +1099,7 @@ void postsolve(Presolver *presolver, const double *x, const double *y, { printf("PSLP postsolve time: %.4f seconds\n", stats->time_postsolve); } + return true; } static void compute_primal_infeas_ray_z(double *z, const double *Ax, const int *Ai, @@ -1116,7 +1120,7 @@ static void compute_primal_infeas_ray_z(double *z, const double *Ax, const int * } } -void postsolve_primal_infeas_ray(Presolver *presolver, const double *y, +bool postsolve_primal_infeas_ray(Presolver *presolver, const double *y, double *y_orig) { Timer timer; @@ -1129,32 +1133,37 @@ void postsolve_primal_infeas_ray(Presolver *presolver, const double *y, assert(reduced_prob != NULL); if (data->work->fold_maps) { - fprintf(stderr, "PSLP error: postsolve_primal_infeas_ray is not supported " - "with lp_fold yet! y_orig is left untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, "postsolve_primal_infeas_ray is not " + "supported with lp_fold yet"); + return false; } if (stats->n_cones_original > 0) { - fprintf(stderr, "PSLP error: postsolve_primal_infeas_ray is not supported " - "for problems with cone blocks yet! y_orig is left " - "untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, + "postsolve_primal_infeas_ray is not " + "supported for problems with cone blocks yet"); + return false; } if (!reduced_prob || !reduced_prob->Ax) { // The reduced constraint matrix was released by // 'free_presolver_reduced_problem', so the ray cannot be recovered. - fprintf(stderr, "PSLP warning: postsolve_primal_infeas_ray called after " - "free_presolver_reduced_problem! Don't do this! \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, "postsolve_primal_infeas_ray called after " + "free_presolver_reduced_problem"); + return false; } if (!ensure_solution(presolver)) { - return; + return false; } Solution *sol = presolver->sol; z = (double *) ps_malloc(len_z, sizeof(double)); - assert(z != NULL); + if (!z) + { + PSLP_FAIL_MSG(presolver->stgs, + "out of memory in postsolve_primal_infeas_ray"); + return false; + } clock_gettime(CLOCK_MONOTONIC, &timer.start); compute_primal_infeas_ray_z(z, reduced_prob->Ax, reduced_prob->Ai, @@ -1175,9 +1184,10 @@ void postsolve_primal_infeas_ray(Presolver *presolver, const double *y, { printf("PSLP postsolve time: %.4f seconds\n", stats->time_postsolve); } + return true; } -void postsolve_dual_infeas_ray(Presolver *presolver, const double *x, double *x_orig) +bool postsolve_dual_infeas_ray(Presolver *presolver, const double *x, double *x_orig) { Timer timer; PresolveStats *stats = presolver->stats; @@ -1186,20 +1196,20 @@ void postsolve_dual_infeas_ray(Presolver *presolver, const double *x, double *x_ assert(presolver->reduced_prob != NULL); if (data->work->fold_maps) { - fprintf(stderr, "PSLP error: postsolve_dual_infeas_ray is not supported " - "with lp_fold yet! x_orig is left untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, "postsolve_dual_infeas_ray is not " + "supported with lp_fold yet"); + return false; } if (stats->n_cones_original > 0) { - fprintf(stderr, "PSLP error: postsolve_dual_infeas_ray is not supported " - "for problems with cone blocks yet! x_orig is left " - "untouched. \n"); - return; + PSLP_FAIL_MSG(presolver->stgs, + "postsolve_dual_infeas_ray is not " + "supported for problems with cone blocks yet"); + return false; } if (!ensure_solution(presolver)) { - return; + return false; } Solution *sol = presolver->sol; @@ -1218,6 +1228,7 @@ void postsolve_dual_infeas_ray(Presolver *presolver, const double *x, double *x_ { printf("PSLP postsolve time: %.4f seconds\n", stats->time_postsolve); } + return true; } void free_presolver(Presolver *presolver) diff --git a/tests/test_cones.h b/tests/test_cones.h index 223c69a3..4d9daec6 100644 --- a/tests/test_cones.h +++ b/tests/test_cones.h @@ -499,13 +499,15 @@ static char *test_cones_refusals() double y_ray[] = {0, 0, 0}; double y_orig[] = {7, 7, 7, 7}; - postsolve_primal_infeas_ray(presolver, y_ray, y_orig); + mu_assert("primal ray refused", + !postsolve_primal_infeas_ray(presolver, y_ray, y_orig)); mu_assert("primal ray untouched", y_orig[0] == 7 && y_orig[1] == 7 && y_orig[2] == 7 && y_orig[3] == 7); double x_ray[] = {0, 0, 0}; double x_orig[] = {7, 7, 7, 7, 7}; - postsolve_dual_infeas_ray(presolver, x_ray, x_orig); + mu_assert("dual ray refused", + !postsolve_dual_infeas_ray(presolver, x_ray, x_orig)); mu_assert("dual ray untouched", x_orig[0] == 7 && x_orig[1] == 7 && x_orig[2] == 7 && x_orig[3] == 7 && x_orig[4] == 7); diff --git a/tests/test_fold.h b/tests/test_fold.h index cc7fb816..de6c3560 100644 --- a/tests/test_fold.h +++ b/tests/test_fold.h @@ -1456,7 +1456,7 @@ static const char *test_fold_map_then_parallel_rows(void) return 0; } -/* The ray postsolves are not supported with a fold: they print an error and +/* The ray postsolves are not supported with a fold: they return false and leave their outputs untouched. */ static const char *test_fold_refuses_primal_ray(void) { @@ -1466,7 +1466,8 @@ static const char *test_fold_refuses_primal_ray(void) mu_assert("presolver", presolver && run_presolver(presolver) != INFEASIBLE); double y_f[1] = {1}; double y_orig[3] = {DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE}; - postsolve_primal_infeas_ray(presolver, y_f, y_orig); + mu_assert("primal ray refused", + !postsolve_primal_infeas_ray(presolver, y_f, y_orig)); mu_assert("y_orig untouched", all_equal(y_orig, 3, DUMMY_VALUE)); free_presolver(presolver); free_settings(stgs); @@ -1483,7 +1484,8 @@ static const char *test_fold_refuses_dual_ray(void) double x_f[2] = {1, 1}; double x_orig[6] = {DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE}; - postsolve_dual_infeas_ray(presolver, x_f, x_orig); + mu_assert("dual ray refused", + !postsolve_dual_infeas_ray(presolver, x_f, x_orig)); mu_assert("x_orig untouched", all_equal(x_orig, 6, DUMMY_VALUE)); free_presolver(presolver); free_settings(stgs); diff --git a/tests/test_map_to_reduced.h b/tests/test_map_to_reduced.h index b9ab65fa..c86b6e2f 100644 --- a/tests/test_map_to_reduced.h +++ b/tests/test_map_to_reduced.h @@ -108,14 +108,17 @@ static char *test_map_ston_row() // mapping must not touch the solution obtained by postsolve above double x_only[7], y_only[2]; - map_original_sol_to_reduced(presolver, x, y, x_only, y_only, NULL); + mu_assert("map ston row should succeed", + map_original_sol_to_reduced(presolver, x, y, x_only, y_only, NULL)); mu_assert("map ston row must not modify presolver->sol", is_solution_correct(presolver->sol->x, x, presolver->sol->y, y, presolver->sol->z, z, n_rows, n_cols, MAP_TOL)); // the primal and dual parts can be mapped independently - map_original_sol_to_reduced(presolver, x, NULL, x_only, NULL, NULL); - map_original_sol_to_reduced(presolver, NULL, y, NULL, y_only, NULL); + mu_assert("map ston row primal only should succeed", + map_original_sol_to_reduced(presolver, x, NULL, x_only, NULL, NULL)); + mu_assert("map ston row dual only should succeed", + map_original_sol_to_reduced(presolver, NULL, y, NULL, y_only, NULL)); for (int i = 0; i < 7; ++i) { mu_assert("map ston row primal only error", @@ -127,16 +130,6 @@ static char *test_map_ston_row() ABS(y_only[i] - y_red[i]) <= MAP_TOL); } - // a missing input leaves the corresponding output untouched - double untouched[7] = {DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, - DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE}; - map_original_sol_to_reduced(presolver, NULL, y, untouched, y_only, NULL); - map_original_sol_to_reduced(presolver, x, NULL, x_only, untouched, NULL); - for (int i = 0; i < 7; ++i) - { - mu_assert("map ston row missing input error", untouched[i] == DUMMY_VALUE); - } - PS_FREE(stgs); free_presolver(presolver); return 0; @@ -668,7 +661,10 @@ static char *test_map_after_free_reduced_problem() double x_red[4], y_red[2]; double z_red[4] = {DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE, DUMMY_VALUE}; - map_original_sol_to_reduced(presolver, x, y, x_red, y_red, z_red); + mu_assert("map after free: z_red cannot be computed", + !map_original_sol_to_reduced(presolver, x, y, x_red, y_red, z_red)); + mu_assert("map after free: x and y alone should succeed", + map_original_sol_to_reduced(presolver, x, y, x_red, y_red, NULL)); for (int i = 0; i < 4; ++i) { @@ -687,7 +683,7 @@ static char *test_map_after_free_reduced_problem() return 0; } -/* The forward map is not implemented for QPs yet: it prints an error and +/* The forward map is not implemented for QPs yet: it returns false and leaves its outputs untouched. Same QP as test_3_qp (x0 is fixed by the singleton equality row). */ static char *test_map_refuses_qp() @@ -732,7 +728,8 @@ static char *test_map_refuses_qp() double x_red[2] = {DUMMY_VALUE, DUMMY_VALUE}; double y_red[1] = {DUMMY_VALUE}; double z_red[2] = {DUMMY_VALUE, DUMMY_VALUE}; - map_original_sol_to_reduced(presolver, x, y, x_red, y_red, z_red); + mu_assert("map QP: refused", + !map_original_sol_to_reduced(presolver, x, y, x_red, y_red, z_red)); for (int i = 0; i < 2; ++i) { mu_assert("map QP: x_red untouched", x_red[i] == DUMMY_VALUE); diff --git a/tests/test_postsolve.h b/tests/test_postsolve.h index 55fda3f1..92e90328 100644 --- a/tests/test_postsolve.h +++ b/tests/test_postsolve.h @@ -79,7 +79,7 @@ static char *test_0_postsolve() double y[] = {-2.57142857, 0.14285714}; double z[] = {-0.78571429, 1.44285714, 0.78571429, 0., 1., 0., 1.45714286}; double obj = 0.0; - postsolve(presolver, x, y, z); + mu_assert("postsolve should succeed", postsolve(presolver, x, y, z)); // check that the primal solution to the original problem is correct double correct_x[] = {10., -10., 3., -10., 2.71428571, -10., -6.85714286, -10.}; diff --git a/tests/test_ray_postsolve.h b/tests/test_ray_postsolve.h index 005a1715..28979b78 100644 --- a/tests/test_ray_postsolve.h +++ b/tests/test_ray_postsolve.h @@ -75,7 +75,8 @@ static char *test_0_primal_ray_postsolve() double y[] = {1.0, -2.0}; double y_orig[] = {0.0, 0.0}; - postsolve_primal_infeas_ray(presolver, y, y_orig); + mu_assert("primal ray postsolve should succeed", + postsolve_primal_infeas_ray(presolver, y, y_orig)); mu_assert("primal ray postsolve y0", IS_EQUAL_FEAS_TOL(y_orig[0], y[0])); mu_assert("primal ray postsolve y1", IS_EQUAL_FEAS_TOL(y_orig[1], y[1])); @@ -114,11 +115,20 @@ static char *test_0_dual_ray_postsolve() double x[] = {0.0, 0.0}; double x_orig[] = {0.0, 0.0}; - postsolve_dual_infeas_ray(presolver, x, x_orig); + mu_assert("dual ray postsolve should succeed", + postsolve_dual_infeas_ray(presolver, x, x_orig)); mu_assert("dual ray postsolve x0", IS_EQUAL_FEAS_TOL(x_orig[0], x[0])); mu_assert("dual ray postsolve x1", IS_EQUAL_FEAS_TOL(x_orig[1], x[1])); + // the primal ray needs the reduced problem, which was freed above + double y[] = {1.0, -2.0}; + double y_orig[] = {7.0, 7.0}; + mu_assert("primal ray after free should fail", + !postsolve_primal_infeas_ray(presolver, y, y_orig)); + mu_assert("primal ray after free: y_orig untouched", + y_orig[0] == 7.0 && y_orig[1] == 7.0); + free_settings(stgs); free_presolver(presolver); return 0;