Loading...
Searching...
No Matches
g2np_example2.py File Reference

This example uses the gams.numpy API in order to demonstrate... More...

Go to the source code of this file.

Variables

str g2np_example2.GAMS_MODEL
 
sys g2np_example2.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
 
GamsWorkspace g2np_example2.ws = GamsWorkspace(system_directory=sys_dir)
 
np g2np_example2.plants = np.array([["Seattle", ""], ["San-Diego", ""]])
 
np g2np_example2.markets = np.array([["New-York", ""], ["Chicago", ""], ["Topeka", ""]])
 
np g2np_example2.capacity = np.array([["Seattle", 350.0], ["San-Diego", 600.0]], dtype=object)
 
np g2np_example2.demand
 
np g2np_example2.distance
 
gdx g2np_example2.gdx_h = gdx.new_gdxHandle_tp()
 
 g2np_example2.rc
 
 g2np_example2.msg
 
os g2np_example2.gdx_file = os.path.join(ws.working_directory, "data.gdx")
 
gnp g2np_example2.gams2np = gnp.Gams2Numpy(ws.system_directory)
 
GamsWorkspace g2np_example2.opt = ws.add_options()
 
 g2np_example2.all_model_types
 
GamsWorkspace g2np_example2.job = ws.add_job_from_string(GAMS_MODEL)
 

Detailed Description

This example uses the gams.numpy API in order to demonstrate...

  • How to prepare a GDX file from numpy arrays
  • How to run a job using data from GDX
  • How to export the results of a GamsJob to GDX and read them into numpy arrays

Definition in file g2np_example2.py.