Skip to content

Commit

Permalink
applied ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Sep 11, 2024
1 parent fccdf0c commit f10693d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tests/test_conjugate_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def test_conjugate_gradient_simple():
# A = np.diag(np.arange(1, n + 1))
# x_true = np.random.rand(n)
# b = np.dot(A, x_true)
#
#
# x = conjugate_gradient(A, b)
#
#
# assert np.allclose(x, x_true, rtol=1e-5)


Expand All @@ -40,7 +40,7 @@ def test_conjugate_gradient_with_initial_guess():
# def test_conjugate_gradient_non_convergence():
# A = np.array([[1.0, 2.0], [2.0, 1.0]]) # Not positive definite
# b = np.array([1.0, 1.0])
#
#
# with pytest.raises(ValueError):
# conjugate_gradient(A, b, max_iter=10)

Expand Down
24 changes: 12 additions & 12 deletions tests/test_lmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def __init__(self, oracle):
instance.
:param oracle: The `oracle` parameter in the `__init__` method is a function that takes two
arguments `F` and `B` and returns some value. In this code snippet, the `oracle` function is being
used to create two instances `lmi1` and `lmi2`
arguments `F` and `B` and returns some value. In this code snippet, the `oracle` function is being
used to create two instances `lmi1` and `lmi2`
"""
self.c = np.array([1.0, -1.0, 1.0])
F1 = np.array(
Expand All @@ -52,15 +52,15 @@ def assess_optim(self, xc: np.ndarray, gamma: float) -> Tuple[Cut, Optional[floa
This function assesses the optimality of a solution based on given constraints and a target value.
:param xc: The parameter `xc` is a NumPy array representing a point in a multidimensional space. It
is used as input to assess the optimality of a solution in a mathematical optimization context
is used as input to assess the optimality of a solution in a mathematical optimization context
:type xc: np.ndarray
:param gamma: Gamma is the best-so-far optimal value that is passed as an argument to the
`assess_optim` method. It is a float value used in the optimization process to determine the
optimality of a solution
`assess_optim` method. It is a float value used in the optimization process to determine the
optimality of a solution
:type gamma: float
:return: The `assess_optim` method returns a tuple containing a `Cut` object and an optional float
value. The `Cut` object represents a cut in the optimization problem, while the float value
represents the optimality measure.
value. The `Cut` object represents a cut in the optimization problem, while the float value
represents the optimality measure.
"""
for _ in range(3):
self.idx = 0 if self.idx == 2 else self.idx + 1 # round robin
Expand All @@ -84,13 +84,13 @@ def run_lmi(oracle, space):
optimization using cutting plane method, and returns the number of iterations.
:param oracle: The `oracle` parameter in the `run_lmi` function is expected to be a type that is
used as an argument for the `MyOracle` class. It seems like the `MyOracle` class is used to wrap the
`oracle` parameter for some specific functionality within the `run_l
used as an argument for the `MyOracle` class. It seems like the `MyOracle` class is used to wrap the
`oracle` parameter for some specific functionality within the `run_l
:param Space: The `Space` parameter in the `run_lmi` function seems to be a class or function that
takes two arguments - a float value `10.0` and an array `xinit`. It likely initializes some kind of
space or environment based on these inputs
takes two arguments - a float value `10.0` and an array `xinit`. It likely initializes some kind of
space or environment based on these inputs
:return: The function `run_lmi` returns the number of iterations (`num_iters`) after running the
cutting plane optimization algorithm.
cutting plane optimization algorithm.
"""
xinit = np.array([0.0, 0.0, 0.0]) # initial xinit
ellip = space(10.0, xinit)
Expand Down

0 comments on commit f10693d

Please sign in to comment.