|
Reading the GAMS solution |
Top Previous Next |
|
In the Delphi program the results passed from GAMS are read by code such as
if FileExists('output.csv') then begin AssignFile(firead, 'output.csv'); reset(firead); readln(firead,strr); for i:= 1 to 2 do begin for j:= 1 to 3 do begin readln(firead,strr); k:=pos(',',strr); strr:=copy(strr,k+1,length(strr)); k:=pos(',',strr); strr:=copy(strr,k+1,length(strr)); stringgrid2.cells[j,i]:=strr; end; end; for i:= 1 to 2 do begin readln(firead,strr); k:=pos(',',strr); strr:=copy(strr,k+1,length(strr)); k:=pos('',strr); if(k>0) then strr:=copy(strr,k+1,length(strr)); stringgrid2.cells[4,i]:=strr; end;
Which makes sure the file is present then reads and decodes the solution and places it in a Delphi feature called stringgrid2. The code above brings in the solution and supply shadow prices. |