Skip to content

Commit

Permalink
Remove non-linear test example for now
Browse files Browse the repository at this point in the history
  • Loading branch information
anamileva committed Nov 7, 2024
1 parent fe7d50e commit de1d4bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 50 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test_gridpath.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 10 additions & 37 deletions gridpath/run_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de1d4bc

Please sign in to comment.