I'm trying to solve an optimization problem on GAMS, but only for a subset. Right now, i have a code that optimizes for all the elements of set t:
t time in hours / 1 * 8760 /
How do I run the optimization only for t from 1 to 3500, AND from 6500 to 8760 (for example)? FYI, all of my parameters data (from .csv) that i imported to GAMS have 8760 values. Here's a simple objective function to use:
eObjFunc.. vZ =e= sum(t, v1(t));
The simplest way I could think of is to edit all my .csv data so they only have the t values that I care for. In this case, define set t = 1 to 3500, 6500 to 8760. Then, just run the optimization.
However, I'm sure there's a smarter way to do this without having to modify my .csv data... Really appreciate your help!
You can define subsets like this (assuming t
is defined already as 1*8760
):
Set tt(t) /1*3500, 6500*8760/;
And then use tt
instead of t
in your equation:
eObjFunc.. vZ =e= sum(tt, v1(tt));