Good evening
I have a model with the following details (I'll skip most sets, parameters and variables, of relevance are the sets, variable and objective function below):
set i /AF,A,B,C/
set j /A,B,C,EF/
Variable
F(i,j)
OF .. FT =e= sum((i,j),F(i,j));
I want to solve the model individually for each set element. E.G.: first I solve for F('AF','A'), second for F('AF','B'). Is it possible to automate this with a loop, or must I descriminate an individual OF for each pair i,j? If so, can you provide me with some details?
Thanks
Sequantial solve statements
Re: Sequantial solve statements
The typical solution for this in GAMS is to write you the model equations with a dynamic subset of the domain sets:
-Michael
Code: Select all
set i /AF,A,B,C/, ii(i)
set j /A,B,C,EF/m jj(j);
Variable
F(i,j)
OF .. FT =e= sum((ii,jj),F(ii,jj));
model m /OF/;
loop((i,j),
option clear=ii, clear=jj;
ii(i) = yes; jj(j) = yes;
solve m min FT us lp;
);
-
- User
- Posts: 15
- Joined: 4 years ago
Re: Sequantial solve statements
Thank you Michael!