Hello, I have a problem solving problem 149. I believe that the algorithm cannot determine the initial value of X(J-1), which for J=1 is equal to 0, to which the difference value N(J) -S(J) is then added. Could I please have a question on how to fix this problem?
OPTION NLP = CONOPT
SET
J index_prome /1*5/;
PARAMETERS
S(J) SO /1 0.254, 2 0.318, 3 0.287, 4 0.275, 5 0.290/
N(J) NO /1 0.382, 2 0.300, 3 0.374, 4 0.296, 5 0.399/;
VARIABLE X(J);
EQUATIONS LOKAL;
LOKAL… X(J)=E= X(J-1)+(N(J)- S(J)); - there are 4x 149 problem uncontrolled set entered as constant
DISPLAY X(J)
By the way, in the display-statement referencing to indices is not needed. Also, when displaying variables you need to state the variable attribute. Do you for example want to display the lower/upper bound of the variable, or the level (.l - most likely), then use
DISPLAY X.L
See also: https://www.gams.com/latest/docs/UG_Variables.html#UG_Variables_VariableAttributes