Skip to content

Pass user-defined parameter to MACRO #611

Answered by khaeru
Aprillmylmy asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Emily—thanks for the question!

Yes, this is supported. Please have a look at the following:

  • Scenario.init_scalar() or perhaps .init_par()—these methods allow to define a new 0-d or 1+-dimensional parameter, like your "maxloop", so that data can then be stored with .change_scalar() or .add_par(), respectively.
  • When scenario.solve() is called, all data (sets and parameters) are written to GDX file. This will include your newly-defined one.
  • You will still need to modify the GAMS code to retrieve that value from the GDX file in order to be available as a GAMS variable for use by other code. You should do that around here:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Aprillmylmy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
macro MACRO model or MESSAGE-MACRO link
2 participants