Debian Codegraph @

include/mps/private/convex.h

raw
1 /*
2 * This file is part of MPSolve 3.2.2
3 *
4 * Copyright (C) 2001-2020, Dipartimento di Matematica "L. Tonelli", Pisa.
5 * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
6 *
7 * Authors:
8 * Leonardo Robol <[email protected]>
9 */
10
11 /**
12 * @file
13 *
14 * @brief Implementation of the convex hull computation.
15 */
16
17 #ifndef MPS_CONVEX_H_
18 #define MPS_CONVEX_H_
19
20 #include <mps/mps.h>
21
22 /**
23 * @brief Generic vertex of a linear hypograph.
24 */
25 struct mps_vertex {
26 /**
27 * @brief The x coordinate of the vertex.
28 */
29 int x;
30
31 /**
32 * @brief The y coordinate of the vertex.
33 */
34 double y;
35
36 /**
37 * @brief A pointer to the next vertex in the hypograph, or
38 * NULL if this is the last vertex or a detached one.
39 */
40 struct mps_vertex * next;
41
42 /**
43 * @brief A pointer to the previous vertex in the hypograph,
44 * or NULL if this is the first vertex or a detached one.
45 */
46 struct mps_vertex * previous;
47 };
48
49 typedef struct mps_vertex mps_vertex;
50
51 /**
52 * @brief A set described as hypograph of a piecewise linear function.
53 *
54 * The explicit description of the set is given by a set of vertexes of the
55 * type \f$(i, y_i)\f$ where \f$i\f$ is a positive integer.
56 */
57 struct mps_linear_hypograph {
58 int n;
59
60 mps_vertex * last;
61
62 mps_vertex * first;
63 };
64
65 typedef struct mps_linear_hypograph mps_linear_hypograph;
66
67 mps_linear_hypograph * mps_convex_hull (mps_context * s, mps_linear_hypograph * l);
68
69 int * mps_fconvex (mps_context * s, int n, double a[]);
70
71 mps_linear_hypograph * mps_linear_hypograph_new (mps_context * ctx);
72
73 void mps_linear_hypograph_free (mps_context * ctx, mps_linear_hypograph * l);
74
75 #endif /* endif MPS_CONVEX_H_ */
76
77