Skip to content

Commit

Permalink
The high level gams api does not like byte strings
Browse files Browse the repository at this point in the history
  • Loading branch information
squoilin committed Jan 26, 2022
1 parent 9974d76 commit 2529b24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dispaset/misc/gms_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
def solve_high_level(gams_folder, sim_folder, gams_file='UCM_h.gms', result_file='Results.gdx', output_lst=False):
"""Use higher level apis to run GAMSy"""
# create GAMS workspace:
if isinstance(gams_folder, bytes):
gams_folder = gams_folder.decode()
try:
from gams import GamsWorkspace
ws = GamsWorkspace(system_directory=str(gams_folder), debug=3)
Expand Down
8 changes: 4 additions & 4 deletions dispaset/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def solve_GAMS(sim_folder, gams_folder=None, gams_file='UCM_h.gms', result_file=
:param output_lst: Set to True to conserve a copy of the GAMS lst file in the simulation folder
'''

if package_exists('gamsxcc') and package_exists('optcc'):
solv_func = solve_low_level
logging.info('Using the low-level gams api')
elif package_exists('gams'):
if package_exists('gams'):
solv_func = solve_high_level
logging.info('Using the high-level gams api')
elif package_exists('gamsxcc') and package_exists('optcc'):
solv_func = solve_low_level
logging.info('Using the low-level gams api')
else:
logging.warning('Could not find the GAMS APIs. Trying to locate local version')
if not import_local_lib('lowlevel'):
Expand Down

0 comments on commit 2529b24

Please sign in to comment.