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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(PSLP LANGUAGES C CXX) # The library is written in C, but we also have so

set(PSLP_VERSION_MAJOR 0)
set(PSLP_VERSION_MINOR 0)
set(PSLP_VERSION_PATCH 6)
set(PSLP_VERSION_PATCH 7)
set(PSLP_VERSION "${PSLP_VERSION_MAJOR}.${PSLP_VERSION_MINOR}.${PSLP_VERSION_PATCH}")
add_compile_definitions(PSLP_VERSION="${PSLP_VERSION}")

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2025 Daniel Cederberg
Copyright 2025-2026 Daniel Cederberg

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/PSLP/PSLP_API.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/PSLP/PSLP_sol.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/PSLP/PSLP_stats.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Activity.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Bounds.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Constraints.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/CoreTransformations.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Debugger.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Locks.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Matrix.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Numerics.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Postsolver.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Problem.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/RowColViews.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/State.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Tags.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/Workspace.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/debug_macros.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/glbopts.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/radix_sort.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/core/utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/Binary_search.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/Memory_wrapper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/Vec_macros.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/dVec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/iVec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/data_structures/u16Vec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/DTonsEq.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/Parallel_cols.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/Parallel_rows.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/Primal_propagation.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/SimpleReductions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/Simple_dual_fix.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/StonCols.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion include/explorers/Timer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/Activity.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/Constraints.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/CoreTransformation.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/Debugger.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/Locks.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
32 changes: 30 additions & 2 deletions src/core/Matrix.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down Expand Up @@ -27,6 +27,9 @@
#include "stdlib.h"
#include "string.h"

/* forward declaration */
static inline void remove_explicit_zeros(Matrix *A);

Matrix *matrix_new(const double *Ax, const int *Ai, const int *Ap, size_t n_rows,
size_t n_cols, size_t nnz)
{
Expand Down Expand Up @@ -114,9 +117,35 @@ Matrix *matrix_new_no_extra_space(const double *Ax, const int *Ai, const int *Ap
A->p[i].end = Ap[i + 1];
}

/* the presolver assumes that only nonzero entries are stored */
remove_explicit_zeros(A);

return A;
}

static inline void remove_explicit_zeros(Matrix *A)
{
int i, j, shift;
for (i = 0; i < A->m; ++i)
{
shift = 0;
for (j = A->p[i].start; j < A->p[i].end; ++j)
{
if (A->x[j] == 0.0)
{
shift++;
}
else if (shift > 0)
{
A->x[j - shift] = A->x[j];
A->i[j - shift] = A->i[j];
}
}
A->p[i].end -= shift;
A->nnz -= (size_t) shift;
}
}

Matrix *transpose(const Matrix *A, int *work_n_cols)
{
Matrix *AT = matrix_alloc(A->n, A->m, A->nnz);
Expand Down Expand Up @@ -433,7 +462,6 @@ double insert_or_update_coeff(Matrix *A, int row, int col, double val, int *row_
// -----------------------------------------------------------------
if (ABS(val) > ZERO_TOL)
{
// assert(!IS_ZERO_FEAS_TOL(val));
if (insertion == end)
{
A->x[insertion] = val;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Postsolver.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
3 changes: 2 additions & 1 deletion src/core/Presolver.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down Expand Up @@ -305,6 +305,7 @@ Presolver *new_presolver(const double *Ax, const int *Ai, const int *Ap, size_t
presolver->stgs = stgs;
presolver->prob = new_problem(constraints, obj);
presolver->stats = init_stats(A->m, A->n, nnz);
presolver->stats->nnz_removed_trivial = nnz - (size_t) A->nnz; /* explicit 0's */
presolver->reduced_prob =
(PresolvedProblem *) ps_calloc(1, sizeof(PresolvedProblem));
DEBUG(run_debugger(constraints, false));
Expand Down
2 changes: 1 addition & 1 deletion src/core/Problem.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/State.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Daniel Cederberg
* Copyright 2025-2026 Daniel Cederberg
*
* This file is part of the PSLP project (LP Presolver).
*
Expand Down
Loading