constraint variables in set

Hi,
i have these sets:
bat /b1b4/
clust /c1
c2/
map_clust(clust,bat) /c1.b1
c2.b2
c2.b3
c2.b4/

and the variable P(bat).

how can I have that P(bat) of each bat in each set is equal (eg: P(b2)=P(b3)=P(b4), since all of them are inside the same cluster c2)?

thanks in advance

Nebu,

I assume that the batteries are partitioned into clusters (i.e. each battery is in exactly one cluster). A little bit of GAMS code could check this and abort if false: this prevents a lot of head-scratching about infeasible models in case of data errors.

You could just have a variable P(cluster) instead of P(bat). To do this you would need to rewrite any algebra using P(bat) to use P(cluster) instead. This might require adjusting sums or other algebra. This is a common thing to do in GAMS.

You could also have a variable Pcl(cluster) and add an equation like this:

equation oneP(cluster,bat);
oneP(map_clust(cluster,bat)) … Pcl(cluster) =E= P(bat);

You introduce some extra variables in the formulation, but probably not too many. Many (most?) solvers will remove the extra variables during presolve, so the solver ultimately gets the same model in either case.

HTH,

-Steve

Hi Steve, each battery is in exactly one cluster.
the point is that moving from P(bat) to P(clust) will lead to a different results (the constraint is on the power of each battery)