Skip to content

Commit e9cac8d

Browse files
authored
Merge pull request #63 from TAMUparametric/warnings
Moving program warnings to not print to std out
2 parents ad1330a + 795e50c commit e9cac8d

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import find_packages, setup
22

3-
__version__ = "1.6.9"
3+
__version__ = "1.6.10"
44

55
short_desc = (
66
"Extensible Multiparametric Solver in Python"

src/ppopt/mp_solvers/mpqp_parallel_combinatorial_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,6 @@ def solve(program: MPQP_Program, num_cores=-1) -> Solution:
131131
if len(to_check) == 0:
132132
break
133133

134-
pool.clear()
134+
# pool.clear()
135135

136136
return solution

src/ppopt/mp_solvers/mpqp_parallel_geometric_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,6 @@ def solve(program: MPQP_Program, initial_active_sets: Optional[List[List[int]]]
167167
work_items.extend(
168168
[(theta, facet_normal, radius, found_cr.active_set) for theta, facet_normal, radius in facets])
169169

170-
pool.clear()
170+
# pool.clear()
171171

172172
return solution

src/ppopt/mp_solvers/mpqp_parrallel_combinatorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ def solve(program: MPQP_Program, num_cores=-1) -> Solution:
145145
if region is not None:
146146
solution.add_region(region)
147147

148-
pool.clear()
148+
# pool.clear()
149149

150150
return solution

src/ppopt/mplp_program.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import List, Optional, Tuple
22

33
import numpy
4+
import warnings
45

56
from .solver import Solver
67
from .solver_interface.solver_interface_utils import SolverOutput
@@ -96,11 +97,11 @@ def __init__(self, A, b, c, H, A_t, b_t, F, c_c=None, c_t=None, Q_t=None, equali
9697
self.base_constraint_processing()
9798

9899
# grab all warnings
99-
warnings = self.warnings()
100+
problem_warning = self.warnings()
100101

101102
# print warnings if there are any
102-
if len(warnings) > 0:
103-
print(warnings)
103+
for warning in problem_warning:
104+
warnings.warn(warning, UserWarning)
104105

105106
# calls constraint processing to remove redundant constraints
106107
if post_process:

tests/mpqp_solver_tests/test_mpqp_combinatorial.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ def test_generate_children_4(filled_combo_tester):
5454
assert output == [[0, 4], [0, 5], [0, 6], [0, 7]]
5555

5656

57-
def test_generate_children_5(blank_combo_tester, linear_program):
58-
output = generate_children_sets(linear_program.equality_indices, linear_program.num_constraints(), blank_combo_tester)
57+
def test_generate_children_5(blank_combo_tester):
58+
output = generate_children_sets([0], 3, blank_combo_tester)
5959
assert output == [[0, 1], [0, 2]]
6060

6161

62-
def test_generate_children_6(blank_combo_tester, linear_program):
63-
output = generate_children_sets([0, 1], linear_program.num_constraints(), blank_combo_tester)
62+
def test_generate_children_6(blank_combo_tester):
63+
output = generate_children_sets([0, 1], 3, blank_combo_tester)
6464
assert output == [[0, 1, 2]]
6565

6666

67-
def test_generate_children_7(blank_combo_tester, linear_program):
67+
def test_generate_children_7(blank_combo_tester):
6868
A = numpy.array(
6969
[[1, 1, 0, 0], [0, 0, 1, 1], [-1, 0, -1, 0], [0, -1, 0, -1], [-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0],
7070
[0, 0, 0, -1]])
@@ -74,9 +74,9 @@ def test_generate_children_7(blank_combo_tester, linear_program):
7474
Q = numpy.diag([153, 162, 162, 126])
7575

7676
CRa = numpy.vstack((numpy.eye(2), -numpy.eye(2)))
77-
CRb = numpy.array([1000, 1000, 0, 0]).reshape(4, 1)
77+
CRb = numpy.array([1000, 1000, 0, 0]).reshape(-1, 1)
7878
H = numpy.zeros((F.shape[1], Q.shape[0]))
79-
program = MPQP_Program(A, b, c, H, Q, CRa, CRb, F, equality_indices = [0])
79+
program = MPQP_Program(A, b, c, H, Q, CRa, CRb, F, equality_indices=[0])
8080

8181
output = generate_children_sets(program.equality_indices, program.num_constraints(), blank_combo_tester)
8282
assert output == [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7]]

0 commit comments

Comments
 (0)