Skip to content

Commit a312c49

Browse files
committed
Ran black
1 parent aa9ba5b commit a312c49

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

pyomo/contrib/multistart/multi.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
from pyomo.contrib.solver.common.config import SolverConfig
3333
from pyomo.contrib.solver.common.factory import SolverFactory
3434
from pyomo.contrib.solver.common.results import SolutionStatus
35-
from pyomo.contrib.solver.common.util import NoOptimalSolutionError, NoSolutionError, NoFeasibleSolutionError
35+
from pyomo.contrib.solver.common.util import (
36+
NoOptimalSolutionError,
37+
NoSolutionError,
38+
NoFeasibleSolutionError,
39+
)
3640
from pyomo.util.vars_from_expressions import get_vars_from_components
3741

3842
from pyomo.common.dependencies.scipy import stats
@@ -198,12 +202,11 @@ def __init__(self, **kwds: Any) -> None:
198202
#: Instance configuration;
199203
self.config = self.config
200204

201-
202205
def available(self, exception_flag=True):
203206
"""Check if solver is available.
204207
205208
The multistart solver wrapper should always be available,
206-
but it is not guaranteed the subsolvers will be.
209+
but it is not guaranteed the subsolvers will be.
207210
Check if the selected subsolver is available, which by default is ipopt.
208211
"""
209212

@@ -259,7 +262,7 @@ def solve(self, model, **kwds):
259262
obj_sign = obj.sign
260263

261264
else:
262-
obj_sign = 1
265+
obj_sign = 1
263266

264267
best_objective = float('inf') * obj_sign
265268

@@ -369,11 +372,10 @@ def solve(self, model, **kwds):
369372
if config.raise_exception_on_nonoptimal_result and not using_HCS:
370373
if best_result.solution_status != SolutionStatus.optimal:
371374
raise NoOptimalSolutionError
372-
373-
375+
374376
# if no better result was found than initial solve, then return
375377
# that without needing to copy variables.
376-
if best_model is model:
378+
if best_model is model:
377379
return best_result
378380

379381
# reassign the given models vars to the new models vars

pyomo/contrib/multistart/tests/test_multi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def test_multiple_obj(self):
134134
with self.assertRaisesRegex(RuntimeError, "multiple active objectives"):
135135
SolverFactory('multistart').solve(m)
136136

137+
137138
def build_model():
138139
"""Simple non-convex model with many local minima"""
139140
model = ConcreteModel()

pyomo/devel/initialization/multistart_init.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
from pyomo.devel.initialization.bounds.bound_variables import (
1616
bound_all_nonlinear_variables,
1717
)
18-
from pyomo.devel.initialization.utils import (
19-
shallow_clone,
20-
fix_vars_with_equal_bounds,
21-
)
18+
from pyomo.devel.initialization.utils import shallow_clone, fix_vars_with_equal_bounds
2219
import logging
2320

2421
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)