Following is my model written in AMPL language. Could anyone kindly translate it to GAMS language? Thanks in advance!
asked 27 Jul '12, 00:55 Binzhou Xia fbahr ♦ 
The question has been closed for the following reason "The question is answered, right answer was accepted" by fbahr 15 Jan '14, 14:16
AMPL's
Translation of AMPL
and
[Edit: Whoops, my bad... you can't use scalars in set definitions – since members of sets are considered to be strings, and so boundary defining elements are expected to be. In more detail discussed in the comments sections below.] Domainrestrictions on variables are imposed using
Conditions are [edit]
And, finally, the objective function:
Useful resource: answered 27 Jul '12, 05:03 fbahr ♦ Thanks a lot! Can I operate the indices by multiplication in GAMS the same as in AMPL like
(27 Jul '12, 05:29)
Binzhou Xia
In GAMS, all members of sets are considered to be strings (for instance, So you need to do something clever using conditionals:
(28 Jul '12, 14:22)
fbahr ♦
SET B / 1 * .. / ; ALIAS(B,C) ; !!< virtual 'copies' of set B; necessary since sets ALIAS(B,D) ; !! can be bound only exactly once per scope ALIAS(B,E) ; EQUATION gauss_r(B,C) ; EQUATION gauss_r(B,C)$(ord(C) = 2*ord(B)).. \ sum((D,E)$(ord(D) <= 2*ord(B)1 and ord(E) = 2*ord(B)ord(D)), \ (x(D)*x(E)y(D)*y(E))) \ + ... \ =E= 2*x(C);
(28 Jul '12, 14:23)
fbahr ♦
A conditional
(28 Jul '12, 14:29)
fbahr ♦
Why do there come a error message "171 Domain violation for set" under x(D)*x(E)y(D)*y(E) and 2*x(C)?
(29 Jul '12, 11:29)
Binzhou Xia
The only way to allow for this is by defining Instead of SET B(A); !!< declaring that B is a subset of A B(A)$(ord(A) < H) = yes; !!< = {'1,'2',..,'10'}
(29 Jul '12, 12:54)
fbahr ♦
On second thought, since
(29 Jul '12, 16:32)
fbahr ♦
showing 5 of 7
show 2 more comments

You may want to add to the GAMS model: Variables x(A) y(A) w; positive variables x,y; By default variables are free in GAMS. Now it should solve fairly quickly with a global solver like Baron or lindoglobal. Glomiqo may be another candidate (we had to use an updated version for this solver). Otherwise you may want to think about good bounds on x and y. For global solvers these bounds are very important.  Erwin Kalvelagen Amsterdam Optimization Modeling Group erwin@amsterdamoptimization.com http://amsterdamoptimization.com  answered 01 Aug '12, 14:39 erwin An approach to bounding x(A), y(A) and w (we can assume w to be positive.) is to substitute them by x(A)/w, y(A)/w and 1/w respectively and get new x(A),y(A)\in [1,1]. Although this may lead the minimum of new w to 0, it seems the trivial minimum will not be reached unless m is congruent to 2 mod 8. So the transformation should work for m=22 posted above. Is there any open access to Glomiqo?
(02 Aug '12, 23:59)
Binzhou Xia
Glomiqo is a commercial software...
(03 Aug '12, 08:23)
Binzhou Xia

See also: AMPLGAMS conversion, by Erwin Kalvelagen answered 30 Jul '12, 14:23 yeesian I got it! Then how to represent \pi in AMPL and GAMS?
(31 Jul '12, 00:07)
Binzhou Xia
1
For AMPL: you might want to consult the AMPL Modelling Language googlegroups. Here's a possible answer. For GAMS: consult their user guide(pdf). You'll find it on pg57
(31 Jul '12, 00:19)
yeesian

Here are my modified models in AMPL and GAMS. (I now treat t to be a parameter taking values 0, ... ,h1, both for simplifying the model and the further information it will provide.) Any suggestions on the modeling and/or the selection of solvers are appreciated.
AMPL language
GAMS language