Alex,
Thank you for sending a fuller listing, which makes it easier to understand the situation.
Your problem is with these lines
59 m1(i,j1,k) [ C(i,j1) < counter(k) ] ..
75 Bmodel(i,j,k1) [counter(k1) < Bstock(i)-C(i,j)-1] …
The $ operators are used to decide which equations to include in the model.
They are parsed at compile time, and must be resolved prior to when the model is solved by the Solve statement.
Thus the conditions in these $ expressions can be based on set membership tests, or parameter/scalar value tests but CANNOT not be based on tests of variable values. At least not as stated, and perhaps not in the way you intend.
In your model, C(I,j1) and Bstock(i) are variables, not parameters.
Variable values are not yet known (i.e. are, as the error message says, endogenous to the system of equations which the test is trying to determine) so the test cannot be applied.
Now admittedly, the values of variables can be set to some initial value prior to the solve statement, and are then known. But those values should be referred to as C.L(i,j1) or Bstock.L(i), and even then it may be unwise to use them in $ expressions for equation inclusion, unless you are absolutely sure that you mean your condition to only depend on the starting values for those variables.
(Incidentally, line 6 may also give a compiler error:
165 First number greater than second number in macro
-or- more digits in first number than second (eg x01x9)
-or- leading zero illegal on second number (eg x1x010)
)
I hope this helps,
Paul
\
From: Alex Mitsel [mailto:mitselalex@gmail.com]
Sent: Friday, February 19, 2010 11:59 AM
To: Leiby, Paul Newsome
Subject: Re: Help with our gams model
Dear Paul,
Thanx for the quick reply.
I have attached my complete code :
GAMS Rev 233 WIN-VIS 23.3.3 x86/MS Windows 02/19/10 16:57:08 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
3 i item number / 1 , 2, 3 /
4 j client type / VIP , REG /
5 k stock amount /011 /
6 h stock amount /110/ ;
7
8 VARIABLES
9 Muo(i,k)
10 MuoTilda(i,h)
11 Total total price of storing goods
12 q1(i,k)
13 q0(i)
14 q(i,k)
15 BetaModel(i,j);
16 Integer Variables
17 C(i,j) critical level
18 Bstock(i) ;
19
20 From here these are Data inputed from company
21 Table Lamda(i,j) demand by client j for item i
22 VIP REG
23 1 5 2
24 2 4 4
25 3 8 6 ;
26 Parameters
27 P(i) price of storing item i
28 / 1 1
29 2 125
30 3 150 /
31 Beta(j) service level defined by company /VIP 0.98 , REG 0.95/
32 TotalDemand(j) total demand
33 counter(k) / 0 0,1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9,10 10,11 11/
34 counter2(h) /11 11,10 10,9 9,8 8,7 7,6 6,5 5,4 4,3 3,2 2,1 1,0 0/
;
35 Scalars
36 T mean lead time per shipment / 17 /;
37
38 TotalDemand(j) = SUM (i ,Lamda(i,j));
39 Alias (j , j1 )
40 Alias (k , k1);
41
42 cost equation works
43 EQUATIONS
44 These equations help build Beta(i,j)
45 m1(i,j1,k) calculating Muo
46 m2(i,k,h) calculating MuoTilda
47 calq1(i,k) calcualting first step for q(ik)
48 calq0(i) second step now calculate q0
49 calq(i,k) finally calculate q(ik)
50 BModel(i,j,k1) calculating the service level based on the q’s
51
52 These equations are constraints of the model
53 ServiceLevel(j)
54 CritcalSteps(i) these constriant together with next one are the second con
straint in the model
55 BaseStockBiggerThanCritical(i)
56 Vip(i) Critical level of vip is 0
57 cost ;
58
59 m1(i,j1,k) [ C(i,j1) < counter(k) ] ..
60 Muo(i,k) =e=sum { j ,Lamda(i,j) };
61
62 m2(i,k,h) [ counter2(h) = counter(k )]…
63 MuoTilda(i,h)=e=Muo(i,k);
64
65 Needs a condition here for stoping the Pi q
66 calq1(i,k)…
67 q1(i,k)=e={ T**counter(k) / Fact[counter(k)] } * prod ( h , MuoTilda(i,h)
);
68
69 calq0(i)…
70 q0(i)=e=[ sum(k, q1(i,k)) ] ** (-1);
71
72 calq(i,k)…
73 q(i,k)=e=q0(i)*q1(i,k);
74
75 Bmodel(i,j,k1) $ [counter(k1) < Bstock(i)-C(i,j)-1] …
76 BetaModel(i,j)=e=sum(k, q(i,k));
77
78 ServiceLevel(j)…
79 Beta(j)=l=sum(i, [ Lamda(i,j)*BetaModel(i,j) / TotalDemand(j) ] );
80
81 CritcalSteps(i)…
82 C(i,‘VIP’)=l=C(i,‘REG’);
83
84 BaseStockBiggerThanCritical(i)…
85 C(i,‘REG’)=l=Bstock(i);
86
87 Vip(i)…
88 C(i,‘VIP’)=e=0;
89
90 cost…
91 Total=e=sum(i , P(i)*Bstock(i) );
92
93 MODEL Project /ALL/;
94 option nlp=conopt;
95 option mip=cplex;
96 option minlp=dicopt;
97 Solve Project using minlp MINIMIZING Total;
**** 52,256
**** The following MINLP errors were detected in model Project:
**** 52 equation m1 .. VAR -control
**** 52 equation BModel … VAR -control
98
99
GAMS Rev 233 WIN-VIS 23.3.3 x86/MS Windows 02/19/10 16:57:08 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
Error Messages
\
\
52 Endogenous -control operations not allowed
256 Error(s) in analyzing solve statement. More detail appears
Below the solve statement above
**** 2 ERROR(S) 0 WARNING(S)
COMPILATION TIME = 0.016 SECONDS 3 Mb WIN233-233 Dec 15, 2009
**** FILE SUMMARY
**** USER ERROR(S) ENCOUNTERED
Appreciate any help.
Thanx Alex
-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Alex
Sent: Friday, February 19, 2010 3:36 AM
To: gamsworld
Subject: Help with our gams model
Hey,
We have an urgent problem with our gams model.
We have an error and can’t seem to fix it.
PLEASE HELP WE NEED A FAST ANSWER A.S.A.P.
Here is our prolem in the model and error output :
12 VARIABLES
13 Muo(i,k)
20 Integer Variables
21 C(i,j) critical level
Parameters
counter(k) / 0 0,1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9,10 10,11 11/
m1(i,j1,k) $ [ C(i,j1) < counter(k) ] …
65 Muo(i,k) =e=sum { j ,Lamda(i,j) };
100 Solve Project using minlp MINIMIZING Total;
**** $52,256
52 Endogenous $-control operations not allowed
256 Error(s) in analyzing solve statement. More detail appears
Below the solve statement above
–
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
\