Hi Dharmender
Why should the put-statement better: You have the results in a csv file, which than has to be imported (with all the dangers of importing stuff) into another program.
Sending the results from gdx to Excel is straightforward and very flexible.
I only have used the PUT statement for very, very special occasions and for all other stuff I have been using gdxxrw and gdxrrw (or its predecessor) for over 20 years.
Gdx is the way to go
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of dharmender yadav
Sent: Wednesday, November 26, 2014 12:38
To: gamsworld@googlegroups.com
Subject: Re: How to force Gams to print ‘0’ values while writing the results in excel after solving the entire model
Hi,
It is better to use Put statements for getting the output in desired format.
Here is an example
file filez22 /D:\assignment.csv/; //// file path////
filez22.pc=5; ////use this line as it is////
Put filez22; ////use this line as it is////
put "“flow”, “distance”,“weight” /; ////gives heading to the columns/////
loop ((I,j,v)$x.l(i,j,v), put i.tl, j.tl,v.tl, x.l(i,j,v), d(i,j), w(i) / ); ////mention what you need in output
putclose filez22; ////use this line as it is////
In your case if you want to get all the values for binary variable x(i,j), then iterate the loop over the desired parameter by:
loop ((I,j,v)$Parameter(i,j,v), put i.tl, j.tl,v.tl, x.l(i,j,v), d(i,j), w(i) /)
Thanks,
Dharmender
On Wed, Nov 26, 2014 at 4:38 PM, Sugandha Singla wrote:
Hello all
i have solved the entire model
and then at the end i tried to write the results in excel sheet via converting it to gdx first by writing:-
Execute_Unload ‘results_optimal_case.gdx’, x , y, Inventory, Counter, County, counter2, counter3, counter4, FT, FBR_Farms, Demand,
TotalCost, TotalRefineryCost, TotalRBPDCost, TotalTPCost, TotalFarmGateCost, TotalStorageCost,
RefineryCostFraction, RBPDCostFraction, TransportCostFraction, FarmGateCostFraction, StorageCostFraction, TotalRBPDOperationCost,TotalRBPDCapitalCost, TotalOC, TotalEDC, Cost, OC ;
where x,y , counter etc represents variables, parameters, binary variables etc.
I need to print 0 value for all the variables and paramteric values wherever it is 0. Please if any one know anything abt it, plzz help
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.