passagemath-glpk 10.6.46__cp314-cp314t-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-glpk might be problematic. Click here for more details.

Files changed (31) hide show
  1. passagemath_glpk/__init__.py +3 -0
  2. passagemath_glpk-10.6.46.dist-info/DELVEWHEEL +2 -0
  3. passagemath_glpk-10.6.46.dist-info/METADATA +103 -0
  4. passagemath_glpk-10.6.46.dist-info/RECORD +31 -0
  5. passagemath_glpk-10.6.46.dist-info/WHEEL +5 -0
  6. passagemath_glpk-10.6.46.dist-info/top_level.txt +3 -0
  7. passagemath_glpk.libs/libgcc_s_seh-1-8ac28fe21ad5783af7630f2f0c8f554d.dll +0 -0
  8. passagemath_glpk.libs/libglpk-40-a2b083517ab17d71a64901ccf3d73f9d.dll +0 -0
  9. passagemath_glpk.libs/libgmp-10-23decc023ff052bc2d748f1d5bb87892.dll +0 -0
  10. passagemath_glpk.libs/libwinpthread-1-e271f374468d584905afcdf7da96a6ad.dll +0 -0
  11. sage/all__sagemath_glpk.py +11 -0
  12. sage/libs/all__sagemath_glpk.py +1 -0
  13. sage/libs/glpk/__init__.py +1 -0
  14. sage/libs/glpk/constants.pxd +94 -0
  15. sage/libs/glpk/env.pxd +14 -0
  16. sage/libs/glpk/graph.pxd +43 -0
  17. sage/libs/glpk/lp.pxd +95 -0
  18. sage/libs/glpk/types.pxd +87 -0
  19. sage/numerical/all__sagemath_glpk.py +1 -0
  20. sage/numerical/backends/all__sagemath_glpk.py +1 -0
  21. sage/numerical/backends/glpk_backend.cp314t-win_amd64.pyd +0 -0
  22. sage/numerical/backends/glpk_backend.pxd +41 -0
  23. sage/numerical/backends/glpk_backend.pyx +3359 -0
  24. sage/numerical/backends/glpk_backend_test.py +13 -0
  25. sage/numerical/backends/glpk_exact_backend.cp314t-win_amd64.pyd +0 -0
  26. sage/numerical/backends/glpk_exact_backend.pxd +17 -0
  27. sage/numerical/backends/glpk_exact_backend.pyx +190 -0
  28. sage/numerical/backends/glpk_exact_backend_test.py +12 -0
  29. sage/numerical/backends/glpk_graph_backend.cp314t-win_amd64.pyd +0 -0
  30. sage/numerical/backends/glpk_graph_backend.pxd +56 -0
  31. sage/numerical/backends/glpk_graph_backend.pyx +1346 -0
@@ -0,0 +1,13 @@
1
+ # sage_setup: distribution = sagemath-glpk
2
+ import pytest
3
+
4
+ from sage.numerical.backends.generic_backend_test import GenericBackendTests
5
+ from sage.numerical.backends.generic_backend import GenericBackend
6
+ from sage.numerical.mip import MixedIntegerLinearProgram
7
+
8
+
9
+ class TestGLPKBackend(GenericBackendTests):
10
+
11
+ @pytest.fixture
12
+ def backend(self) -> GenericBackend:
13
+ return MixedIntegerLinearProgram(solver='GLPK').get_backend()
@@ -0,0 +1,17 @@
1
+ # sage_setup: distribution = sagemath-glpk
2
+ #*****************************************************************************
3
+ # Copyright (C) 2016 Matthias Koeppe
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 2 of the License, or
8
+ # (at your option) any later version.
9
+ # http://www.gnu.org/licenses/
10
+ #*****************************************************************************
11
+
12
+ from sage.numerical.backends.glpk_backend cimport GLPKBackend
13
+
14
+ cdef class GLPKExactBackend(GLPKBackend):
15
+ cpdef int add_variable(self, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, name=*) except -1
16
+ cpdef int add_variables(self, int, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, names=*) except -1
17
+ cpdef set_variable_type(self, int variable, int vtype)
@@ -0,0 +1,190 @@
1
+ # sage_setup: distribution = sagemath-glpk
2
+
3
+ """
4
+ GLPK/exact Backend (simplex method in exact rational arithmetic)
5
+
6
+ AUTHORS:
7
+
8
+ - Matthias Koeppe (2016-03)
9
+ """
10
+
11
+ ##############################################################################
12
+ # Copyright (C) 2016 Matthias Koeppe
13
+ # Distributed under the terms of the GNU General Public License (GPL)
14
+ # The full text of the GPL is available at:
15
+ # http://www.gnu.org/licenses/
16
+ ##############################################################################
17
+
18
+ cdef class GLPKExactBackend(GLPKBackend):
19
+ """
20
+ MIP Backend that runs the GLPK solver in exact rational simplex mode.
21
+
22
+ The only access to data is via double-precision floats, which
23
+ means that rationals in the input data may be rounded before
24
+ the exact solver sees them. Thus, it is unreasonable to expect
25
+ that arbitrary LPs with rational coefficients are solved exactly.
26
+ Once the LP has been read into the backend, it reconstructs
27
+ rationals from doubles and does solve exactly over the rationals,
28
+ but results are returned as as doubles.
29
+
30
+ There is no support for integer variables.
31
+ """
32
+ def __cinit__(self, maximization=True):
33
+ """
34
+ Constructor.
35
+
36
+ EXAMPLES::
37
+
38
+ sage: p = MixedIntegerLinearProgram(solver='GLPK/exact')
39
+ """
40
+ # inherited __cinit__ is called automatically
41
+ import sage.numerical.backends.glpk_backend as glpk_backend
42
+ self.solver_parameter(glpk_backend.glp_simplex_or_intopt, glpk_backend.glp_exact_simplex_only)
43
+
44
+ cpdef int add_variable(self, lower_bound=0.0, upper_bound=None, binary=False, continuous=False, integer=False, obj=0.0, name=None) except -1:
45
+ """
46
+ Add a variable.
47
+
48
+ This amounts to adding a new column to the matrix. By default,
49
+ the variable is both nonnegative and real.
50
+
51
+ In this backend, variables are always continuous (real).
52
+ If integer variables are requested via the parameters
53
+ ``binary`` and ``integer``, an error will be raised.
54
+
55
+ INPUT:
56
+
57
+ - ``lower_bound`` -- the lower bound of the variable (default: 0)
58
+
59
+ - ``upper_bound`` -- the upper bound of the variable (default: ``None``)
60
+
61
+ - ``binary`` -- ``True`` if the variable is binary (default: ``False``)
62
+
63
+ - ``continuous`` -- ``True`` if the variable is continuous (default: ``True``)
64
+
65
+ - ``integer`` -- ``True`` if the variable is integer (default: ``False``)
66
+
67
+ - ``obj`` -- (optional) coefficient of this variable in the objective function (default: 0.0)
68
+
69
+ - ``name`` -- an optional name for the newly added variable (default: ``None``)
70
+
71
+ OUTPUT: the index of the newly created variable
72
+
73
+ EXAMPLES::
74
+
75
+ sage: from sage.numerical.backends.generic_backend import get_solver
76
+ sage: p = get_solver(solver = "GLPK/exact")
77
+ sage: p.ncols()
78
+ 0
79
+ sage: p.add_variable()
80
+ 0
81
+ sage: p.ncols()
82
+ 1
83
+ sage: p.add_variable()
84
+ 1
85
+ sage: p.add_variable(lower_bound=-2.0)
86
+ 2
87
+ sage: p.add_variable(continuous=True)
88
+ 3
89
+ sage: p.add_variable(name='x',obj=1.0)
90
+ 4
91
+ sage: p.objective_coefficient(4)
92
+ 1.0
93
+
94
+ TESTS::
95
+
96
+ sage: p.add_variable(integer=True)
97
+ Traceback (most recent call last):
98
+ ...
99
+ ValueError: GLPK/exact only supports continuous variables
100
+ sage: p.add_variable(binary=True)
101
+ Traceback (most recent call last):
102
+ ...
103
+ ValueError: GLPK/exact only supports continuous variables
104
+ """
105
+ if binary or integer:
106
+ raise ValueError("GLPK/exact only supports continuous variables")
107
+ return GLPKBackend.add_variable(self, lower_bound, upper_bound, binary, continuous,
108
+ integer, obj, name)
109
+
110
+ cpdef int add_variables(self, int number, lower_bound=0.0, upper_bound=None, binary=False, continuous=False, integer=False, obj=0.0, names=None) except -1:
111
+ """
112
+ Add ``number`` variables.
113
+
114
+ This amounts to adding new columns to the matrix. By default,
115
+ the variables are both nonnegative and real.
116
+
117
+ In this backend, variables are always continuous (real).
118
+ If integer variables are requested via the parameters
119
+ ``binary`` and ``integer``, an error will be raised.
120
+
121
+ INPUT:
122
+
123
+ - ``n`` -- the number of new variables (must be > 0)
124
+
125
+ - ``lower_bound`` -- the lower bound of the variable (default: 0)
126
+
127
+ - ``upper_bound`` -- the upper bound of the variable (default: ``None``)
128
+
129
+ - ``binary`` -- ``True`` if the variable is binary (default: ``False``)
130
+
131
+ - ``continuous`` -- ``True`` if the variable is binary (default: ``True``)
132
+
133
+ - ``integer`` -- ``True`` if the variable is binary (default: ``False``)
134
+
135
+ - ``obj`` -- coefficient of all variables in the objective function (default: 0.0)
136
+
137
+ - ``names`` -- list of names (default: ``None``)
138
+
139
+ OUTPUT: the index of the variable created last
140
+
141
+ EXAMPLES::
142
+
143
+ sage: from sage.numerical.backends.generic_backend import get_solver
144
+ sage: p = get_solver(solver = "GLPK/exact")
145
+ sage: p.ncols()
146
+ 0
147
+ sage: p.add_variables(5)
148
+ 4
149
+ sage: p.ncols()
150
+ 5
151
+ sage: p.add_variables(2, lower_bound=-2.0, obj=42.0, names=['a','b'])
152
+ 6
153
+ """
154
+ if binary or integer:
155
+ raise ValueError("GLPK/exact only supports continuous variables")
156
+ return GLPKBackend.add_variables(self, number, lower_bound, upper_bound, binary, continuous,
157
+ integer, obj, names)
158
+
159
+ cpdef set_variable_type(self, int variable, int vtype):
160
+ """
161
+ Set the type of a variable.
162
+
163
+ In this backend, variables are always continuous (real).
164
+ If integer or binary variables are requested via the parameter
165
+ ``vtype``, an error will be raised.
166
+
167
+ INPUT:
168
+
169
+ - ``variable`` -- integer; the variable's id
170
+
171
+ - ``vtype`` -- integer:
172
+
173
+ * 1 Integer
174
+ * 0 Binary
175
+ * -1 Real
176
+
177
+ EXAMPLES::
178
+
179
+ sage: from sage.numerical.backends.generic_backend import get_solver
180
+ sage: p = get_solver(solver = "GLPK/exact")
181
+ sage: p.add_variables(5)
182
+ 4
183
+ sage: p.set_variable_type(3, -1)
184
+ sage: p.set_variable_type(3, -2)
185
+ Traceback (most recent call last):
186
+ ...
187
+ ValueError: ...
188
+ """
189
+ if vtype != -1:
190
+ raise ValueError("GLPK/exact only supports continuous variables")
@@ -0,0 +1,12 @@
1
+ # sage_setup: distribution = sagemath-glpk
2
+ import pytest
3
+ from sage.numerical.backends.generic_backend_test import GenericBackendTests
4
+ from sage.numerical.backends.generic_backend import GenericBackend
5
+ from sage.numerical.mip import MixedIntegerLinearProgram
6
+
7
+
8
+ class TestGLPKExactBackend(GenericBackendTests):
9
+
10
+ @pytest.fixture
11
+ def backend(self) -> GenericBackend:
12
+ return MixedIntegerLinearProgram(solver='GLPK/exact').get_backend()
@@ -0,0 +1,56 @@
1
+ # sage_setup: distribution = sagemath-glpk
2
+ #*****************************************************************************
3
+ # Copyright (C) 2012 Christian Kuper <christian.kuper@t-online.de>
4
+ # Copyright (C) 2015 Jeroen Demeyer <jdemeyer@cage.ugent.be>
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ # http://www.gnu.org/licenses/
11
+ #*****************************************************************************
12
+
13
+ from sage.libs.glpk.types cimport glp_graph
14
+
15
+ ctypedef struct c_v_data:
16
+ double rhs
17
+ double pi
18
+ double es
19
+ double ls
20
+ long cut
21
+
22
+ ctypedef struct c_a_data:
23
+ double low
24
+ double cap
25
+ double cost
26
+ double x
27
+
28
+
29
+ cdef class GLPKGraphBackend():
30
+ cdef glp_graph * graph
31
+ cpdef add_vertex(self, name=?)
32
+ cpdef list add_vertices(self, vertices)
33
+ cpdef __add_vertices_sage(self, g)
34
+ cpdef dict get_vertex(self, vertex)
35
+ cpdef dict get_vertices(self, verts)
36
+ cpdef set_vertex_demand(self, vertex, param)
37
+ cpdef set_vertices_demand(self, list pairs)
38
+ cpdef list vertices(self)
39
+ cpdef add_edge(self, u, v, dict params=?)
40
+ cpdef __add_edges_sage(self, g)
41
+ cpdef list add_edges(self, edges)
42
+ cpdef delete_edge(self, u, v, dict params=?)
43
+ cpdef tuple get_edge(self, u, v)
44
+ cpdef list edges(self)
45
+ cpdef delete_vertex(self, vert)
46
+ cpdef delete_vertices(self, list verts)
47
+ cpdef int _find_vertex(self, vert) noexcept
48
+ cpdef int write_graph(self, fname) noexcept
49
+ cpdef int write_ccdata(self, fname) noexcept
50
+ cpdef int write_mincost(self, fname) noexcept
51
+ cpdef double mincost_okalg(self) except -1
52
+ cdef int s
53
+ cdef int t
54
+ cpdef int write_maxflow(self, fname) except -1
55
+ cpdef double maxflow_ffalg(self, u=?, v=?) except -1
56
+ cpdef double cpp(self) noexcept