From de1d4bc0b345a1f920eb086fd860379d92ebd158 Mon Sep 17 00:00:00 2001 From: Ana Mileva Date: Thu, 7 Nov 2024 10:34:59 -0800 Subject: [PATCH] Remove non-linear test example for now --- .github/workflows/test_gridpath.yml | 2 -- gridpath/run_scenario.py | 47 ++++++----------------------- tests/test_examples.py | 11 ------- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/.github/workflows/test_gridpath.yml b/.github/workflows/test_gridpath.yml index ca9838714..1cf2e6025 100644 --- a/.github/workflows/test_gridpath.yml +++ b/.github/workflows/test_gridpath.yml @@ -29,10 +29,8 @@ jobs: - name: Install Cbc and check version run: | sudo apt-get install coinor-cbc - sudo apt-get install coinor-libipopt-dev sudo apt-get install -y apt-show-versions apt-show-versions coinor-cbc - apt-show-versions coinor-libipopt-dev - name: Install Python dependencies run: | python -m pip install .[coverage] --upgrade pip diff --git a/gridpath/run_scenario.py b/gridpath/run_scenario.py index 71e892b0d..6a628efa8 100644 --- a/gridpath/run_scenario.py +++ b/gridpath/run_scenario.py @@ -1102,15 +1102,7 @@ def solve(instance, parsed_arguments): with open(solver_options_file) as f: _reader = reader(f, delimiter=",") for row in _reader: - try: - float(row[1]) # check if value is numeric - if float(row[1]).is_integer(): - val = int(float(row[1])) # ensure integer is passed - else: - val = float(row[1]) # pass float - except ValueError: - val = row[1] # keep string - solver_options[row[0]] = val + solver_options[row[0]] = row[1] # Check the solver name specified is the same as that given from the # command line (if any) @@ -1189,34 +1181,15 @@ def solve(instance, parsed_arguments): "want to pass settings through GAMS." ) else: - if solver_name == "multistart": - # TODO: get this fully implemented - # See https://pyomo.readthedocs.io/en/latest/contributed_packages - # /multistart.html - results = optimizer.solve( - instance, - strategy="midpoint_guess_and_bound", - # solver=solver_options["solver"], - solver_args={ - "tee": not parsed_arguments.mute_solver_output, - "keepfiles": parsed_arguments.keepfiles, - "symbolic_solver_labels": parsed_arguments.symbolic, - }, - iterations=2, - # solver_args={ - # o: solver_options[o] for o in solver_options.keys() if o != "solver" - # }, - suppress_unbounded_warning=True, # doesn't seem to work - ) - else: - for opt in solver_options.keys(): - optimizer.options[opt] = solver_options[opt] - results = optimizer.solve( - instance, - tee=not parsed_arguments.mute_solver_output, - keepfiles=parsed_arguments.keepfiles, - symbolic_solver_labels=parsed_arguments.symbolic, - ) + for opt in solver_options.keys(): + optimizer.options[opt] = solver_options[opt] + + results = optimizer.solve( + instance, + tee=not parsed_arguments.mute_solver_output, + keepfiles=parsed_arguments.keepfiles, + symbolic_solver_labels=parsed_arguments.symbolic, + ) # Can optionally log infeasibilities but this has resulted in false # positives due to rounding errors larger than the default tolerance diff --git a/tests/test_examples.py b/tests/test_examples.py index 47ea664e7..d7c845649 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1364,17 +1364,6 @@ def test_test_new_instantaneous_penetration(self): scenario_name = "test_new_instantaneous_penetration" self.validate_and_test_example_generic(scenario_name=scenario_name) - def test_hydro_system(self): - """ - Check validation and objective function value of "hydro_system" example - :return: - """ - - scenario_name = "hydro_system" - self.validate_and_test_example_generic( - scenario_name=scenario_name, solver="multistart" - ) - def test_hydro_system_exog_elev(self): """ Check validation and objective function value of "hydro_system" example