Dear all,
My problem setting is as follows:
1. I have set of linear equations, the variables obtained after solving these are X1,X2...,Xn and Y1,Y2...,Yn.
2. Once the above variables are obtained, these are required as parameters in the rest of the problem.
Can you please tell me how to do it?
save variables as parameters Topic is solved
-
- User
- Posts: 30
- Joined: 3 years ago
- Location: Ahmedabad
- Contact:
Re: save variables as parameters
Parag,
The variables levels are available after the solve using the .L attribute, e.g.
Using the variable levels like this is fundamental stuff. It is described in the Rosenthal tutorial (just digest the whole tutorial, it is not wasted time) and in more detail in the chapter on variables.
https://www.gams.com/latest/docs/UG_Tutorial.html
https://www.gams.com/latest/docs/UG_Variables.html
-Steve
The variables levels are available after the solve using the .L attribute, e.g.
Code: Select all
set i / 1 * 3 /;
variable x(i);
* I don't list it here, but imagine some code to solve a model and by doing so setting the variable levels for x
* now x.L(i) is available, just like a parameter.
parameter c(i), v(i);
c(i) = x.L(i);
v(i) = ord(i) / [x.L(i) + 2];
https://www.gams.com/latest/docs/UG_Tutorial.html
https://www.gams.com/latest/docs/UG_Variables.html
-Steve
-
- User
- Posts: 30
- Joined: 3 years ago
- Location: Ahmedabad
- Contact:
Re: save variables as parameters
Hi,
Thank you for your reply.
Thank you for your reply.