Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-GAMS models #119

Open
khaeru opened this issue Feb 13, 2019 · 2 comments
Open

Support non-GAMS models #119

khaeru opened this issue Feb 13, 2019 · 2 comments
Labels
enh New features & functionality

Comments

@khaeru
Copy link
Member

khaeru commented Feb 13, 2019

Scenario.solve() ends with the following lines:

ixmp/ixmp/core.py

Lines 1234 to 1238 in aa7b2fe

# write to gdx, execture GAMS, read solution from gdx
self.to_gdx(ipth, ingdx)
run_gams(model_file, args)
self.read_sol_from_gdx(opth, outgdx, comment,
var_list, equ_list, check_solution)

In order to support other, non-GAMS models, the following changes could be made:

  1. Extend and generalize the code in ixmp.model_settings, adding:
    • a new ixmp.model.Model abstract class,
    • an ixmp.model.GAMSModel subclass.
  2. Change Scenario.to_gdx(…) to GAMSModel.write_data(scenario, …).
  3. Change run_gams(…) to GAMSModel.run(scenario, …).
  4. Change Scenario.read_sol_from_gdx(…) to GAMSModel.read_solution(scenario, …).

After this, users would be able to run non-GAMS models by subclassing ixmp.Model() and implementing the methods write_data(), run(), and read_sol_from_gdx().

As identified here in the discussion of #108.

@khaeru khaeru added the enh New features & functionality label Feb 13, 2019
@khaeru
Copy link
Member Author

khaeru commented Jul 3, 2019

Here's a modified version of Dantzig's cannery/transport problem from the Julia/JuMP optimization examples: cannery.jl.txt

To check that Model has been properly abstracted, a test could be written calling this through a JuliaModel class.

@khaeru
Copy link
Member Author

khaeru commented Aug 27, 2020

The branch feature/pyomo-model contains some experimental code using Pyomo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

No branches or pull requests

1 participant