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):

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.

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!

Having constraints that are enforced or not depending on variable values is a thick topic within optimization.
It is not as straightforward as you wish, but not impossible. It usually involves reformulation of this constraints so that they are enforced or relax based on the value of binary variables.

Having constraints that are enforced or not depending on variable values is a thick topic within optimization.
It is not as straightforward as you wish, but not impossible. It usually involves reformulation of this constraints so that they are enforced or relax based on the value of binary variables.

Thanks Claudio! After posting this, I did in fact find a solution to my issue via the use of binary variables, which works well for my relatively small problem. Certainly not as straightforward as I expected. Will have to check out your references on disjunctive programming, thanks again!