I guess you misunderstood me.
I know that the model is running fine. That was not the issue.
The issue is that my model is not solving if I use the %instance% approach.
Could you maybe send me the adjusted file back?
“I adjusted the file bringing back “instance†and it also solves fine.”
Alex
Am Mittwoch, 6. Mai 2015 18:13:00 UTC+2 schrieb Renger van Nieuwkoop:
Hi Alex
Runs fine on my computer. Here the output in my dos window.
What might happen is that you have the excel file open (see in the gdxutils.pdf for closing it using XLStalk.exe).
I deleted the results in the excel file and when I run the model, the sheet is filled with data. I adjusted the file bringing back “instance†and it also solves fine.
Iteration: 1 Dual objective = 2000.035000
LP status(1): optimal
Cplex Time: 0.02sec (det. 0.51 ticks)
Optimal solution found.
Objective : 7200.160000
— Restarting execution
— Reading solution for model LCC_MODEL
— GDX Point d:\Inbox\alex\LCC_MODEL_p.gdx
GDXXRW 24.4.1 r50296 Released Dec 20, 2014 VS8 x86 32bit/MS Windows
Input file : d:\Inbox\alex\GAMSOutput.gdx
Output file: d:\Inbox\alex\RunTest_2D_1.XLS
Substituting Index
Total time = 3171 Ms
*** Status: Normal completion
— Job Model_05.gms Stop 05/06/15 17:58:46 elapsed 0:00:05.608
If you add trace = 3 to the gdx-line I get a more usable output for debugging.
GDXXRW 24.4.1 r50296 Released Dec 20, 2014 VS8 x86 32bit/MS Windows
Excel version 15.0
Input file : d:\Inbox\alex\GAMSOutput.gdx
Output file: d:\Inbox\alex\RunTest_2D_1.XLS
Substituting Index
Loading sheet GAMSOutput
Reading data from Excel: Width = 13 Height = 22
var=z.l Rng=GAMSResults!A4:B5
var=f.l Rng=GAMSResults!A6:BN100 rdim=1 cdim=1
Squeeze value : 0.00000000000000E+0000
Squeeze value : 0.00000000000000E+0000
Type Symbol Dim Sheet Data RowHeader ColHeader
Var z 0 GAMSResults A4:A4 --:-- --:–
Clear range: A4:A4
Write range: A4:A4 CellCount = 1
Var f 2 GAMSResults B7:BN100 A7:A100 B6:BN6
Clear range: A6:BN100
Write range: A7:A100 CellCount = 94
Write range: B6:BN6 CellCount = 65
Write range: B7:N19 CellCount = 169
Total time = 3234 Ms
*** Status: Normal completion
Hope this helps
Renger
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Alexander Strenge
Sent: Mittwoch, 6. Mai 2015 17:57
To: gams...@googlegroups.com
Subject: Re: Looping over file names
Not my day… Sorry! And thank you again for your help.
Alexander
Am Mittwoch, 6. Mai 2015 17:49:42 UTC+2 schrieb Renger van Nieuwkoop:
There is only one file: the model_05.gms file
Renger
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Alexander Strenge
Sent: Mittwoch, 6. Mai 2015 17:48
To: gams...@googlegroups.com
Subject: Re: Looping over file names
You just need the “Model_05.gms” and “RunTest_2D_1.XLS” in one folder and it should work with reading and also writing to excel
Am Mittwoch, 6. Mai 2015 16:31:18 UTC+2 schrieb Renger van Nieuwkoop:
The gdx file is missing
Cheers
Renger
Von: gams...@googlegroups.com [mailto:gams...@googlegroups.com] Im Auftrag von Alexander Strenge
Gesendet: Wednesday, May 6, 2015 4:28 PM
An: gams...@googlegroups.com
Betreff: Re: Looping over file names
Hi Renger,
thank you.
I know that the input gdx file is created but the model will not be solved and the (output) excel file is not changed. Do I have to type “execute” instead of “call”?
I sent you a working gams and excel file for one instance without the %instance% and run.gms file.
Alex
Am Dienstag, 24. Februar 2009 21:23:41 UTC+1 schrieb Alison:
Hi,
I’ve written a GAMS program using the xls2gms function to upload data
and the execute_unload function to save the final result. However, I
need to run the same GAMS code for 50 different countries, which means
I have 50 different xls input files.
Is there a way to loop over file names so that I can change the input
file and the output file each time (e.g. Input_file_CountryX.xls,
Results_CountryX.gdx) ?
A simplified version of my code is below.
Thanks for your help-
Alison
*Read data from external spreadsheet
$call =xls2gms i=Input_file_Country1.xls r1=Sets!set_i
o1=industries.set r2=Sets!set_o o2=occupations.set r3=Wages!matrixB
o3=matrixB.inc r4=Sets!MatrixA o4=Average.inc
set i /
$include industries.set
/;
set o /
$include occupations.set
/;
*Define B from external spreadsheet
Table B(o,i) degree of belief
$include matrixB.inc
;
Parameter avg(i) average by industry/
$include Average.inc
/;
Equations, Objective Function, etc.
*Run the model to get results
Model WAGES /objective/;
Solve WAGES using dnlp minimizing find_min;
Display w.l, w.m;
*Export results to Excel by creating a .gdx file
execute_unload “Results_Country1.gdx” w.L w.M
execute ‘gdxxrw.exe Results_Country1.gdx var=w.L’
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@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+...@googlegroups.com.
To post to this group, send email to gams...@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+...@googlegroups.com.
To post to this group, send email to gams...@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.