Kim
Kim

Reputation: 179

Dealing with GAMS error: A suffix is missing

I am solving a model in GAMS. When running the optimzation model I want to save the optimal solution in a new varable. The heart of the code looks like this:

variables
   xSave(t) 'saving the value of x at optimum'
   x(t)     'variable';

 SOLVE mymodel MINIMIZE fx Using NLP;
 DISPLAY x.l;

When I exit at this point I can see that I have a solution; so the optimazation problem works fine!

I am trying to save the value of x in a new variable xSave and I have tried two methods:

Method1:

xSave(t)=x.l(t)

Method1:

loop(t, xSave(t)=x.l(t) ) ;

Both methods are returning the same error message:

A suffix is missing

What should I do?

Upvotes: 2

Views: 6366

Answers (1)

Martin Bonde
Martin Bonde

Reputation: 556

You need a suffix on xSave as well as it is a variable, i.e.

xSave.l(t) = x.l(t);

Upvotes: 2

Related Questions