Calling GAMS

Top  Previous  Next

In the Delphi program GAMS is used via a set of routines embedded in gamsmod.pas.  The basic GAMS execution is activated using the function ExecuteGAMS as follows

 

gamsfile:='trandelp.gms';

gamsparms:='';

returncode:=ExecuteGAMS(gamsfile,gamspath,gamsparms);

 

The status of the execution is obtained from another routine in gamsmod.pas as follows

 

strr:=GamsErrorString(returncode);

 

while the optimality etc status comes from reading the modelstat line at the end of the output.csv put file in the commands

 

readln(firead,strr);

k:=pos(',',strr);

strr:=copy(strr,k+1,length(strr));

stat:=strtoint(strr);

 

then calling a utility in gamsmod.pas which gives back a string on optimality status

 

strr:=optstatus(stat);