Page 1 of 2

Using GAMS on Mac OS X Environment with Wine bottler

Posted: Tue Feb 13, 2018 11:35 am
by scsaxena
Hello !!

I am a new user of GAMS and have installed GAMS on my MacBook using Wine & WineBottler.

When I compiled my first code, I got a lot of errors.

I need help in customising the environment for programming with GAMS. One such error log is pasted below:

--- Job Hydro_Optimize_2.gms Start 02/13/18 09:58:37 24.9.2 r64480 WIN-VS8 x86 32bit/MS Windows
GAMS 24.9.2 Copyright (C) 1987-2017 GAMS Development. All rights reserved
Licensee: GAMS Development Corporation, USA G871201/0000CA-ANY
Free Demo, +1 202-342-0180, support@gams.com, www.gams.com DC0000
--- Starting compilation
--- Hydro_Optimize_2.gms(10) 3 Mb
--- call GDXXRW Generator_data.xls set=g RDim=1 rng=DC!a2:a10000 par=Maxgen RDim=1 CDim=1 rng=DC!a1:ct98 par=EnergyLimit RDim=1 CDim=1 rng=DC!a1:cw20 par=Demand RDim=1 rng=Demand!a2:b97

GDXXRW 24.9.2 r64480 Released Nov 14, 2017 VS8 x86 32bit/MS Windows
Cannot create an instance of Excel: Error = OLE error 800401F3, ProgID: "Excel.Application"
Check that Excel is installed correctly.
In case you use the "Click-to-Run" version of Excel, uninstall
this version and install the regular version.
**** Problem opening Excel: Cannot create an instance of Excel: Error = OLE error 800401F3, ProgID: "Excel.Application"
Total time = 52 Ms
--- Hydro_Optimize_2.gms(11) 3 Mb
*** GDXIN failed C:\users\scs\My Documents\gamsdir\projdir\Generator_data.gdx
*** Msg: No such file or directory
--- Hydro_Optimize_2.gms(11) 3 Mb 1 Error
*** Error 510 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
Unable to open gdx file for $GDXIN
--- Hydro_Optimize_2.gms(12) 3 Mb 2 Errors
*** Error 502 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
GDXIN file not open - ignore rest of line
--- Hydro_Optimize_2.gms(51) 3 Mb 3 Errors
*** Error 257 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
Solve statement not checked because of previous errors
--- Hydro_Optimize_2.gms(55) 3 Mb 6 Errors
*** Error 352 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
Set has not been initialized
*** Error 141 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
Symbol declared but no values have been assigned. Check for missing
data definition, assignment, data loading or implicit assignment
via a solve statement.
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
*** Error 352 in C:\users\scs\My Documents\gamsdir\projdir\Hydro\Hydro_Optimize_2.gms
Set has not been initialized
--- Hydro_Optimize_2.gms(58) 3 Mb 6 Errors
*** Status: Compilation error(s)
--- Job Hydro_Optimize_2.gms Stop 02/13/18 09:58:38 elapsed 0:00:00.742
Exit code = 2

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Tue Feb 13, 2018 12:31 pm
by bussieck
Hi,

gdxxrw (tool to read/write and write Excel files) requires native Windows and Excel installed. So you either generate the GDX file on your Windows box and move them over to your Mac or you resort to more platform independent formats like CSV.

Hope this helps,
-Michael

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Tue Feb 13, 2018 12:53 pm
by scsaxena
Thanks Michael.
I would try this out.

Regards,

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Tue Feb 13, 2018 3:01 pm
by scsaxena
The reason why I was trying to use Wine is the convenience it offers in terms of a "Windows" like Graphic User interface for coding environment.

I have tried installing the Mac OS X version directly also but it requires that I work on the Command Line Prompt, which I am unable to do.

Is there any document that I could refer which teaches me how to get a windows type user interface on Mac OS X without using Wine / Wine Bottler. This should also solve the problem of native Excel installation requirement.

Thanks in advance for your help.

Regards.

SC Saxena

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Tue Feb 13, 2018 3:18 pm
by bussieck
Hi,

GAMS Studio is about to be released (in a month or two) in it's first version (see viewtopic.php?f=8&t=10198#p23354). In the meantime you might want to check the contributed software page with some alternative UI for GAMS: https://www.gams.com/community/contributed-software/ some of them for the Mac.

Hope this helps,
-Michael

Reading and Writing data from and to Excel

Posted: Wed Feb 14, 2018 6:14 am
by scsaxena
Thanks Michael.
I found "AmalGAMS" GUI for Mac and it is a great help.

In the mean while, I have a licensed version of MS Office for MAC (including Excel) installed on my Mac and still I am getting some errors.

I am trying to work on this.

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Wed Feb 14, 2018 7:01 am
by scsaxena
If somebody can help me resolve the errors which are as follows [ GDX file not getting created]:


GAMS 25.0.2 r65346 Released Jan 31, 2018 DEX-DEG x86 64bit/Mac OS X 02/14/18 11:29:04 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


1 Sets
2 i canning plants / Seattle, San-Diego /
3 j markets / New-York, Chicago, Topeka / ;
4
5 Parameters
6
7 a(i) capacity of plant i in cases
8 / Seattle 350
9 San-Diego 600 / ;
10
11 Parameters
12
13 b(j) demand at market j in cases
14 /New-York 325
15 Chicago 300
16 Topeka 275 / ;
17 *=== Import from Excel using GDX utilities
18 *=== First unload to GDX file (occurs during compilation phase)
19
**** CALL=127 "gdxxrw.exe transport.xls par=Level rng=Distances!A1:D3"
**** Above call failed, RC=127
**** ERRORLEVEL set to 1
20 $call gdxxrw.exe transport.xls par=Level rng=Distances!A1:D3
**** $330
21
22 Parameter d(i,j) distance in thousands of miles New-York Chicago ;
**** File: /Users/scs/Documents/gamsdir/projdir/Transport_Problem/transport.gdx
**** Msg : No such file or directory
23 $gdxin transport.gdx
**** $510
24 $load d
**** $502
26
27
28 * New-York Chicago Topeka
29 * Seattle 2.5 1.7 1.8
30 * San-Diego 2.5 1.8 1.4 ;
31
32
33 Scalar f freight in dollars per case per thousand miles /90/ ;
34
35 Parameter c(i,j) transport cost in 1000s of dollars per case ;
36 c(i,j) = f*d(i,j)/1000 ;
**** $141
37
38 Variables
39 x(i,j) shipment quantities in cases
40 z total transportation costs in 1000s of dollars ;
41
42 Positive variable x ;
43
44 Equations
45 cost define objective function
GAMS 25.0.2 r65346 Released Jan 31, 2018 DEX-DEG x86 64bit/Mac OS X 02/14/18 11:29:04 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


46 supply(i) observe supply limit at plant i
47 demand(j) satisfy demand at market j
48 ;
49 cost.. z =e= sum((i,j), c(i,j)*x(i,j)) ;
50
51 supply(i).. sum(j, x(i,j)) =l= a(i) ;
52
53 demand(j).. sum(i, x(i,j)) =g= b(j) ;
54
55 Model transport /all/ ;
56
57 solve transport using lp minimizing z ;
**** $257
58
59 display x.l, x.m ;
**** $141
GAMS 25.0.2 r65346 Released Jan 31, 2018 DEX-DEG x86 64bit/Mac OS X 02/14/18 11:29:04 Page 3
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages


141 Symbol declared but no values have been assigned. Check for missing
data definition, assignment, data loading or implicit assignment
via a solve statement.
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors
330 CALL failed
502 GDXIN file not open - ignore rest of line
510 Unable to open gdx file for $GDXIN

**** 6 ERROR(S) 0 WARNING(S)


COMPILATION TIME = 0.018 SECONDS 3 MB 25.0.2 r65346 DEX-DEG


USER: GAMS Development Corporation, USA G871201/0000CA-ANY
Free Demo, +1 202-342-0180, support@gams.com, www.gams.com DC0000


**** FILE SUMMARY

Input /Users/scs/Documents/gamsdir/projdir/Transport_Problem/MyTransport_Excel.gms
Output /Users/scs/Documents/gamsdir/projdir/Transport_Problem/MyTransport_Excel.lst

**** USER ERROR(S) ENCOUNTERED

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Thu Feb 15, 2018 10:37 am
by Renger
Hi

As I don't have your excel file, I can only guess. Perhaps the file has the extension xlsx (and not xls). You can also add at the end of the gdx command "trace = 3", then you will see where gdx has problems importing or exporting the data.

Cheers
Renger

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Thu Feb 15, 2018 3:10 pm
by scsaxena
The problem of GDXXRW not being called got partially resolved when I started as a New GAMS Project and wrote my code inside a project that I created.
But now the path is an issue. I am attaching the Code File, List File and the XLS file.

Would be grateful if someone can help me getting my GAMS running on my Mac OS X.

Thanks in advance.

Re: Using GAMS on Mac OS X Environment with Wine bottler

Posted: Thu Feb 15, 2018 3:39 pm
by Renger
With projects, Gams looks in the same directory for the excel file. So if it is lying somewhere else you have to add the path to the gdxxrw command.
Cheers
Renger