Excel import in Gams dont works. GDX file is always deleted.

Hello everybody,

im working with gams and I want to include data from a excel file.
This excel file has several tables at several separate worksheets.

I always get the error that my gdx file could not be read because gams
deletes it automatically. I have no idea why.
Would be great if you help me out with some ideas or hints !






Gams Code :

$CALL GDXXRW.EXE Data1.xls set=e rng=Skillmatrix!A2:A82 rdim=1 set=q
rng=Skillmatrix!B2:F2 cdim=1 par=s rng=Skillmatrix!A1:F82 rdim=1
cdim=1 set=q rng=Skillrequirements!B2:F2 cdim=1 set=t
rng=Skillrequirements!A2:A32 rdim=1 par=r rng=Skillrequirements!A2:F32
rdim=1 cdim=1 set=t rng=Shifttypes!A2:A32 rdim=1 set=j rng=Shifttypes!
A2:A32 rdim=1 par=a rng=Shifttypes!A2:D32 rdim=1 cdim=1 set=q
rng=Costmatrix!B4:F4 cdim=1 par=c rng=Costmatrix!B4:F5 rdim=1 cdim=1
set=q rng=Costmatrix!B14:F14 cdim=1

$GDXIN Data1.gdx



sets

e employees
q qualifications



t time period
j shift type
d day /1*2/
;

$LOAD e q t j


parameters

s(q,e) qualification q per employee e
a(t,j) shift parameter
c(q) cost per qualification q

r(q,t) demand of qualification q in period t
;

$LOAD s r a c v
$GDXIN


binary variables
p(e,j,d) Assignment of employee e to shift j on day d


y(e,d) Day-off variable for employee e on day d

;

variables
F total Costs
;

equations
objective Minimize total costs
shiftperday1 At moste 1 shift per day

requirement Requirement fulfillment in each period for each
qualification
;


objective…
F =e= sum( (e,j,d,q), c(q) * p(e,j,d) * s(q,e))
;

shiftperday1(e,d)…
sum(j, p(e,j,d)) =e= y(e,d)
;



requirement(t,q,d)…
sum( (e,j), a(t,j) * p(e,j,d) * s(q,e) ) + sum( (e,j), a(t,j) *
p(e,j,d) * s(q,e)$(ord(q)=5)) =g= r(q,t)
;


Model A2T2 /all/;

Solve A2T2 using MIP minimizing F;




Error log:

— Job Task_2_test.gms Start 03/11/12 17:18:27 WEX-WEI 23.7.3 x86_64/
MS Windows
GAMS Rev 237 Copyright (C) 1987-2011 GAMS Development. All rights
reserved
Licensee: GAMS Development Corporation, Washington, DC
G871201/0000CA-ANY
Free Demo, 202-342-0180, sales@gams.com, www.gams.com
DC0000
— Starting compilation
— Task_2_test.gms(1) 2 Mb
— call GDXXRW.EXE Data1.xls set=e rng=Skillmatrix!A2:A82 rdim=1
set=q rng=Skillmatrix!B2:F2 cdim=1 par=s rng=Skillmatrix!A1:F82 rdim=1
cdim=1 set=q rng=Skillrequirements!B2:F2 cdim=1 set=t
rng=Skillrequirements!A2:A32 rdim=1 par=r rng=Skillrequirements!

GDXXRW Jul 14, 2011 23.7.3 WIN 27723.27726 VS8 x86/MS
Windows
Input file :smiley::\Task_2_test.gms
Output file: D:\Task_2_test.gms
**** Duplicate identifier = q
Output gdx file deleted
Total time = 764 Ms
— Task_2_test.gms(3) 2 Mb
*** GDXIN failed D:\Task_2_test.gms
*** Msg: No such file or directory
— Task_2_test.gms(3) 2 Mb 1 Error
*** Error 510 in D:\Task_2_test.gms
Unable to open gdx file for $GDXIN
— Task_2_test.gms(19) 3 Mb 2 Errors
*** Error 409 in D:\Task_2_test.gms
Unrecognizable item - skip to find a new statement
looking for a ‘;’ or a key word to get started again
— Task_2_test.gms(31) 3 Mb 3 Errors
*** Error 409 in D:\Task_2_test.gms
Unrecognizable item - skip to find a new statement
looking for a ‘;’ or a key word to get started again
— Task_2_test.gms(72) 3 Mb 4 Errors
*** Error 257 in D:\Dropbox\Uni Mannheim\02Fundamentals\Shares
\FSS12\OPM 662 Modelling and Optimization of Operations Scheduling
\Assignments\Assignment 2\Task 2\Task_2_test.gms
Solve statement not checked because of previous errors
— Task_2_test.gms(72) 3 Mb 4 Errors
*** Status: Compilation error(s)
— Job Task_2_test.gms Stop 03/11/12 17:18:28 elapsed 0:00:00.913
Exit code = 2


Excel file:
http://www.xup.in/dl,65267370/Data1.xls/ (Sorry I dont know how to
attach a file into a google group)


Thanks for your help.
Looking forward to hearing from you
Rich

\

$onecho > task.txt
set= N rng= nodes!A7 rdim=1


**** here continue to description

$offecho

  • for scalar->>>>>> par= Timestep rng= nodes!Y6 dim=0

$call gdxxrw.exe C:\KDSS_n\DSS_v2.1_finish.xls se=0 o=C:\KDSS_n\test1.gdx @task.txt trace=3
$gdxin test1.gdx

SETS n nodes ;
$loaddc N

here continue input




\

  1. not forgot to create new project in working folder!!!
  2. be careful and add items step by step



    – With kindly regards! Andre

hi,

thanks for your reply !

so i have to define every set and variable in a text file first? its
not possible to define them directly in gams and insert their data
afterwards?

whats the difference between $LOAD and $LOADDC ?
whats the meaning of this line ?

  • for scalar->>>>>> par= Timestep rng= nodes!
    Y6 dim=0


    thanks for your help !!!

regards
richard


On 12 Mrz., 05:14, Savitsky Andre wrote:

$onecho > task.txt
set= N rng= nodes!A7 rdim=1


**** here continue to description

$offecho

  • for scalar->>>>>> par= Timestep rng= nodes!Y6 dim=0

$call gdxxrw.exe C:\KDSS_n\DSS_v2.1_finish.xls se=0 o=C:\KDSS_n\test1.gdx @task.txt trace=3
$gdxin test1.gdx

SETS n nodes ;
$loaddc N

here continue input



  1. not forgot to create new project in working folder!!!
  2. be careful and add items step by step


With kindly regards!
Andre

\

HI!

  1. to put information in text file more convinient I prefer to do so.
  2. load is load loaddc in is mean load and domain checking
    loaddc more strictly watch consistence of model
  3. comments show how to load scalar ->. dim=0

All the best!

\