Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
emma58 committed Aug 13, 2024
1 parent e890a25 commit 10b9026
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyomo/contrib/piecewise/tests/test_nonlinear_to_pwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def test_uniform_sampling_discrete_vars(self):
for x in [0, 1]:
for y in [0, 1]:
for z in [0, 2, 5]:
self.assertIn((x, y, z), points)
self.assertIn((x, y, z), points)

@unittest.skipUnless(numpy_available, "Numpy is not available")
def test_random_sampling_discrete_vars(self):
Expand Down
7 changes: 4 additions & 3 deletions pyomo/contrib/piecewise/transform/nonlinear_to_pwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ def _get_random_point_grid(bounds, n, func, config, seed=42):
linspaces.append(np.random.uniform(lb, ub, n))
else:
size = min(n, ub - lb + 1)
linspaces.append(np.random.choice(range(lb, ub + 1), size=size,
replace=False))
linspaces.append(
np.random.choice(range(lb, ub + 1), size=size, replace=False)
)
return list(itertools.product(*linspaces))


Expand Down Expand Up @@ -169,7 +170,7 @@ def _get_pwl_function_approximation(func, config, bounds):
func: function to approximate
config: ConfigDict for transformation, specifying domain_partitioning_method,
num_points, and max_depth (if using linear trees)
bounds: list of tuples giving upper and lower bounds and a boolean indicating
bounds: list of tuples giving upper and lower bounds and a boolean indicating
if the variable's domain is discrete or not, for each of func's arguments
"""
method = config.domain_partitioning_method
Expand Down

0 comments on commit 10b9026

Please sign in to comment.