Skip to content

Commit e376639

Browse files
authored
small changes to API (#12)
* code dump * workflows * ran formatter * readme * workflow * removed old workflows * new workflow * c++ workflow * C++ workflow * new line at eof to formatter * improved interface * new workflow * new workflow * new workflow * updated default settings * small changes to API
1 parent 5bad337 commit e376639

15 files changed

Lines changed: 36 additions & 49 deletions

include/PSLP/PSLP_API.h

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* Public header containing the outward facing API. It includes all the
20-
input/output data structs and the API functions. Make sure this file is
21-
somewhere appropriate and then use `#include <PSLP/"API.h"
22-
>` to access the
23-
public API. */
19+
/* Public header containing the outward facing API. Together with the other
20+
files in the folder "PSLP", it includes the input/output data structs
21+
and the API functions. */
2422
#ifndef PRESOLVER_H
2523
#define PRESOLVER_H
2624

@@ -29,8 +27,8 @@ extern "C"
2927
{
3028
#endif
3129

32-
#include "PresolveStatus.h"
33-
#include "Sol.h"
30+
#include "PSLP_sol.h"
31+
#include "PSLP_status.h"
3432
#include <stdbool.h>
3533

3634
/* forward declaration */
@@ -69,13 +67,21 @@ extern "C"
6967
double *rhs;
7068
double *c;
7169

72-
// variable bounds bounds[k].lb <= x_k <= bounds[k].ub
73-
// Bound *bounds;
70+
// variable bounds lbs <= x <= ubs
7471
double *lbs;
7572
double *ubs;
7673
} PresolvedProblem;
7774

78-
/* struct corresponding to the presolver*/
75+
/* struct corresponding to the presolver:
76+
- 'stats' contains statistics about the presolving process
77+
- 'stgs' contains the settings used for presolving
78+
- 'prob' contains the internal problem representation used during
79+
presolving
80+
- 'reduced_prob' contains the presolved problem after running
81+
'run_presolver'
82+
- 'sol' contains the solution to the original problem after running
83+
'postsolve'
84+
*/
7985
typedef struct
8086
{
8187
struct PresolveStats *stats;
@@ -85,16 +91,15 @@ extern "C"
8591
Solution *sol;
8692
} Presolver;
8793

88-
/* The user is responsible for freeing the settings struct using standard free.
89-
*/
94+
/* The user is responsible for freeing the settings using 'free_settings'. */
9095
Settings *default_settings();
9196
void free_settings(Settings *stgs);
9297
void set_settings_true(Settings *stgs);
9398
void set_settings_false(Settings *stgs);
9499

95100
/* Initialize presolver, allocate memory, and build internal data structures.
96101
The presolver maintains internal deep copies of Ax, Ai, Ap, lhs, rhs, lbs,
97-
ubs, and c. The user is responsible for freeing this memory using
102+
ubs, and c. The user is responsible for freeing the presolver using
98103
'free_presolver'. If the allocation fails, the function returns NULL. */
99104
Presolver *new_presolver(const double *Ax, const int *Ai, const int *Ap, int m,
100105
int n, int nnz, const double *lhs, const double *rhs,
@@ -104,13 +109,14 @@ extern "C"
104109
/* Free the memory allocated for the presolver. */
105110
void free_presolver(Presolver *presolver);
106111

107-
/* Runs the presolver. At completion, the 'problem' field of the presolver
108-
contains the presolved problem. */
112+
/* Runs the presolver. At completion, the 'reduced_prob' field of the
113+
presolver contains the presolved problem. */
109114
PresolveStatus run_presolver(Presolver *presolver);
110115

111116
/* Postsolve the problem given the primal-dual solution (x, y, z) of the
112117
reduced problem. The optimal value of the reduced problem is 'obj'.
113-
The function populates presolver->sol. */
118+
The function populates presolver->sol, so if you're looking for the
119+
solution to the original problem, you should look there. */
114120
void postsolve(Presolver *presolver, const double *x, const double *y,
115121
const double *z, double obj);
116122

include/PSLP/PSLP_infs.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

include/core/CoreTransformations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#ifndef CORE_TRANSFORMATIONS_H
2020
#define CORE_TRANSFORMATIONS_H
2121

22+
#include "PSLP_status.h"
2223
#include "Postsolver.h"
23-
#include "PresolveStatus.h"
2424
#include "Tags.h"
2525
#include "debug_macros.h"
2626
#include "glbopts.h"

include/core/Postsolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <stdbool.h>
2323
#include <stdint.h>
2424

25-
#include "Sol.h"
25+
#include "PSLP_sol.h"
2626
#include "Tags.h"
2727

2828
struct u16Vec;

include/explorers/DTonsEq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef DTONS_EQ_H
2020
#define DTONS_EQ_H
2121

22-
#include "PresolveStatus.h"
22+
#include "PSLP_status.h"
2323
struct Matrix;
2424
struct Problem;
2525
struct PostsolveInfo;

include/explorers/Parallel_cols.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef PARALLEL_COLS_H
2020
#define PARALLEL_COLS_H
2121

22-
#include "PresolveStatus.h"
22+
#include "PSLP_status.h"
2323

2424
// forward declaration
2525
struct Problem;

include/explorers/Parallel_rows.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef PARALLEL_ROWS_H
2020
#define PARALLEL_ROWS_H
2121

22-
#include "PresolveStatus.h"
22+
#include "PSLP_status.h"
2323
#include "Tags.h"
2424

2525
// forward declarations

include/explorers/Primal_propagation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <stdbool.h>
2323

24-
#include "PresolveStatus.h"
24+
#include "PSLP_status.h"
2525
#include "Tags.h"
2626

2727
struct Constraints;

0 commit comments

Comments
 (0)