Hi all, many many thanks in advance for any help you can provide with the following issue:

I am attempting to solve an optimization problem which includes solution of a dynamic system via collocation. My goal is to calculate the time needed for this system to transition from one state to another: the (apparently) complicating factor is that I’d like to use a fixed step size and to allow the number of finite elements to vary. I have a specific syntactical question that I believe I need to resolve for my implementation to work:

I define an integer variable, numFE(S), as follows (bounds are known to be reasonable):

INTEGER VARIABLE numFE(S);

numFE.l(S) = 18;

numFE.lo(S) = 15;

numFE.up(S) = 20;

Later, in the code, I want to ensure that the system is within a tolerance of a desired point for elements greater than or equal to numFE(S):

**BCCl(I,j,S)$(ORD(I) gt numFE.l(S))… Cdes(S)- C(i,j,S) =g= - 0.001 ;**

Of course, I very much need this conditional to hold true for the value of numFE returned in the solution!

Here is the issue: the conditional in the above equation is defined in terms of whatever level I initialize the problem at, instead of the level at the solution (in this case numFE is pushed to the lower bound in the absence of the proper interpretation of the equation above)! Here is the print out of the results.

— VAR numFE

LOWER LEVEL UPPER MARGINAL

1 15.000 15.000 20.000 -0.263

2 15.000 15.000 20.000 -0.284

3 15.000 15.000 20.000 -0.355

4 15.000 15.000 20.000 -0.559

---- EQU BCCh

LOWER LEVEL UPPER MARGINAL

19.1.1 -INF -0.001 0.001 .

19.1.2 -INF -0.001 0.001 .

19.1.3 -INF 0.001 0.001 EPS

19.1.4 -INF 0.001 0.001 EPS

19.2.1 -INF -3.248E-4 0.001 .

19.2.2 -INF -1.726E-4 0.001 .

19.2.3 -INF 2.6447E-4 0.001 .

19.2.4 -INF 2.6678E-4 0.001 .

20.1.1 -INF -1.499E-4 0.001 .

20.1.2 -INF 2.0500E-4 0.001 .

20.1.3 -INF -1.617E-5 0.001 .

20.1.4 -INF 2.4321E-5 0.001 .

20.2.1 -INF 9.4688E-5 0.001 .

20.2.2 -INF 8.5717E-4 0.001 .

20.2.3 -INF -5.685E-4 0.001 .

20.2.4 -INF -3.928E-4 0.001 .

So, my question is how should I modify the above bolded expression so that the equation can be enforced conditionally upon the value of the variable numFE(S)? I have not been able to find any help in the GAMS user guide, since it seems from that chapter that my syntax should work. Thanks so much in advance!